fix(spec): declare ownership as a first-class ObjectSchema field (#3175)#3185
Merged
Merged
Conversation
…3175) The object-level record-ownership model — `ownership: 'user' | 'org' | 'none'`, which drives the registry's `owner_id` auto-provisioning (`applySystemFields`) — was read by the engine via `(schema as any).ownership` while `ObjectSchema.create()` REJECTED it as an unknown top-level key (ADR-0032 "no silent failure" / #1535). So a tested engine opt-out (`ownership: 'org' | 'none'` on catalog / junction tables) could not be authored through the sanctioned `create()` path, the scaffold still emitted a now-invalid `ownership: 'own'`, and the same word was read elsewhere as the unrelated package-contribution kind (`own` / `extend`). Resolves the collision by formalizing the property the engine already honors: - spec: `ObjectSchema` declares `ownership: z.enum(['user','org','none']).optional()`. The registry reads it off the typed schema (no `as any`). A retired `own`/`extend` value fails with guidance distinguishing it from the contribution kind (registerObject). - cli: the `object` scaffold no longer emits the invalid `ownership: 'own'` (owner injection is the default), and `objectstack info` labels the record model with the correct `user` default. - Regenerated the object reference doc; liveness ledger + changeset added. No runtime behavior change: `applySystemFields` and its `owner_id` injection logic are unchanged — this makes the already-honored property legally authorable and typed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014343Qv6DFAykuAJc9yjANb
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 112 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 18, 2026 06:53
os-zhuang
added a commit
that referenced
this pull request
Jul 18, 2026
… document the field (#3175) (#3193) Follow-up to #3185. The VS Code `os-object` snippet still scaffolded `ownership: 'own'` — the same now-invalid value removed from the CLI `generate` scaffold. Since #3185 made `ownership` a typed `'user' | 'org' | 'none'` enum, expanding the snippet produced an object that fails typecheck / `ObjectSchema.create()`. - vscode: remove the `ownership: 'own'` line from the object snippet (owner injection is the default; nothing to declare). - docs: document the now first-class `ownership` record-ownership knob in the object Additional Properties table. Claude-Session: https://claude.ai/code/session_014343Qv6DFAykuAJc9yjANb Co-authored-by: Claude <noreply@anthropic.com>
os-zhuang
added a commit
that referenced
this pull request
Jul 18, 2026
…3194) `ObjectSchema.systemFields` advertised an `owner?: boolean` opt-out that nothing read — `applySystemFields` only consumes `systemFields.tenant` and `systemFields.audit`, and `owner_id` provisioning is governed by the object-level `ownership` property (made first-class in #3185). The key was declared but wired to nothing. - spec: remove `owner` from the `systemFields` object so it only advertises the two opt-outs it honors (`tenant`, `audit`). Runtime-compatible (the key was ignored; it is stripped now — both no-ops). A TS author who set it gets an excess-property error; the fix is to delete it or use `ownership: 'org' | 'none'`. - docs: regenerated the object reference; corrected the stale objectql/security note that called `audit` "reserved" (it is active). Claude-Session: https://claude.ai/code/session_014343Qv6DFAykuAJc9yjANb Co-authored-by: Claude <noreply@anthropic.com>
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.
Context
Fixes #3175 — the
ownershipcollision surfaced during #3168 (#3058).The object-level record-ownership model —
ownership: 'user' | 'org' | 'none', which drives the registry'sowner_idauto-provisioning (applySystemFields) — sat in a contract hole:(schema as any).ownership(registry.ts:272), with a tested opt-out (registry.test.ts),ObjectSchema.create()threw onownershipas an unknown top-level key (ADR-0032 "no silent failure" / Object-levelworkflows: [...](and any unknown ObjectSchema key) is silently stripped at build — no error/warning (ADR-0032 'no silent failure', metadata layer) #1535), so the tested opt-out couldn't be authored through the sanctioned path,ownership: 'own'(generate.ts),own/extend(info.ts).Per the direction chosen on #3175, this formalizes the property the engine already honors (Option A) rather than renaming it or removing the author surface.
Changes
ObjectSchemadeclaresownership: z.enum(['user','org','none']).optional()with a describe + JSDoc that explicitly distinguishes it from theown/extendcontribution kind. The registry now readsschema.ownershipoff the typed schema (noas any). A retiredownership: 'own' | 'extend'value fails with guidance pointing at the record-ownership model and notingown/extendis set viaregisterObject, not on the object schema.objectscaffold no longer emits the invalidownership: 'own'(owner injection is the default; consistent with the app/plugin scaffold cleanup in CHANGELOG #3876);objectstack infolabels the record model with the correctuserdefault.content/docs/references/data/object.mdx(one new row); added theownershipliveness-ledger entry and a changeset.No runtime behavior change:
applySystemFieldsand itsowner_idinjection logic are untouched — this makes the already-honored property legally authorable and consistently typed.Verification
@objectstack/spec— full suite 6914 pass (+3 newownershipcreate() tests: opt-out values accepted, omitted → undefined, retiredownrejected with guidance);check:livenessgreen; reference doc regenerated deterministically.@objectstack/objectql—registry.test.ts63 pass (opt-out behavior equivalence);registry.tstypechecks with theas anyremoved (verified against the built spec dts).info/generatehave no type surface change (objisany; scaffold is a template string).🤖 Generated with Claude Code
https://claude.ai/code/session_014343Qv6DFAykuAJc9yjANb
Generated by Claude Code