Repository navigation
fix(metadata-protocol): a form view's unknown field or group is answered on save and publish, and the group finding reaches the read - #29389
Conversation
…red on save and publish, and the group finding reaches the read validateFormLayout crosses to the runtime publish gate for view writes, so an active save and a publish answer form-field-unknown and form-section-group-unknown as advisories (warnings, never refusals). The view read lets form-section-group-unknown through beside form-field-unknown. Claude-Session: https://claude.ai/code/session_01ADHkmQ25mz3PUm6CpePgB3 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 14 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 195fce740d54c188a67c7d75e61112a0d7c99267 && git checkout 195fce740d54c188a67c7d75e61112a0d7c99267
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7f277a86f670a956dcdf677937c1894706992bee 6266ec855994fe6b126f7d8f75a602bb1eb7417a && git checkout -B drift-repro 7f277a86f670a956dcdf677937c1894706992bee && git merge --no-ff 6266ec855994fe6b126f7d8f75a602bb1eb7417a
node scripts/docs-audit/affected-docs.mjs --json 7f277a86f670a956dcdf677937c1894706992bee
|
…Studio form is judged on save and publish validateFormLayout walks a `viewKind: 'form'` item's `config` sections beside the container rungs. The runtime publish gate hands the rule the written body as authored, so a Studio-saved form item now earns its form-field-unknown / form-section-group-unknown advisories on an active save and a publish. The view read drops its own config adapter and hands the rule the served body. Claude-Session: https://claude.ai/code/session_01ADHkmQ25mz3PUm6CpePgB3 Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt Contract reviewServed-tier: Face: the PR's nine paths decide no face ( ① Derived judgments
Design judgment on the two cited rules files (folded here; the declaration face carries no ④): the change holds against the code it cites and the card's acceptance — both findings answered as warnings on save and publish through the real door, ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt 席位核对ACCEPT · The maintainer's words for this seat, verbatim: 「接手所有开发,包括跟进之前未完成的开发落地。」 There is no maintainer ruling on the card. The seat filed it as the follow-up owed by PR #29307 (#29196).
Generated by Claude Code |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt Landing record · PR #29389
Generated by Claude Code |
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt
Requested by Steve · project thread
Fixes #29309
Clause-②: no
Metadata-protocol: none
维护者速读
advisories里带上 lint 原文警告(form-field-unknown/form-section-group-unknown);读取的_diagnostics.warnings也补上了分组那一条。valid不变;草稿保存照旧不跑规则。规则现在也读 Studio 存的表单项(viewKind: 'form',分区在config下),所以os validate/os build/os lint对这类表单也会多出同样的警告。回滚即还原本 PR,无数据迁移。packages/lint/src/validate-form-layout.ts(表单项config这一级的遍历),packages/lint/src/authoring-rules.ts(validateFormLayout登记项改为runtimeTypes: ['view']),packages/metadata-protocol/src/metadata-diagnostics.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,预期 10 个用例全绿;在 main 上新增的用例 4 个红(对照组绿)。What changes
packages/lint/src/authoring-rules.ts): thevalidateFormLayoutregistration moves fromCLI_ONLY+RUNTIME_NEEDS_FULL_SNAPSHOTtoCLI_AND_RUNTIME+runtimeTypes: ['view'].packages/lint/src/validate-form-layout.ts, the view walk only, per claim amendment 6579089637): the rule also walks aviewKind: 'form'item'sconfigsections, the shape Studio saves ({ name, object, viewKind: 'form', config }), bindingconfig.data.objectfirst and the item'sobjectotherwise. Rule ids, messages, hints and severity are unchanged. A list item'sconfigis not walked. The rung lives in this rule, not in the sharedview-walk.ts, so the other walkers' verdicts do not move. The CLI commands see the same rung, so a stack carrying a form item is judged there too. The rule is advisory, so an active save and a publish of a view whose form names an unknown field or an undeclared field group land as before and answer both findings inadvisories(rule id, message, hint,severity: 'warning').packages/metadata-protocol/src/metadata-diagnostics.ts):withFormLayoutWarningsletsform-section-group-unknownthrough besideform-field-unknown, with the lint's own message (one spelling). Its ownconfigadapter (formLayoutSubject, from meta door: a form view naming a field its object lacks publishes with _diagnostics valid, because the door validates the Zod shape only and never runs the lint's FORM_FIELD_UNKNOWN #29196) is retired: the rule now reads the served item as it is, the same walk the gate runs, and the read's paths (config.sections.0.fields.1) are unchanged.The measurement the card asked for (the snapshot at the real doors)
Read and then measured on a real showcase boot (
pnpm dev --fresh, this branch's build):PUT /meta/view/X(active save)registry.listItems('object')=getAllObjects→resolveObject(overlay + every extender folded, the shapegetObjectserves), plus stored rows folded byfoldStoredCollectionloyalty_tier(ashowcase_accountextension field),no_such_fieldand groupno_such_group: two advisories, the extension field not reportedPOST /meta/view/X/publishno_such_fieldanswered as a warning, publish not refusedPUT /meta/view/X?mode=draftnope_fieldreportedname+loyalty_tier: no advisoryPUT /meta/view/showcase_account.probe_e(viewKind: 'form',no_such_fieldunderconfig): no advisory, the read warned. This is what the rung closes; pinned below.So the objects are present, extensions and stored rows included, on both doors that run rules. No door hands the rule a snapshot without them.
No double report on the read
The read carries no runtime advisory: the draft read folds the publish verdict's refusals only (
withPublishVerdict), and these findings are never refusals. Pinned: the active read after an active save carries each finding once.Tests
packages/metadata-protocol/src/protocol.form-layout-diagnostics.test.ts(the #29196 file and harness, no new engine double), four new cases:form-field-unknownas a warning and is not refused (half 1);{ valid: true };config.sections.0.fields.1;packages/lint/src/validate-form-layout.test.ts, four new cases: a form item's unknown field and undeclared group, found atviews[0].config…withwhere· config; the config's owndata.objectbinding wins over the item'sobject; control: real fields and a declared group are clean; control: a list item'sconfigis not walked.Red first: cases 1-3 red on
origin/main57cde8cb(control green); after the round-1 fix, case 5 and the two lint finding cases red on9226d33b(both controls green).Forced test edits, named:
protocol.form-layout-diagnostics.test.ts: the stub registry'slistItems('object')now lists the served (merged) object rather than the authored one. Both real registry reads go throughresolveObject; the old stub answered a shape no registry answers and would have invented a phantom on the extension field. The fixture object also declares onefieldGroupsentry.runtime-gate.test.ts(three lists),authoring-rule-wiring.test.ts(one),runtime-gate.page-visibility-predicate-writes.test.ts(one): theviewwrite's rule list gainsvalidateFormLayoutaftervalidateReferenceIntegrity.Acceptance notes
views[0].formViews.edit.sections[0].fields[2],views[0].config.sections[0].fields[1]), as every runtime-gate advisory is; the read's warnings stay item-relative.?mode=draftsave runs no registry rule ([runtime/metadata] 作者时规则只存在于 CLI:Studio/REST/MCP 的运行时授权面是第四扇门,26 条规则一条不跑——#4409 修完后最大的敞口 #4463 D1), so it answers no form-layout advisory; its read and its publish do. Left as it is by the seat.Verification
Head:
6266ec85(merge oforigin/main7f277a86into the rung commiteb7ddbb4). All runs below on6266ec85unless marked.origin/main57cde8cb:Tests 3 failed | 5 passed (8)(cases 1-3; control green).9226d33b(new pins, rule unchanged):validate-form-layout.test.tsTests 2 failed | 34 passed (36),protocol.form-layout-diagnostics.test.tsTests 1 failed | 9 passed (10)(case 5; both controls green).eb7ddbb4:36 passed (36),10 passed (10).CLI_ONLY, lint rebuilt, preflight marker in 4 built files): cases 2 and 3 red; restored, preflight--absentexit 0.form-field-unknownonly): cases 1 and 2 red; restored.configrung removed, lint rebuilt, preflight marker in 4 built files): lint2 failed | 34 passed; door3 failed | 7 passed(the meta door: a form view naming a field its object lacks publishes with _diagnostics valid, because the door validates the Zod shape only and never runs the lint's FORM_FIELD_UNKNOWN #29196 read pin, case 1 and case 5: the read has no adapter now, so it depends on the rung too); restored,git diff HEADempty, rebuilt, preflight--absentexit 0.Package suites and typecheck (head 6266ec8, under the verify lock)
turbo run build --filter='./packages/**'exit 0;pnpm --filter @objectstack/spec check:generatedexit 0pnpm --filter @objectstack/lint test→ exit 0,Test Files 189 passed (189),Tests 7834 passed (7834)pnpm --filter @objectstack/lint typecheck→ exit 0pnpm --filter @objectstack/metadata-protocol test→ exit 0,Test Files 304 passed | 4 skipped (308),Tests 22161 passed | 26 skipped (22187)pnpm --filter @objectstack/metadata-protocol typecheck→ exit 0Derived gates: 61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN (dispatch-gates --ran, head 6266ec8)
Package lint: root eslint
--no-inline-configonpackages/lintandpackages/metadata-protocol→ exit 0.Generated by Claude Code