Repository navigation
feat(spec): a field declares the key(s) it was renamed from — renamedFrom on FieldSchema - #30934
Conversation
…was renamed from (WIP) Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
… changeset (WIP) Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
…eld shape's tail Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
…anned, not yet read) Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
…red prescription Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
…namedFrom Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 172 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 da1e1cc2bd079a3852ac8ef6f1025ac74a958e6b && git checkout da1e1cc2bd079a3852ac8ef6f1025ac74a958e6b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 26c965cb8f61ca59804d55e27e737bf7ff91b383 4ad4222ab8dafc79f152c5c0f2294ee9798a3505 && git checkout -B drift-repro 26c965cb8f61ca59804d55e27e737bf7ff91b383 && git merge --no-ff 4ad4222ab8dafc79f152c5c0f2294ee9798a3505
node scripts/docs-audit/affected-docs.mjs --json 26c965cb8f61ca59804d55e27e737bf7ff91b383
|
|
repo:cloud#3 · hotlong · session_01Q4EjjRhUZjdy8VXs6Kkur2 Contract-review-claim: session_01Q4EjjRhUZjdy8VXs6Kkur2 · head 4ad4222 · 2026-11-06T12:35Z Face: declared |
|
repo:cloud#3 · hotlong · session_01Q4EjjRhUZjdy8VXs6Kkur2 Contract reviewServed-tier: Rendered 2026-11-06T12:45Z on the net diff of the head against its merge base with ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentJudged against rulings Q3 and D3, the key's first consumers as #30884 and #30885 specify them, and the cited code at the head.
Check-runs on the head, read once38 completed success (among them Spec property liveness, Check Changeset, Governed Surface Queue Guard, Lint & Repo Gates, Build Core, Type Check · source gates, Type Check · consumer gates, PR-body guards, Test Core 3/5/6/8). 8 skipped by their own conditions. 16 in_progress at the read, NOT MEASURED: Test Core 1, 2, 4 and 7 of 8, Test UI 1, 2, 6, 9, 10, 11, 12, 13, 14 and 15 of 16, Type Check UI, Type Check · workspace. Findings, one line each
Implemented-by: VERDICT: PASS |
Fixes #30880
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #30885 —
skills/**does not teach the key yet: it is declared ahead of the upgrade step that carries the data (rename execution, #30885), and that step owns the skills line; this diff documents it incontent/docs/data-modeling/fields.mdxand the generated references维护者速读
renamedFrom: string[],包作者在新字段上写旧名(如renamedFrom: ['company']),并加五条最小校验(旧名须合法、不能是自己、不能和本对象现存字段重名、不能被两个字段同时认领、列表内不重复),违者在解析时拒收并点名对象、字段和旧名。renamedFromcarries the old column's data to the new name on package upgrade, instead of leaving it behind an empty new column (epic cloud#3652 Q3) #30885,升级预览读它是 Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declaredrenamedFromis planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884。FieldSchema是严格模式,带renamedFrom的制品会被比本版本旧的运行时拒收(未知键)。在 A field's declaredrenamedFromcarries the old column's data to the new name on package upgrade, instead of leaving it behind an empty new column (epic cloud#3652 Q3) #30885 落地前,这个键不会让任何升级搬数据。回滚即还原本 PR。packages/spec/src/data/object.zod.ts(refuseDishonestRenamedFrom,四条整表校验)、packages/spec/src/data/field.zod.ts(新键与 describe 文案)、packages/spec/liveness/field.json(planned行与翻转条件)。pnpm --filter @objectstack/spec exec vitest run src/data/field-renamed-from.test.ts,预期 11 个用例全绿。What changes
FieldSchema.renamedFrom: string[], optional (packages/spec/src/data/field.zod.ts, at the tail of the shape so the abbreviated type summaries in the references do not move). Each entry is an earlier key of the same field, in the field-key grammar^[a-z_][a-z0-9_]*$; a non-key entry is refused byFieldSchemaitself with a message naming the entry. The.describe()says what the key means, that it is read only at package upgrade, and that it is declared ahead of the upgrade step that carries the data.refuseDishonestRenamedFrominObjectSchema'ssuperRefine, besiderefuseStageFieldWithoutKinds(packages/spec/src/data/object.zod.ts). One locatedcustomissue atfields.FIELD.renamedFrom.INDEXper offending entry, naming the object, the field and the old key, when the entry is the field's own key, repeats an earlier entry of the same list, is a key another field of the object still declares, or is an old key an earlier field already claims (reported on the later claimant, naming the first). The own-key and repeat checks sit here rather than inFieldSchemabecauseFieldSchema.nameis optional (the map key is the field's key) and because the card asks every refusal to name the object.renamedFromis aplannedrow inpackages/spec/liveness/field.json, naming A field's declaredrenamedFromcarries the old column's data to the new name on package upgrade, instead of leaving it behind an empty new column (epic cloud#3652 Q3) #30885 (rename execution) as the reader that flips it tolivewith itsfile#symbolpointer, and Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declaredrenamedFromis planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884 (upgrade plan) as a second reader. NoauthorWarn, as the card states.liveness/state-counts/field.mdregenerated.packages/spec/authorable-surface/data.json, +1 row), the generated references (content/docs/references/**), the field-form omission ledger (metadata-form-zod-reconciliation.test.ts: not offered in the field form whileplanned, theconditionalFormattingprecedent), the two maps pinned exhaustive overFieldSchema(FIELD_KEY_STORAGE_CLASSin driver-sql asstorage;FIELD_REFERENCE_POSITIONSin metadata-core askeep, since the parse refuses any entry naming a live field), and the/meta/typesfield property count pin (82 to 83).content/docs/data-modeling/fields.mdx.@objectstack/specminor,@objectstack/driver-sqland@objectstack/metadata-corepatch.Not added, per the card: an object-level or package-level rename map, renames of objects or other metadata types, type compatibility checking (the upgrade plan judges it against the installed version), and any runtime behaviour.
Rulings this lands
Publish-time consequence, for the contract review
FieldSchemais strict. An artifact that carriesrenamedFromis refused, as an unrecognized key, by every runtime older than this release. A package that adds the key therefore needs its installing runtime at this release or later; a package that does not write it is unaffected. The changeset says the same.Tests
packages/spec/src/data/field-renamed-from.test.ts(11 cases): one and two earlier keys parse and are kept as written; an object without the key parses with norenamedFrommaterialized on any field; four grammar refusals atrenamedFrom.0; each of the four map-half refusals pinned bycodeandpathand by its sentence (object, field, old key, reason clause).os validateacceptance, run by hand with the built CLI against two throwawaydefineStackfixtures (removed after):renamedFrom: ['company']exits 0;renamedFrom: ['status']beside a livestatusfield exits 1 withobjects.0.fields.account_name.renamedFrom.0: Field account_name on object crm_account declares renamedFrom entry 'status', but object crm_account still declares a field status: that name is still in use, so no field was renamed away from it. ...Acceptance notes
renamedFromcarries the old column's data to the new name on package upgrade, instead of leaving it behind an empty new column (epic cloud#3652 Q3) #30885. Between this landing and the rename execution, an upgrade that meetsrenamedFromdoes what it does today (additive sync). The describe, the docs row and the changeset each say so; the ledger row's note records the card's plan that Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declaredrenamedFromis planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884 refuses a declared rename by name until A field's declaredrenamedFromcarries the old column's data to the new name on package upgrade, instead of leaving it behind an empty new column (epic cloud#3652 Q3) #30885 lands. That refusal is Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declaredrenamedFromis planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884's to build: until it lands, nothing refuses either.ObjectExtensionSchema.fieldsparsesFieldSchema, so an extension field may carryrenamedFromwith its grammar judged, but the map half runs only inObjectSchema's refinement, where the whole field map is visible. The card scopes the checks to the object; no extension behaviour is added.FieldSchemasees one field at a time andnameis optional; the issue path locates it. Every map-half refusal names all three.renamedFrom: []parses (no rename declared). The card's minimal list does not refuse it, so this PR does not.scripts/ablation-replace.mjs, anchor hit x1 to x0, restored,git diff HEADempty after the run): grammar, repeat, live key and double claim each turned their pin red on the first run. The own-key ablation stayed green on its first run: the pin'stoContain("the field's own key")also matched the shared prescription sentence, so the assertion was vacuous. The pin now asserts the reason clause, and the re-run ablation turned it red (refuses the field's own keyfailed, 1 of 11).Metadata-protocol:line. The claim carriedMetadata-protocol: none; this body declaresadded, because AGENTS.md defines a new authorable key asaddedandcheck-changeset-no-majorrefusesnonebeside a changedauthorable-surface/shard. Reported to the seat.origin/mainmoved 10 commits after the branch point; none touchespackages/spec,packages/metadata-core,packages/drivers/driver-sql,packages/metadata-protocolorcontent/docs(only other cards' changesets and an ADR anchor), so the branch was not merged before opening.Verification
All readings at head
4ad4222ab8unless stated.packages/spec full suite and typecheck (verify lock)
pnpm exec vitest run --maxWorkers=2inpackages/spec: exit 0,Test Files 909 passed (909),Tests 27388 passed | 1 todo (27389).pnpm typecheckinpackages/spec: exit 0.e3c18ce2a8was red on exactly one test,metadata-form-zod-reconciliation.test.ts(the field form offered no control forrenamedFrom); fixed by the omission-ledger row, then green.Other packages the diff touches (verify lock)
object-schema-fls-references.test.ts+objects/builtin-column-storage-attributes.test.ts: exit 0, 67 passed.builtin-column-collision.test.ts: exit 0, 11 passed.protocol.meta-types-degenerate-derivation.test.ts: exit 0, 18 passed (red at 82 before the count pin moved to 83).test/data-model-rules.test.ts(unit project): exit 0, 56 passed. lintvalidate-expressions,validate-security-posture,validate-expressions.formula-one-hop,validate-predicate-path-refs: exit 0, 737 passed (both at4ad4222ab8's parent commits; the commits after touch only test files of other packages).typecheckfor metadata-core, driver-sql, metadata-protocol: exit 0 each.Derived gates (dispatch-gates --commands at 4ad4222, 106 families)
pnpm check:dual-build-cjs-loadsrefuses without a fullpnpm buildof every package; it runs in CI.dispatch-gates --ranwith exit codes recorded:✓ 106 derived famil(ies) accounted for — 105 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).pnpm --filter @objectstack/spec check:generated:✓ All 14 generated artifacts are up to date.check:liveness:field 112 classified (live 105, planned 6, dead 1), every row classified, no orphan.Generated by Claude Code