Skip to content

feat(spec): a field declares the key(s) it was renamed from — renamedFrom on FieldSchema - #30934

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-30880-spec-field-renamedfrom
Nov 6, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-30880-spec-field-renamedfrom

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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 in content/docs/data-modeling/fields.mdx and the generated references

维护者速读

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 by FieldSchema itself 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.
  • refuseDishonestRenamedFrom in ObjectSchema's superRefine, beside refuseStageFieldWithoutKinds (packages/spec/src/data/object.zod.ts). One located custom issue at fields.FIELD.renamedFrom.INDEX per 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 in FieldSchema because FieldSchema.name is optional (the map key is the field's key) and because the card asks every refusal to name the object.
  • Liveness: renamedFrom is a planned row in packages/spec/liveness/field.json, naming A field's declared renamedFrom carries 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 to live with its file#symbol pointer, and Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declared renamedFrom is planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884 (upgrade plan) as a second reader. No authorWarn, as the card states. liveness/state-counts/field.md regenerated.
  • Mirrors the gates require: the authorable-surface shard (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 while planned, the conditionalFormatting precedent), the two maps pinned exhaustive over FieldSchema (FIELD_KEY_STORAGE_CLASS in driver-sql as storage; FIELD_REFERENCE_POSITIONS in metadata-core as keep, since the parse refuses any entry naming a live field), and the /meta/types field property count pin (82 to 83).
  • Docs: one row under a new "Package upgrades" heading in content/docs/data-modeling/fields.mdx.
  • Changeset: @objectstack/spec minor, @objectstack/driver-sql and @objectstack/metadata-core patch.

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

  • Epic objectstack-ai/cloud#3652, maintainer rulings (record on the epic): Q3 「默认拒绝,需显式映射(推荐)」, and on where the mapping lives, 「写进清单 renamedFrom」.
  • These supersede item 5 of objectstack#24443's ruling A (record 6259332195): "No rename spelling is added to the spec". Items 1 to 4 of that record stand. The card notes that no ADR text forbids the key (ADR-0126's dated note describes the access stages, it is not a rule), so no ADR amendment rides here.

Publish-time consequence, for the contract review

FieldSchema is strict. An artifact that carries renamedFrom is 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

  • New 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 no renamedFrom materialized on any field; four grammar refusals at renamedFrom.0; each of the four map-half refusals pinned by code and path and by its sentence (object, field, old key, reason clause).
  • os validate acceptance, run by hand with the built CLI against two throwaway defineStack fixtures (removed after): renamedFrom: ['company'] exits 0; renamedFrom: ['status'] beside a live status field exits 1 with objects.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

Verification

All readings at head 4ad4222ab8 unless stated.

packages/spec full suite and typecheck (verify lock)
  • pnpm exec vitest run --maxWorkers=2 in packages/spec: exit 0, Test Files 909 passed (909), Tests 27388 passed | 1 todo (27389).
  • pnpm typecheck in packages/spec: exit 0.
  • An earlier full run at e3c18ce2a8 was red on exactly one test, metadata-form-zod-reconciliation.test.ts (the field form offered no control for renamedFrom); fixed by the omission-ledger row, then green.
Other packages the diff touches (verify lock)
  • metadata-core object-schema-fls-references.test.ts + objects/builtin-column-storage-attributes.test.ts: exit 0, 67 passed.
  • driver-sql builtin-column-collision.test.ts: exit 0, 11 passed.
  • metadata-protocol protocol.meta-types-degenerate-derivation.test.ts: exit 0, 18 passed (red at 82 before the count pin moved to 83).
  • cli test/data-model-rules.test.ts (unit project): exit 0, 56 passed. lint validate-expressions, validate-security-posture, validate-expressions.formula-one-hop, validate-predicate-path-refs: exit 0, 737 passed (both at 4ad4222ab8's parent commits; the commits after touch only test files of other packages).
  • typecheck for metadata-core, driver-sql, metadata-protocol: exit 0 each.
Derived gates (dispatch-gates --commands at 4ad4222, 106 families)
  • 105 exit 0, 1 exit 3 (NOT MEASURED): pnpm check:dual-build-cjs-loads refuses without a full pnpm build of every package; it runs in CI.
  • dispatch-gates --ran with 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.
  • Families CI runs on this PR (Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core and the rest) are not re-run here; their check-runs are the reading.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation protocol:data protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/driver-sql, @objectstack/metadata-core, @objectstack/spec, touching 8 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/authorable-surface/data.json, packages/spec/liveness/field.json, packages/spec/liveness/state-counts/field.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via account_name (literal, a string literal in FieldSchema))
  • content/docs/concepts/metadata-driven.mdx (via FieldSchema (symbol, a top-level const), ObjectSchemaBase (symbol, a top-level const object))
  • content/docs/data-modeling/external-datasources.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/data-modeling/field-types.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/data-modeling/fields.mdx (via renamedFrom (symbol, a field of const object FIELD_KEY_STORAGE_CLASS; a field of const object FIELD_REFERENCE_POSITIONS), account_name (literal, a string literal in FieldSchema), renamedFrom (literal, a string literal in a comment on a changed line; a string literal in refuseDishonestRenamedFrom))
  • content/docs/data-modeling/validation-rules.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/deployment/troubleshooting.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/deployment/validating-metadata.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/frontend/troubleshooting.mdx (via account_name (literal, a string literal in FieldSchema))
  • content/docs/getting-started/quick-reference.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/kernel/contracts/data-engine.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/backward-compatibility.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/kernel/lifecycle.mdx (via account_name (literal, a string literal in FieldSchema))
  • content/docs/protocol/objectql/types.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/objectui/concept.mdx (via FieldSchema (symbol, a top-level const))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-1.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/releases/v18/18-3.mdx (via FieldSchema (symbol, a top-level const))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/authorable-surface/data.json, packages/spec/liveness/field.json, packages/spec/liveness/state-counts/field.md) — pages documenting those are invisible to this run
  • the SDK route bridge reached 63 of 222 client-bound route-ledger rows — the other 159 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 159: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 104 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 172 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 26c965cb8f61ca59804d55e27e737bf7ff91b383 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from da1e1cc2bd079a3852ac8ef6f1025ac74a958e6b — the merge of head 4ad4222ab8dafc79f152c5c0f2294ee9798a3505 into base 26c965cb8f61ca59804d55e27e737bf7ff91b383, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 26c965cb8f61ca59804d55e27e737bf7ff91b383 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · hotlong · session_01Q4EjjRhUZjdy8VXs6Kkur2

Contract-review-claim: session_01Q4EjjRhUZjdy8VXs6Kkur2 · head 4ad4222 · 2026-11-06T12:35Z

Face: declared Clause-②: yes (widening), a new authorable key renamedFrom on FieldSchema (packages/spec, Metadata-protocol: added) → CONTRACT_REVIEW_TIER, run by an isolated reviewer the seat starts now. ⛔ Not queued before a PASS on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · hotlong · session_01Q4EjjRhUZjdy8VXs6Kkur2

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4ad4222ab8dafc79f152c5c0f2294ee9798a3505
Local-runs: none
Scope: packages/spec/src/data/field.zod.ts, packages/spec/src/data/object.zod.ts + packages/spec/liveness/field.json, packages/spec/authorable-surface/data.json, content/docs/references/data/field.mdx, content/docs/references/data/object.mdx, content/docs/references/system/migration.mdx, content/docs/data-modeling/fields.mdx, packages/drivers/driver-sql/src/builtin-column-collision.ts, packages/metadata-core/src/object-schema-fls-references.ts, packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts, packages/spec/src/system/metadata-form-zod-reconciliation.test.ts, .changeset/30880-field-renamed-from.md; read to judge them: packages/objectql/src/registry.ts (the extension merge, mergeObjectDefinitions, and validate), packages/drivers/driver-sql/src/schema-drift.ts (BUILTIN_COLUMNS), packages/spec/src/data/field-customization.ts (BASE_FIELD_DISPLAY_WHITELIST), packages/metadata-protocol/src/protocol-save.ts (the field item door), packages/spec/liveness/README.md (the planned / authorWarn rules)

Rendered 2026-11-06T12:45Z on the net diff of the head against its merge base with main (d55acb78; main has not moved on any touched path since), the card and its comments, the cloud#3652 rulings Q3 「默认拒绝,需显式映射(推荐)」 and D3 「写进清单 renamedFrom」, record 6259332195 item 5, the bodies of #30884 and #30885, and the head's check-runs read once. The dev's report and the seat's conclusions were not used as evidence.

① Derived judgments

  • The accept-set widening is exactly the declared one — right. FieldSchema (a strictObject) gains one optional z.array(z.string().regex(...)) with no default; no other key moves. ObjectSchema's new refinement only refuses inside the new key's domain. The driver-sql and metadata-core hunks are classification rows in two maps pinned exhaustive over FieldSchema.shape; neither changes an accept/refuse door. The /meta/types field property count 82 → 83 matches one new key.
  • The five rules — right and complete against the card's list. Grammar: ^[a-z_][a-z0-9_]*$, the FieldSchema.name / FieldNameKeySchema regex, judged in FieldSchema at renamedFrom.INDEX. Own key: entry === fieldName, the map key (right, since FieldSchema.name is optional). Repeat: a per-list seen set, reported on the later index. Live key: hasOwnProperty(fieldMap, entry). Claimed twice: a per-object claimedBy map, reported on the later claimant naming the first. The map half skips entries that fail the grammar, so a non-key entry gets one issue, not two. Each check returns after its issue, so one entry yields one issue. Order is sound: seen.add precedes the live-key check, so ['status','status'] beside a live status reports a live-key issue at 0 and a repeat at 1.
  • An object without the key parses byte-identically — right. .optional() with no .default(), nothing materializes; the pin asserts hasOwnProperty === false on every parsed field.
  • The refusals name the object, the field and the old key — right for the four map-half rules (Field \x` on object `y` declares `renamedFrom` entry 'z', REASON PRESCRIPTION). The grammar refusal names the entry only; the PR discloses it and the issue path locates the field, and FieldSchemacannot see the object. An object with noname` is rendered as the word unnamed. Accepted deviation from the card's letter on rule 1; no fix owed.
  • ObjectExtensionSchema.fields runs only the field half — right as described, and the gap is real but not exploitable on this head. Measured: ObjectExtensionSchema parses z.record(FieldNameKeySchema, FieldSchema) and its own superRefine does not call refuseDishonestRenamedFrom; the objectql registry's validate('object') runs ObjectSchema.parse on the owner's declaration, and mergeObjectDefinitions folds extension fields into the merged definition without re-parsing the merged object through ObjectSchema. So an extension field carrying renamedFrom: ['a'] where the owner still declares a, or where the owner's new version just dropped a, parses clean. Nothing reads the key on this head, so no data moves; but the second shape is a cross-package column capture once A field's declared renamedFrom carries 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 reads the merged map (see ④). fieldPatches cannot carry the key: BASE_FIELD_DISPLAY_WHITELIST.field is label, description, inlineHelpText, placeholder.
  • The strict-schema publish-time consequence — stated honestly, and acceptable. The PR body, the changeset and the card all say an artifact carrying the key is refused as unrecognized_keys by every runtime older than this release. It is opt-in per package, and a package that does not write it is unaffected. The refusal on an older runtime is zod's generic unknown-key sentence, which this side cannot improve. The .describe() itself does not say it; the changeset does, which is where an author reads release consequences. Acceptable.

② Semver level

  • @objectstack/spec minor — right: Metadata-protocol: added (a new authorable key) takes at least minor on the package the diff moves.
  • @objectstack/driver-sql and @objectstack/metadata-core patch — right: each gains one classification row in an exhaustive map and no protocol change; AGENTS.md's rule reads none takes patch.
  • Metadata-protocol: added — right; the claim's none was wrong and the body corrects it. One kind only, so no narrowed/semantic precedence question.
  • Clause-②: yes (widening) — right; no accepted manifest is refused.

③ Boundary flags

④ Design judgment

Judged 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 once

38 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

  1. should-fix (carried to A field's declared renamedFrom carries 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): the extension door runs the field half only and the merge does not re-parse, so the reader must refuse an entry live in the merged map and keep the carry inside the declaring package.
  2. should-fix (carried to A field's declared renamedFrom carries 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, or a sixth parse rule on a follow-up): an entry naming a platform-owned column (id, created_at, updated_at, the tenant column) parses clean.
  3. should-fix (docs, one sentence): tell the author to keep a renamedFrom entry while any installed version may still carry the old key.
  4. escalated to Package upgrade plan: one framework comparison of installed vs new version (fields, types, renames, seeds) as a dry run; declared renamedFrom is planned, an undeclared rename or type change is refused unless confirmed (epic cloud#3652 Q3) #30884: a declared rename must not stand in for a type-change confirmation when the type change is needs_confirm.
    No must-fix.

Implemented-by: claude/issue-30880-spec-field-renamedfrom
Reviewed-by: session_01Q4EjjRhUZjdy8VXs6Kkur2

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · hotlong · session_01Q4EjjRhUZjdy8VXs6Kkur2

席位核对 · ACCEPT · 2026-11-06T12:51Z

Head-sha: 4ad4222a
Implemented-by: os-dev (session session_01Q4EjjRhUZjdy8VXs6Kkur2, branch claude/issue-30880-spec-field-renamedfrom) · Reviewed-by: repo:cloud#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data protocol:system size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant