Skip to content

fix(metadata-protocol): a form view naming a field its object lacks reads with the lint's form-field-unknown warning - #29307

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-5a5960
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-5a5960

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #29196

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:表单视图的分区里写了对象上不存在的字段时,/meta 读取(已发布、草稿、草稿预览)的 _diagnostics.warnings 现在会带上 lint 规则 form-field-unknown 的原文警告,定位到具体字段引用。
  • 为什么改:这种表单以前保存、发布、读取都显示 valid: true,作者完全不知道字段被静默跳过;规则早就有,只是只在 CLI 里跑。
  • 风险与回滚:只加警告,不改 valid、不拒绝保存或发布;列表读取不受影响。回滚即还原本 PR,无数据迁移。
  • 先看:packages/metadata-protocol/src/metadata-diagnostics.ts(withFormLayoutWarnings,ViewItem 的 config 适配与对象查找),packages/metadata-protocol/src/protocol.ts(读取出口的三处接线),packages/metadata-protocol/src/protocol.form-layout-diagnostics.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.form-layout-diagnostics.test.ts,预期 4 个用例全绿;在 main 上同一命令有 2 个红。
  • 需要你做的:无,席位落地。

What changes

validateFormLayout (@objectstack/lint) reports a form section field the bound object does not have as form-field-unknown ("is silently skipped and never renders on the form"). It ran only in the CLI, so the meta door served such a view with _diagnostics: { valid: true }.

  • withFormLayoutWarnings (new, metadata-diagnostics.ts): runs validateFormLayout on the served view body and appends each form-field-unknown finding to _diagnostics.warnings as the spec's { path, message }, with the rule's own message and an item-relative path. valid and errors are left as they were.
    • A stored form ViewItem (viewKind: 'form') keeps its form under config, a rung the lint's view walk does not descend. It is handed to the rule as the container shape the walk reads ({ name, object, form: config }), and the finding's form. path is mapped back to config. (QA's reproduction reads config.sections.0.fields.1). Containers and flattened form overlays are the walk's own input already.
    • The object universe is the door's own lookup: registry.getObject(name) (the served object, extensions folded on) for each object name the body spells. A name it cannot resolve is left out, so that form is not judged and gets no warning.
    • @objectstack/lint is imported lazily from its root on the first view read, the way build-probes.ts loads validateObjectFieldRefs. The kernel boot path still reaches the package only through /runtime.
  • readMetaItem (protocol.ts): the pass runs at every served exit of the single-item read: the active read (after the ADR-0047 reference merge, which rebuilds _diagnostics from its errors), the strict draft read, and the draft-preview arm (both through serveDraft, before the Studio/metadata: a draft the editors, the draft _diagnostics and the Problems tab all call valid is refused only at publish — and one such draft rolls back the whole package release #26707 publish verdict is folded in). The execution face serves no _diagnostics and is untouched. getMetaItems (the list read) is untouched.

Which attach site the served read uses: @objectstack/metadata-protocol's readMetaItem (decorateMetadataItem plus the view reference merge). The card's packages/metadata/src/metadata-manager.ts is not on that path.

Tests

  • New packages/metadata-protocol/src/protocol.form-layout-diagnostics.test.ts, through the protocol's own save, publish and read (the methods PUT /meta/view/NAME?mode=draft, POST .../publish and GET call), with the stub engine shape of protocol.draft-publish-verdict.test.ts:
    1. QA's ViewItem body: the draft saves, its read carries the warning, the publish is not refused, and the active read carries the same warning. The message is compared against validateFormLayout run in the same test.
    2. A view container's formViews.edit is judged and located under its own key.
    3. Control: a form naming only fields the served object has (one of them only on the served object, not the authored one) reads exactly { valid: true }, draft and active.
    4. A form whose object does not resolve reads exactly { valid: true }.
  • Forced edit: scripts/engine-double-contract.pinned.json gains the new file's three engine-double rows (check:engine-double-contract's own --write).

Acceptance notes

  • The warning carries no rule id on the read wire: MetadataValidationResultSchema.warnings entries are { path, message } in the spec, the shape the read's other derived warnings already use. Carrying code is a spec widening, left as an open question in the card report.
  • The save and publish responses' advisories do not carry this finding: validateFormLayout is CLI-only on the runtime publish surface in the lint registry. Crossing it is a registry decision, left as an open question.
  • form-section-group-unknown, the rule's sibling finding, is not surfaced at the door (this card names form-field-unknown only).
  • The layered read (?layers=true) _diagnostics stays schema-only, as it already is for the ADR-0047 reference errors.
  • Studio: ResourceEditPage already renders _diagnostics.warnings with their paths. The form designer canvas has no reader of them; named as a domain:ui follow-up in the card report.
  • Cost: about 25 µs per single view read (2000 reads of a 6-section, 36-field form against a 40-field object, measured in-process). The list read pays nothing.

Verification

Head 1560285c (main merged at eed73a39). Every run below goes through scripts/pm/os-verify-lock.sh; each line quotes the run's own verdict.

Red first on main (104cd1a, test only)

vitest run src/protocol.form-layout-diagnostics.test.ts: Tests 2 failed | 2 passed (4). Failing: the ViewItem case at the draft read (expected { valid: true } to deeply equal { valid: true, warnings: [ { …(2) } ] }) and the container case (expected undefined to deeply equal [ { …(2) } ]). The two controls passed.

Green on the fix
  • The pin: Tests 4 passed (4).
  • pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol test on 1560285c: VERDICT command-exit 0, Test Files 301 passed | 4 skipped (305), Tests 22111 passed | 26 skipped (22137).
  • eslint (eslint.js packages/metadata-protocol --no-inline-config): exit 0.
Ablations (scripts/ablation-replace.mjs, each restored to the HEAD blob with an empty git diff HEAD)

Run on 42185878, the fix before the two main merges; neither merge touched readMetaItem or metadata-diagnostics.ts.

  • A, the active-exit call deleted from readMetaItem: Tests 1 failed | 3 passed, the ViewItem case red at the active read.
  • B, an unresolvable object name given an empty field set instead of being left out: Tests 1 failed | 3 passed, the unresolvable-object case red.
  • C, the lookup switched from registry.getObject to the authored listItems('object'): Tests 1 failed | 3 passed, the served-object control red (region__c reported).
Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack on 1560285c: 70 commands, all exit 0 (after a full turbo run build --filter='./packages/**'). --ran reconciliation: 70 derived famil(ies) accounted for — 70 run, 0 NOT-MEASURED (a DERIVED zero).

No ! in the title and no (narrowing) arm, so the full dogfood battery is not owed.


Generated by Claude Code

…iagnostics (red)

Claude-Session: https://claude.ai/code/session_01ADHkmQM9W8oVztX5XNAQaN
Co-authored-by: Claude <noreply@anthropic.com>
… form-field-unknown warnings

A form section naming a field its object lacks is Zod-valid, so the meta
door read it as { valid: true }; validateFormLayout ran only in the CLI.
The served view read (active, strict draft, draft preview) now runs that
rule on the body it serves, against the object the registry serves for each
name the body spells, and adds each form-field-unknown finding to
_diagnostics.warnings with the rule's own message. A warning: valid stays
the schema's answer, and neither save nor publish reads it.

Claude-Session: https://claude.ai/code/session_01ADHkmQM9W8oVztX5XNAQaN
Co-authored-by: Claude <noreply@anthropic.com>
…oes not implement

Claude-Session: https://claude.ai/code/session_01ADHkmQM9W8oVztX5XNAQaN
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/metadata-protocol, touching 10 documentable anchor(s).

⛔ 1 release-owned page(s) name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx (via validateFormLayout (symbol, a field of interface FormLayoutLint))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (literal, 55 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json c2a5be03bdd6541891c7548b3bc0e9ef7449d51e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 22fe1b7f06554aa1957f80d2e20c5639aa080da5 — the merge of head 1560285cfa1596ced7a14625c09251c7dcced726 into base c2a5be03bdd6541891c7548b3bc0e9ef7449d51e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 22fe1b7f06554aa1957f80d2e20c5639aa080da5 && git checkout 22fe1b7f06554aa1957f80d2e20c5639aa080da5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c2a5be03bdd6541891c7548b3bc0e9ef7449d51e 1560285cfa1596ced7a14625c09251c7dcced726 && git checkout -B drift-repro c2a5be03bdd6541891c7548b3bc0e9ef7449d51e && git merge --no-ff 1560285cfa1596ced7a14625c09251c7dcced726

node scripts/docs-audit/affected-docs.mjs --json c2a5be03bdd6541891c7548b3bc0e9ef7449d51e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c2a5be03bdd6541891c7548b3bc0e9ef7449d51e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt

席位核对

ACCEPT · domain:server seat 2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt · 2026-11-02T11:38Z · head 1560285c · claimed by seat 2 on #29196 (claim 6573750465, amendment on the card this act)

The maintainer's words for this seat, verbatim: 「接手所有开发,包括跟进之前未完成的开发落地。」

  1. Shape: a draft against main, Fixes #29196, Clause-②: no and Metadata-protocol: none at line start. check-governed-merges --pr 29307: NOT governed. No packages/spec, no ui/**, and no change to packages/lint rule logic. check-owed-reviews lists no contract review owed for this PR.
  2. Acceptance against the card:
  3. Evidence: red first on main (2 of 4), then 4 of 4. Three ablation legs are red as predicted and restored. The metadata-protocol suite is green: 301 files, 22111 tests. 70 derived gates exit 0. The cost guard holds: list reads are untouched, and a single view read costs about 25 µs more.
  4. Open questions:
  5. Gates on this head at ACCEPT time: 11 success, 13 skipped, 0 red, 21 still running. Auto-merge waits for them, and the merge queue re-runs CI against current main. The dev's local git merge-tree against the newer main was clean.
  6. Serial: no open PR edits readMetaItem or metadata-diagnostics.ts. Landing: pr_ready + automerge_enable through the relay.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 11:40
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 11:40
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit aeac74b Nov 2, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-5a5960 branch November 2, 2026 12:37
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt

Landing record · PR #29307

domain:server seat 2 · session_01ADHkmQxwoGb5fSnrFkpxmt · 2026-11-02T13:08Z · card #29196

Reading Probe Result
Merged PR #29307 state merged, merge commit aeac74bd16
On main git merge-base --is-ancestor aeac74bd16 origin/main yes
Queue refs git ls-remote origin refs/heads/gh-readonly-queue/* matching 29307 0
Content git grep -l withFormLayoutWarnings origin/main -- packages/metadata-protocol/src present

Release: ships patch for metadata-protocol at the next release.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant