This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
docs(app-shell): record why client Zod issues are advisory at the Save gate, and pin the asymmetry (#6980) - #6983
Merged
Conversation
…e gate (#6980) `ResourceEditPage`'s Save gate has one validation term, `inspectorBlocking`. The live client Zod pass feeds the banner, the inline field errors and `previewDiagnostics` and gates nothing, which reads from outside as a defect. Measured, the asymmetry is right and the discriminator is whether the server backstops the class: CEL parse faults save 200 and publish live (#4306), while schema issues are refused by `saveMetaItem` with a 422 `doSave` already maps back into the same inline issues. So the only failure a blocking Zod gate could add is the client being stricter than the server (objectstack#5316), a class `clientValidation.ts`'s root-cure covers only at `path.length === 1`. Comment + pin test + empty-frontmatter changeset. No behaviour change: the `ResourceEditPage.tsx` diff is 48 added lines, all comments, 0 removed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013hfmP9hoMd3dJwTh85J4yB
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #6980 — the card asked for a verdict between two readings, and named a small deliverable for one of them. This PR is that deliverable. Accepting the verdict is still the PM's, so this does not close the card.
Verdict: reading (1), with one correction the evidence forces
The card's reading (1) was "the suppression is deliberate and merely undocumented". Measured, its substance holds and its wording does not:
Reading (2)'s diagnosis is therefore correct and its prescribed fix is not. That is what this PR records, so the next reader gets both halves.
The discriminator the card was missing: whether the server backstops the class
record.est_hours *saving with a 200 and a success toast, and publishing made the malformed expression the live field definition. The runtime authoring gate reports its findings only as advisory, on an already-successful save (Studio: render the runtime authoring gate's advisory findings returned by saveMetaItem #4133 →metadataClientFactory.onSaveAdvisory). The client is the only gate, so it must block.saveMetaItemruns the same contract, anddoSavealready maps the refusal —422/INVALID_METADATA/INVALID_PAYLOAD— straight back into the same inlineissues(ResourceEditPage.tsx, the catch block indoSave).clientValidation.ts's own header says as much: the live pass exists so authors "no longer have to wait for the next save round-trip". A schema-invalid draft cannot land. The client Zod pass is a preview of the server's verdict, not the thing standing between the draft and storage.So gating Save on Zod adds no protection. The only thing it can add is the one failure the client can cause on its own: being stricter than the server.
The skew class is real, and the root-cure covers one sixth of it
validateMetadataDraft'sserverSchemacure suppresses exactly: a top-level issue (path.length === 1) on a field absent from the draft that the live server marks optional. Measured on the bundled@objectstack/spec17.2.0, here is where the other classes land:path.length 1unrecognized_keys,path.length 0unrecognized_keys,path.length 2(e.g.nodes.0)path.length 3(e.g.nodes.0.label)invalid_valuenodes.N.type, via a 2-entry hard-coded set14 of the 15 wired root schemas reject an undeclared key. So the single most likely forward skew — the running server gains one authorable key — is uncovered on almost every type.
And it is not hypothetical. objectstack#5316 is a landed instance of exactly it: stored
viewbodies carryisPinned/sortOrder, written by the platform's own pin and reorder actions, and the authoring schema rejected them.clientValidation.tsrecords the verdict in its own words — "Judging a stored body by the authoring schema made the client strictly stricter than the server." Under today's advisory gate that cost a false banner. Under a blocking gate it would have dead-bolted Save for every author who had ever pinned a view, on a body the server accepts, with no on-screen editor able to takeisPinnedback out — the pin lives in the view switcher, not the form.That wedge is the hazard every gate in this family is explicitly built around:
blockingReport's selection stamp, and its siblings inObjectFieldInspector,ConditionBuilder,ConditionalFormattingEditorandPermissionAdvancedFacets. A blocking Zod gate would have reintroduced it in the one form no editor can clear.What is here
ResourceEditPage.tsx— comments only. 48 added lines, 0 removed, every added line a comment (proved by filtering the diff). The rationale sits once atblockingReport, where the existing Field inspector: Save is not gated on CEL errors — a parse-fault formula saves and publishes as the live field definition #4306 comment states the blocking half; a four-line pointer sits at the Save button'sdisabledexpression, which is where someone would go to "fix" this.ResourceEditPage.schemaAdvisory.test.tsx— pins both halves against one draft, so the asymmetry itself is the assertion. The fixture is the real skew shape: the stored page carries an undeclared root key, and the mocked type entry hands the validator a maximally lenient server schema (required: []) — a server that requires nothing at all — and the client still rejects, becauseunrecognized_keyshas an empty path. No server hint can rescue this class.Reverse verification — and it caught my own test first
Predicted in writing before running: wiring
issues.length > 0into the Save gate should turn the suite red.First run, against the suite as first written: 1 failed / 2 — and it failed on the wrong assertion. The "Save stays enabled" half passed under the mutation, because
waitFor(() => expect(save).toBeEnabled())retries and had succeeded on a render taken before the 200 ms-debouncedissueslanded. The mutation was only caught incidentally, by atitleassertion in the second test. The pin was vacuous exactly where it mattered.Fixed by anchoring on the banner — which proves the validator ran on this draft and rejected it — and then asserting Save's state synchronously, with no retry window.
Second run, same mutation: 2 failed / 2, both on the designed assertion,
Received element is not enabledwithdisabled="" title="Save (⌘S)".Mutation and restore were both proved on disk, not from an exit code: target blob
2a3d0722→a76b75e9→2a3d0722(equal to theHEADblob), occurrences of the old text 1 → 0 → 1 and of the injected text 0 → 1 → 0, andgit diff HEADempty after restore. The script restores viagit checkout HEAD -- ABSOLUTE_PATHunder anEXIT INT TERMtrap. Nodistis involved: the suite imports./ResourceEditPageby relative path, i.e. source.Verification
All at
38f493109, the final commit. Session: https://claude.ai/code/session_013hfmP9hoMd3dJwTh85J4yBTest Files 1 passed (1)/Tests 2 passed (2)— 1 path passed in, 1 file reported.ResourceEditPage.celGate,.defaultGate, and all sevenclientValidation.*) plus the new one — 10 paths passed in,Test Files 10 passed (10)/Tests 134 passed (134).pnpm --filter @object-ui/app-shell run type-check(tsc --noEmit && tsc -p tsconfig.test.json) — exit 0, with the script name echoed so this is not a zero-match silent pass. The main tsconfig excludes**/*.test.tsx, so that pass says nothing about the new file;tsconfig.test.json --listFilesconfirms it is in the program (1 hit, against acelGatecontrol also at 1).--format json: new test fileerrors=0 warnings=0;ResourceEditPage.tsxerrors=0 warnings=55, exactly thefd8daceccbaseline — measured by linting the base blob as a probe file in the same directory, not assumed.node scripts/check-changeset-presence.mjs— exit 0. Its verdict line: "1 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s) ... Every one of them has an EMPTY frontmatter — declared as releasing nothing, which is the explicit exemption and a complete answer to this gate."check-changeset-fixed/check-changeset-no-major/check-control-bytes— exit 0 each, verdict lines "All workspace packages are in the changeset fixed group.", "No changeset declares amajorbump.", "check-control-bytes: OK (scanned 5803 tracked text file(s); skipped 85 binary)."pnpm --filter '@object-ui/app-shell^...' build, exit 0), so none of the above is a false RED off an unbuilt tree.Bound of the reading, stated
origin/mainatfd8dacecc;@objectstack/specresolved 17.2.0 in a fresh worktree install.doSave's 422 handling andclientValidation.ts's own header, not observed on the wire. "The server accepts malformed CEL" is cited from Field inspector: Save is not gated on CEL errors — a parse-fault formula saves and publishes as the live field definition #4306's measurement, not re-run.zod,clientValidation,validateMetadataDraft,hasClientValidator,setIssues,schema validation,spec skew,skew,422,invalid_metadata) returned 0 hits total; five hot-control terms in the same pass over the same corpus returned 64 (inspector53,celPredicateField4,perm.cel.saveBlocked4,onLintChange2,onBlockingIssuesChange1). The zero is a measurement. Independently,ResourceEditPage.tsxat fix(app-shell): inspectors can block Save — the field inspector gates on CEL errors (#4306) #4536's base commit already imported and ranvalidateMetadataDraft, with a Save gate ofdisabled={saving || (!createMode && !isDirty)}— no validation term at all. The Zod validator was there and was not weighed./meta/typesresponse shape beyond therequiredarray the cure reads; e2e or browser behaviour.Filed for triage, not addressed here
Card #6982 — two of
clientValidation.ts's three spec-skew cures now rest on stale premises on 17.2.0:FORWARD_COMPAT_FLOW_NODE_TYPESis unreachable (nodetypeis an open string), andAUTHOR_SHAPE_ONLY_TYPES' hold onsharing_rulewas measured on 17.0.0-rc.5, whereasSharingRuleSchemanow declares all 7 ADR-0010 envelope keys. Out of scope here: lifting that opt-out turns a client gate on for a security-metadata edit door. That card is open and unassigned; nothing in this PR addresses it.Not done here, on purpose
Gating Save on client Zod errors is not implemented, and the evidence above is why it should not be. Nothing was skipped, disabled or quarantined; no PR was marked ready and no auto-merge was enabled.
Generated by Claude Code
Generated by Claude Code