Repository navigation
fix(metadata-protocol): a form view naming a field its object lacks reads with the lint's form-field-unknown warning - #29307
Conversation
…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>
Claude-Session: https://claude.ai/code/session_01ADHkmQM9W8oVztX5XNAQaN Co-authored-by: Claude <noreply@anthropic.com>
… ledger 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>
📓 Docs Drift CheckThis PR changes 1 package(s): ⛔ 1 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt 席位核对ACCEPT · The maintainer's words for this seat, verbatim: 「接手所有开发,包括跟进之前未完成的开发落地。」
Generated by Claude Code |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt Landing record · PR #29307
Release: ships Generated by Claude Code |
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 asform-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): runsvalidateFormLayouton the served view body and appends eachform-field-unknownfinding to_diagnostics.warningsas the spec's{ path, message }, with the rule's own message and an item-relative path.validanderrorsare left as they were.ViewItem(viewKind: 'form') keeps its form underconfig, 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'sform.path is mapped back toconfig.(QA's reproduction readsconfig.sections.0.fields.1). Containers and flattened form overlays are the walk's own input already.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/lintis imported lazily from its root on the first view read, the waybuild-probes.tsloadsvalidateObjectFieldRefs. 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_diagnosticsfrom its errors), the strict draft read, and the draft-preview arm (both throughserveDraft, before the Studio/metadata: a draft the editors, the draft_diagnosticsand 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_diagnosticsand is untouched.getMetaItems(the list read) is untouched.Which attach site the served read uses:
@objectstack/metadata-protocol'sreadMetaItem(decorateMetadataItemplus the view reference merge). The card'spackages/metadata/src/metadata-manager.tsis not on that path.Tests
packages/metadata-protocol/src/protocol.form-layout-diagnostics.test.ts, through the protocol's own save, publish and read (the methodsPUT /meta/view/NAME?mode=draft,POST .../publishandGETcall), with the stub engine shape ofprotocol.draft-publish-verdict.test.ts:validateFormLayoutrun in the same test.formViews.editis judged and located under its own key.{ valid: true }, draft and active.{ valid: true }.scripts/engine-double-contract.pinned.jsongains the new file's three engine-double rows (check:engine-double-contract's own--write).Acceptance notes
MetadataValidationResultSchema.warningsentries are{ path, message }in the spec, the shape the read's other derived warnings already use. Carryingcodeis a spec widening, left as an open question in the card report.advisoriesdo not carry this finding:validateFormLayoutis 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 namesform-field-unknownonly).?layers=true)_diagnosticsstays schema-only, as it already is for the ADR-0047 reference errors.ResourceEditPagealready renders_diagnostics.warningswith their paths. The form designer canvas has no reader of them; named as adomain:uifollow-up in the card report.Verification
Head
1560285c(main merged ateed73a39). Every run below goes throughscripts/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
Tests 4 passed (4).pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol teston1560285c:VERDICT command-exit 0,Test Files 301 passed | 4 skipped (305),Tests 22111 passed | 26 skipped (22137).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 touchedreadMetaItemormetadata-diagnostics.ts.readMetaItem:Tests 1 failed | 3 passed, the ViewItem case red at the active read.Tests 1 failed | 3 passed, the unresolvable-object case red.registry.getObjectto the authoredlistItems('object'):Tests 1 failed | 3 passed, the served-object control red (region__creported).Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon1560285c: 70 commands, all exit 0 (after a fullturbo run build --filter='./packages/**').--ranreconciliation: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