fix(docs): the schema-extension FAQ rotted in reverse — pin the claim in the checked block this time - #4605
Merged
Conversation
… in the checked block this time #3890 taught that FieldSchema/ObjectSchema/ActionSchema are ZodPipes and that FieldSchema.extend throws. True when written; protocol 17 (#3855, acbf364) then retired the aliases whose lowering was the whole reason for the field/object transforms, the pipes collapsed to plain ZodObjects, and both prose claims inverted within days: .extend works, and the recommended FieldSchema.in is now undefined — following the FAQ was once again the only way to hit an error. Only ActionSchema (requiresFeature -> visible lowering, still live per the ledger) remains a pipe. All verified against a clean build: FieldSchema bound ZodObject .extend: function .in: undefined ObjectSchema bound ZodObject .extend: function .in: undefined ActionSchema bound ZodPipe .extend: undefined .in: ZodObject The example gate never noticed because #3890's checked block used only .parse() — deliberately shape-agnostic after CI rejected the .in.extend attempt. That made the code durable and left the PROSE as the only load-bearing surface, which is exactly where the rot settled. The rewrite moves the claim into the checked block: it calls FieldSchema.extend({ ... }) directly, so a future shape flip fails CI loudly instead of the prose going quietly wrong. Composition stays as the shape-agnostic default; ActionSchema is the documented pipe case; and the FAQ teaches the one-line probe (typeof SomeSchema.extend === 'function') instead of a table of shapes that history says will not stay true. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ajwvrmd1hDC9RBofYBhGuR
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
marked this pull request as ready for review
August 2, 2026 10:18
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Re-audit of the open items from the #3714 → #3890 thread against current
main. Most resolved themselves — the #3896 close-out removed the remaining tool/flow/view dead keys,verifiedAtadoption went from 3 to 224 dated entries, and the FieldSchema declaration/runtime divergence dissolved outright. One item inverted into new rot, and it's mine.The reversal
#3890 fixed a FAQ that recommended
FieldSchema.extend()whenFieldSchemawas aZodPipe(.extendwasundefined). The fix taught: all three schemas are pipes,.extendthrows, use.infor the inner object.Every one of those claims is now false on
main. Protocol 17 (#3855,acbf364a0) retired the deprecated aliases whose lowering was the whole reason for the field/object transforms — no aliases, no transform, and the pipes collapsed to plainZodObjects. Verified against a clean build:So the FAQ's
.extendwarning was wrong again, and its recommendedFieldSchema.inwas now the call that throws. The doc rotted in reverse, within days — the same "a claim with a timestamp, code moves under it in both directions" failure this whole thread has been unwinding, this time against my own fix.Why the gate didn't catch it
#3890's checked block deliberately used only
.parse()— shape-agnostic, after CI rejected the.in.extendattempt (the DTS/runtime divergence, since dissolved). That made the code durable and left the prose as the only load-bearing surface. Prose is exactly where rot settles: the gate compiles code, not claims.The fix — move the claim into the checked block
The rewritten FAQ's checked example now calls
FieldSchema.extend({ … })directly. If the schema ever grows a transform again,.extendvanishes and CI goes red — the tripwire the prose could never be. Alongside it:FieldSchema.parse+ validate additions) stays as the shape-agnostic default;ActionSchemais documented as the pipe case (itsrequiresFeature→visiblelowering is still live per the ledger), with the.in.extendskips-the-transform caveat;typeof SomeSchema.extend === 'function'— instead of a table of shapes that history says will not stay true, and says openly that this page got it wrong twice.Verification
pnpm --filter @objectstack/spec check:skill-examples—✅ 202 prose examples type-check(includes the new direct-.extendblock).FieldSchema.extend(...).parse(...)executes and returns the extended key;ActionSchemaconfirmedZodPipe/.extendundefined/.inZodObject— every claim in the rewritten FAQ was executed, not just type-checked.pnpm check:doc-authoring— 215 files clean.Re-audit summary (the rest of the old list)
category/permissions/active/builtIn)verifiedAtbackfillZodObjectnow)affected-docs.mjs) — worth an issue, not a drive-byform-widget-resolutionproofpathsbeyond@objectstack/specundoablein-browser dogfoodobjectui @732b1bf,verifiedAtwithin windowGenerated by Claude Code