Repository navigation
feat(spec): a roster object declares its membership keys, ObjectSchema.membershipKeys - #25513
Conversation
…a.membershipKeys ADR-0105 D11's metadata twin, spec half: MembershipKeySchema (userField, valueField, filter, label, description; closed), the key map refusing a non-snake_case name and the kernel context names, valueField equal to userField refused, defineStack / composeStacks refusing one key on two objects, the object-extension guidance, a planned liveness row, and the rls.zod.ts examples that said the runtime stages keys nothing stages. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M4rJHRAZDFqLYQ9dHMH339
…ide the RLS policy The membership-key shape moves into security/rls.zod.ts beside DefaultRowScopeSchema (the precedent's home), exports MembershipKeyName, and the generated references, surfaces, dropped-refinement ledger rows and strictness counts follow. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M4rJHRAZDFqLYQ9dHMH339
…es the new collection key Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M4rJHRAZDFqLYQ9dHMH339
📓 Docs Drift CheckThis PR changes 2 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 144 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 175c276fff034f876d009946068cba6118aedad9 && git checkout 175c276fff034f876d009946068cba6118aedad9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a285ff29a18ac6ae2a9a72943f58733ce31f299a b2b98c417d23dadbccd99f7eff966c38cd3c0cc3 && git checkout -B drift-repro a285ff29a18ac6ae2a9a72943f58733ce31f299a && git merge --no-ff b2b98c417d23dadbccd99f7eff966c38cd3c0cc3
node scripts/docs-audit/affected-docs.mjs --json a285ff29a18ac6ae2a9a72943f58733ce31f299a
|
Contract reviewServed-tier: Inputs read at 2026-10-23T17:18Z: card #25234 (body and all 8 comments; the design comment 6344270438 and the ruling 6355640929, letter A, 2026-10-23T02:04Z, are the binding text), PR #25513 (body, 26-file list, net diff ① Derived judgmentsAccept-set changes the diff implies, each against the ruled closed shape (userField, valueField, optional filter in the lowerable CEL subset with no
Riders checked in text: rider 1 (Layer 0 system read, independent of audience/posture) and rider 2 (keys audience-neutral) are stated in the The objectql registry ② Semver levelChangeset
Clause-②: ③ Boundary flagsDev's declared deviations (
Dev's Which of the 13 ruled refusals land here vs PR ③: the PR body's table is right. Here: 1, 2 (shape + name rule), 3 (stack doors; the registry half is PR ③), the U = F half of 6, 8, 9, 10 at the spec door. PR ③: 4, 5, the type half of 6, 7, 11, 12, 13. PR ②: the bound's enforcement, the Layer 0 read, explain
Tier H row for Compile-time reach: CI on the head at 2026-10-23T17:18Z: 24 check-runs Implemented-by: VERDICT: PASS Generated by Claude Code |
席位核对 · ACCEPT ·
|
…commit e649c2d91e (objectui#13440) (objectstack-ai#13445) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuQx8xAyxeMnyWkn84sEzqVb)_ Closes objectstack-ai#13440 Clause-②: no Metadata-protocol: none Unblocks #13285 and #13305 (both wait for a pin that carries 18.1.0). ## The pin - `.objectstack-sha` moves from `915e94049922` to `e649c2d91e270e3da26820bcfe54a28445305a75`, the objectstack 18.1.0 release commit ("chore: version packages", objectstack-ai/objectstack#25606). It carries objectstack-ai/objectstack#25483 and objectstack-ai/objectstack#25564, which objectstack-ai/objectstack#25251 required to ship in one release, so the same-release hold is met. - **Ancestry, read in the objectstack checkout:** `git merge-base --is-ancestor e649c2d91e origin/main` exits 0, and the bump script reported "(on origin/main)". The `@objectstack/cli@18.1.0` tag peels to `e649c2d91e`. - **The path:** `scripts/bump-objectstack.sh e649c2d91e270e3da26820bcfe54a28445305a75 --no-commit` (so the commit carries the repo's trailer pair), which fetched the sha and built and packed the 7 packages, then `pnpm install`. - **What moved:** `.objectstack-sha` and the seven packed manifests in `.objectstack-pin/`. The manifests change only version strings, `18.0.0` to `18.1.0` (the package's own version and its `@objectstack/*` dependencies). - **`pnpm-lock.yaml` is unchanged.** `pnpm install` left it byte-identical, and `pnpm install --frozen-lockfile` exits 0. So the Dependabot lockfile PRs (objectstack-ai#13438, objectstack-ai#13439) do not overlap this one. - `pnpm objectstack:status` answers `✓ built at the pin e649c2d91e27`. ## What the move breaks, and the follow-through in this PR Each item below is red on the bare pin move and was fixed here because the failing check names its own fix. Nothing else changed. ### 1. The `external` tripwire in `@object-ui/auth` (objectui#13427) `packages/auth/src/__tests__/org-roles.test.ts` › "spells external itself only while the pin predates objectstack#25515" went red as designed. Its message prescribes the swap, and this PR does exactly that: - `packages/auth/src/org-roles.ts` re-exports the spec's `MEMBERSHIP_ROLE_EXTERNAL` as `ORG_ROLE_EXTERNAL` instead of spelling the literal. **The exported name and its value (`'external'`) are unchanged**, and its declared type is still the literal `"external"`, so `@object-ui/auth`'s public face does not move (Clause-② stays `no`). `ORG_ROLE_LABELS` is typed `Record<OrgRole, …>` again, with the `| typeof ORG_ROLE_EXTERNAL` union dropped. - The tripwire test is deleted, with its now unused `@objectstack/spec` namespace import. - `InviteMemberDialog.roleCap.test.tsx` and `org-i18n-holdouts-4474.test.tsx` now expect `external` in the invite dialog's role list. This is the spec's 18.1.0 vocabulary reaching `ORG_ROLES`, which objectui#13427's changeset already described: "Wherever the installed spec lists the role, the invite dialog offers it to every issuer who can invite". It is not a choice made by this card. The owner list gains `external`, and a delegated admin or an unloaded membership is offered `['member', 'external']`. The delegate test's name now says "offered member and external only". ### 2. `check:installed-pin-claims`: 34 present-tense "installed 18.0.0" stamps The gate is blocking through `scripts/__tests__/check-installed-spec-pin-claims.test.ts`. The packed manifests now say 18.1.0, so it flagged 34 lines in 24 files, all comments or test description strings. No code changes. **Every stamp was re-measured before it moved.** The method: - The spec SOURCE diff between the two pins, `git diff --name-only 915e9404 e649c2d91e -- packages/spec/src`, touches only `automation/flow.zod.ts` (the `runAs` description text and a comment), `data/object.zod.ts` (the new `membershipKeys` key and its extension refusal), `identity/*` (the `external` role), `kernel/execution-context.zod.ts` and `security/explain.zod.ts` (descriptions and comments), `security/rls.zod.ts` (`MembershipKeysSchema`), `stack.zod.ts` (the duplicate membership-key refusal), `index.ts` (two new exports) and one semantic migration entry, plus tests. - No claim's subject is in that set. The subjects are `ui/*` rows (`ViewDataSchema`, `ComponentPropsMap['object-calendar']` and `['object-kanban']`, list-view conditional formatting and card style rules, the chart and dashboard `aria` tombstones, record components, form section groups, master-detail details, the gantt `navigation` tombstone), `FieldSchema` and `SelectOptionSchema`, and flow node config (`waitForInput`, the single-brace mark, the canvas-seed save errors). The two claims about non-spec sources were checked at their own source: `packages/lint/src/validate-expressions.ts` (the `current_user` CEL message `celAuthoring.ts` quotes) has an empty diff between the pins, and the trigger packages changed only `CHANGELOG.md` and `package.json`. - The test files that carry a claim, or pin a source file's claim, ran green at the new pin (see the verification comment). Each stamp moves `18.0.0` to `18.1.0`. A stamp that carries its re-measure list (`objectui#12030, … objectui#13261`) gains `objectui#13440`, the same form objectui#13261 used. After the restamp the gate answers `34 at the pin` and `OK`. ### 3. `e2e/live/ci/backend.env` `scripts/__tests__/ci-cd-pipeline-doc.test.ts` › "pins OBJECTSTACK_VERSION to the version the lockfile resolves" went red. `OBJECTSTACK_VERSION` moves `18.0.0` to `18.1.0`. Its `@objectstack/cli@18.1.0` tag peels to this pin's commit, so the live lane's backend and the console's pin are the same release. ### 4. The `ObjectSchema` key-count guards in `app-shell` `MetadataService.retiredObjectEnabled.test.ts` (line 157) and `MetadataService.specKeyObjectPayload.test.ts` (line 171) count the keys `ObjectSchema` accepts, and both went red with `expected 47 to be 46`. Spec 18.1.0 adds one key, `membershipKeys` (objectstack-ai/objectstack#25513). **Measured, not assumed:** the spec's own `authorable-surface/data.json` gains exactly `data/Object:membershipKeys` between `915e9404` and `e649c2d91e`, and loses nothing. Both guards now expect 47, and each carries a comment with that basis, in the same form as the earlier re-point (objectui#12971). The two files pass, 25 tests. ## Changeset `.changeset/13440-objectstack-pin-e649c2d.md` declares `'@object-ui/auth': patch`. The published module now imports `MEMBERSHIP_ROLE_EXTERNAL` from `@objectstack/spec`, so it needs a spec that exports it (18.1.0 or later). `node scripts/objectstack-floor.mjs --dry-run` exits 0 and moves 37 ranges to `^18.1.0` at publish, so the published ranges will require that version. `check-changeset-presence.mjs` and `check-changeset-no-major.mjs` pass. ## Acceptance notes - The restamped comments in published packages (`types`, `core`, `plugin-calendar`, `plugin-designer`, `plugin-detail`, `plugin-kanban`, `app-shell`) change no behaviour, so the changeset names `@object-ui/auth` only. - After merge the seat reads #13285 and #13305 against the new pin, as the card says. - [x] Adds no product-specific widget, dialog, hook or string (see AGENTS.md › Product-neutral renderer) Session: `https://claude.ai/code/session_01CErMSwkRLW7c7jk23MHfVP` 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CErMSwkRLW7c7jk23MHfVP --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Tesla · project thread
Part of #25234
Clause-②: yes (widening)
Metadata-protocol: added
PR 1 of 3 of ruling A on #25234 (ruling comment 6355640929, on design comment 6344270438): the spec half.
ObjectSchemagains one optional key,membershipKeys, on the ROSTER object: each entry makescurrent_user.KEYthe distinct values ofvalueFieldon this object's rows whoseuserFieldis the signed-in user and on which the optionalfilterholds. Nothing reads the key yet. Its reader is PR 2 (plugin-security'sstageRlsMembership, beside the registered code resolver), and the authoring rules are PR 3. This PR leaves the card open; theskills/objectstack-data/rules/security.mdrow (Tier H) lands separately, by the seat.No object that exists today changes behaviour: at the base
ab510f42e7the wordmembershipKeysoccurs nowhere in this tree (git grepexit 1, against adefaultRowScopecontrol that hits underpackages/plugins).The shape
security/rls.zod.ts, not a new module. The design sketched a newmembership-key.zod.ts; the order says a new module only if the precedent made one, and feat(spec): an object declares its default row scope, defaultRowScope, the RLS policy shape without object #24398 putDefaultRowScopeSchemainrls.zod.ts. Measured on the first push: a new module undersecurity/is picked up bygen:skill-refs, which rewritesskills/objectstack-data/references/_index.mdandskills/objectstack-ui/references/_index.md, and this PR's claim excludesskills/**. Inrls.zod.tsthe generated skill references do not move.superRefine, not as the record's key schema. A refused record key reaches the author only as zod's genericInvalid key in record(measured), which hides which rule the name broke. The record-level check raises onecustomissue atmembershipKeys.KEYnaming the rule: snake_case, or the reserved list, read fromRESERVED_RLS_MEMBERSHIP_KEYSincontracts/rls-membership-resolver.tsand never copied.labelanddescriptionarez.string(), as on the RLS policy and on the object itself. The design's sketch namedI18nLabelSchema, aui/render-time union nothing in the security tree imports. Its consumer is PR 2's explaindetail, which takes plain text.user,value,field,where,condition) plususerColumn,ownerField,valueColumnandusing.objectgets the "implied, declare it on the roster object" prescription;limit/maxValuesget "no authorable size: 1,000 per request, a platform constant".ObjectExtensionSchemagains amembershipKeysguidance line, so the refusal names the owning-package rule.The 13 ruled refusals: which the shape carries, which PR 3 carries
RESERVED_RLS_MEMBERSHIP_KEYSdefineStackandcomposeStackscross-reference, below. The runtime gate against the registry (other installed packages) is PR 3keys): PR 3superRefineatvalueField; the field-type half is PR 3filterthat does not lower, names a missing column, or readscurrent_user.*rls-predicate-*judge with X as target: PR 3ObjectExtensionSchemarefuses the key, now with a prescription. See the acceptance note on the registry'sextenddoorrls-predicate-*extension: PR 3What else moves, each by its own tool
defineStack/composeStacks, refusal 3.duplicateMembershipKeyFindings(instack.zod.ts) counts each key by distinct declaring-object name. The one-stack door runs beside the duplicate default-record-page check, before the object-count early return. The composition door runs in the artifact cross-reference pass over the composed objects, after the conflict strategy, so an object'override'replaced no longer counts and one'merge'combined counts once. It runs under every manifest strategy, because the key namespace is the deployment's. Both doors raise theSTACK_CROSS_REFERENCE_INVALID/ 422 envelope.composeStackswithobjectConflict: 'merge':membershipKeysis record-typed, so the composer's derived collection set picks it up with nostack.zod.tsedit. Two stacks declaring a differentmembershipKeyson one object are refused likelistViews. The literal lists incompose-stacks-merge-collection-refusal.test.tsandcompose-stacks-collection-pipe-arm.test.tsgained the key in shape order, plus one fixture row.rls.zod.tsexample fix (the design's carrier note). Use cases 4 and 5, the two@examplecomments and theusingTSDoc said the runtime stagesterritory_account_ids/ pre-resolvesteam_member_ids. Nothing in this tree stages either. They now say these are app-supplied keys. A new "Where a membership key comes from" section names the two sources: a registered resolver, and the declared key, marked not applied yet. A sixth use case shows the portal key. No published describe string changed meaning.packages/spec/liveness/object.json):membershipKeysisplannedwithauthorWarnand anauthorHint. It is drilled into 5plannedchildren, becausecheck:livenessrefuses an undeclared container inheritance (measured: it nameduserField, valueField, filter, label, description). Only the container warns. Probed withlintLivenessPropertiesFromLedgerDirfrompackages/lint: oneliveness-planned-propertyfinding on an object declaring the key, zero on the control. The note gives the flip condition:liveon the commit that lands PR 2, citingstageRlsMembership, withauthorWarn/authorHintdropped in the same edit.omitrow inmetadata-form-zod-reconciliation.test.tsrecords why: no server stages the key yet, and the ruling makes the form row an objectui card.@objectstack/metadata-core):OBJECT_REFERENCE_POSITIONSclassifiesmembershipKeysasrecordOf(ruleEntry). A key whoseuserField,valueFieldorfilternames a field the caller cannot read is dropped whole, the map goes when nothing is left, and the key NAME is never read as a field. The classification pin inobject-schema-fls-references.test.tsotherwise reds, as it did on feat(spec): an object declares its default row scope, defaultRowScope, the RLS policy shape without object #24398./meta/typescount (@objectstack/metadata-protocoltest only):objectmoves 46 to 47, with its history sentence.pnpm --filter @objectstack/spec check:generated --fixafter a build: the reference pages undercontent/docs/references/**,authorable-surface/{data,security}.json,json-schema.manifest/security.json,api-surface/security.json,export-origins/security.json,declaration-map/security.json,liveness/state-counts/object.md, and the strictness-ledger counts (one more strict site inrls.zod.ts).dropped-refinements.baseline.json(hand-edited by design): three new entries,security/MembershipKeyName,security/MembershipKeyandsecurity/MembershipKeys. The two new sitesmembershipKeysandmembershipKeys.valueTypeare added to the nine entries that embedObjectSchema, as the build printed them.measuredmoves 242/813 to 245/835. Neither rule has a projectable arm:bannedKeyswould publish the reserved list, but only as a refinement on the record root, which loses the per-key message above.MembershipKey/MembershipKeyParsed,MembershipKeys/MembershipKeysParsed,MembershipKeyName/MembershipKeyNameParsed(check:spec-parsed-aliasgreen)..changeset/25234-object-membership-keys.md:minoron@objectstack/spec,patchon@objectstack/metadata-core, with theClause-②andMetadata-protocollines.Tests
packages/spec/src/data/object-membership-keys.test.ts, 25 tests:srm_supplier_contactwithportal_supplier_ids) parses unchanged, throughObjectSchemaand through theobjectmetadata write door; the minimal two-member declaration parses; control: an object without the key parses and its output has no key.codeandpath: every name inRESERVED_RLS_MEMBERSHIP_KEYS(6, read from the contract), three non-snake_case names,valueFieldequal touserField(atvalueField),objectandlimit/maxValues(unrecognized_keyswith their prescriptions), an unknown member, a missinguserField/valueField, and the key on anObjectExtensionSchema.defineStack: one key on two objects is refused (envelopeSTACK_CROSS_REFERENCE_INVALID/ 422, one issue naming both objects and theirstack.objects[i]positions); control: two different keys are accepted.composeStacks: one key on two objects across two stacks is refused (envelope, naming both objects and the stacks that define them), also undermanifest: 'preserve'. Controls: two different keys compose, and one object declared identically by both stacks under'merge'counts once. A different declaration of one key on one object under'merge'is the collection refusal, not this one.Also
object-schema-fls-references.test.tsgained a three-leg pin: dropped onvalueField, dropped onfilter, kept otherwise; the map removed when every key goes; a key named like a denied field, and a denied field named like a member (filter), cost nothing.Ablation, one, on the behaviour this diff adds: the one-stack door's
errors.push(...collectDuplicateMembershipKeyErrors(config))replaced by a comment, throughnode scripts/ablation-replace.mjs(anchor 1 to 0, blob208905c1ae7cto98fa82b5718f). Expected direction red, observed red: 1 failed (thedefineStackrefusal), 24 passed. The composition door is a separate call and its tests stayed green, as they should. Restored: blob equals the HEAD blob208905c1ae7c, andgit diff HEADis empty. No build is involved, because the test importssrcthrough a relative path.Reverse verification of the rebuilt
.d.tsdownstream: a temporary file inpackages/platform-objects/srccallingObjectSchema.create({ …, membershipKeys: { portal_supplier_ids: { userField, valueField, filter } } })typechecks (exit 0). A stale declaration file would refuse the key throughNoExcessObjectKeys. The same call withvalueField: 5fails with TS2322 at the probe (exit 2). A third leg found that an unknown member inside an entry (limit: 5) typechecks (exit 0): the compile-time excess-key guard does not reach into record values, so the runtime parse is the refusal there, as pinned above. The probe was removed andgit statusis clean.On the final head
b2b98c41, throughos-verify-lock.sh:pnpm --filter @objectstack/spec test: 713 files passed, 21684 tests passed, 1 todo.pnpm --filter @objectstack/spec typecheck: exit 0.pnpm --filter @objectstack/metadata-core exec vitest run: 19 files, 796 tests passed.pnpm --filter @objectstack/metadata-core typecheck: exit 0.protocol.meta-types-degenerate-derivation.test.ts: 18 passed.ObjectSchema.shapeor the liveness ledger: 4@objectstack/lintfiles (694 tests) and 4@objectstack/objectqlfiles (160 tests) passed, on a closure rebuilt from this head (pnpm --filter 'PKG...' build).Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack(no paths) on the final headb2b98c41derives 116 families. All 116 were run on that head, one at a time, exit codes captured before any pipe: 116 exit 0.--ranreconciliation: 116 derived, 116 run, 0 NOT MEASURED, 0 unrun. The changeset gates are among them (check-changeset-no-major,check-adr-0087-registrationand their self-tests, againstorigin/main).b595703efound one real finding, fixed inb2b98c41:check:spec-parsed-alias(ADR-0122) asked forMembershipKeyParsedasz.inferandParsedtwins for the map and the name. Its other non-zero codes were exit 3 (PREREQUISITE NOT MET: a staledistafter a test edit, and thelintdist not yet built), which the final run on a rebuilt closure answers 0.check-plugin-teardown-shape --self-testneeds the pinned fixture commit621a4876in this shallow clone; fetched with--depth=1, then exit 0.pnpm check:dev-prereqs(local-only family, this diff touches the spec build): exit 0.Acceptance notes
extenddoor, for PR 2 or 3.ObjectExtensionSchemarefusesmembershipKeys, butSchemaRegistry.registerObjectin@objectstack/objectqlaccepts a full object body underownership: 'extend'. FordefaultRowScopeit refuses that by name (EXTENSION_DEFAULT_ROW_SCOPE_REFUSED_CODE,registry.ts). It has no such refusal formembershipKeys(read atregistry.ts, theownership === 'extend'check beside the field-type door). Whether the extension merge then carries the key onto the owner's object is NOT MEASURED here. Today it has no effect either way, because nothing reads the key. The ruling places cross-package reach in the shape (refusal 10), and this door is outside this PR's file surface. Carrier: Spec design: declarative membership keys for RLS (current_user.<key> from a lookup on records whose user field is the current user) #25234 PR 2, before the reader stages a key.NoExcessObjectKeysdoes not judge members inside amembershipKeysentry (leg 3 above). The runtime parse refuses them with a prescription at every door. This is a property of the record-valued slot, not of this key.rls.zod.ts's strict-site count moves 4 to 5 in the strictness ledger (the newstrictObjectentry); the map itself is az.record, not a site.Generated by Claude Code