Repository navigation
fix(plugin-sharing): stamp an assignment rule created from Setup with the caller's organization - #39454
fix(plugin-sharing): stamp an assignment rule created from Setup with the caller's organization#39454objectstack-fleet[bot] wants to merge 7 commits into
Conversation
…ization sys_assignment_rule declared its own required organization_id, so the record validator refused a create that named no organization before the platform's tenant stamp could run: every rule created from Setup answered 400 "Organization is required". The object now rides the platform's tenant column, the one sys_queue carries, which the driver stamps from the write's organization. Non-null still holds: the column is created NOT NULL and the save guard refuses a row that lands in no organization. Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
…ations Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
…ization column The sys_assignment_rule block no longer carries organization_id: the object stopped declaring the column, so check-i18n-bundles --write drops its label and help text. Generator output only. Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
… sys_queue does The object no longer declares organization_id, so its own index entry on that column named a column only the platform provides (check:keyed-text-bounds cannot classify it). The registry provisions the tenant index with the column on a walled deployment; the test pins that it is there exactly once. Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
…keeps its organization on update Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
… its organization Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 8 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 — 12 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 e593b53cdcd13565bcf06ad3f7f8e676ce9fc056 && git checkout e593b53cdcd13565bcf06ad3f7f8e676ce9fc056
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c 78c464c3f0a8ab4e7ee07d8d307ec83e6229686d && git checkout -B drift-repro c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c && git merge --no-ff 78c464c3f0a8ab4e7ee07d8d307ec83e6229686d
node scripts/docs-audit/affected-docs.mjs --json c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c
|
Requested by Elon · project thread
Fixes #39415
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
sys_assignment_rulestopped declaring its ownorganization_id(arequired: truelookup). Its organization is now the platform's tenant column, the same onesys_queuecarries and is stamped through. No second mechanism:applySystemFieldsinpackages/objectql/src/registry.ts, called frompackages/objectql/src/registry-object-registration.ts, usingTENANT_SCOPE_FIELD_DEF(packages/spec/src/data/injected-system-column-provenance.ts);SqlDriver#injectTenantOnInsert(driver-sql). A system write's organization is resolved first bypackages/objectql/src/tenancy/system-write-organization.ts.With its own declaration,
required: truelet the record validator refuse the write before the stamp could run. The Setup form has no organization input, so every create answered400 VALIDATION_FAILEDonorganization_id.The non-null rule still holds where it is enforced. The tenant column is created NOT NULL (ADR-0131 D1). The save guard (
assignment-rule-hooks.ts) still refuses a row that lands in no organization, namingorganization_id. The object's comment "a stored rule always belongs to one organization. A rule that reaches every organization is a DECLARED rule, never a row here" stays, unchanged in meaning. The object's own{ fields: ['organization_id'] }index entry is gone too: the platform provisions the tenant index with the column on a walled deployment, as onsys_queue.The 11
translations/*.objects.generated.tsbundles were regenerated (check-i18n-bundles.mjs --write). They drop the column's own label and help, assys_queue's bundles carry none.Tests
packages/plugins/plugin-sharing/src/objects/sys-assignment-rule.organization-stamp-39415.test.ts: the shippedsys_assignment_rule,sys_queueandsys_queue_memberrun through a realObjectQLoverSqlDriveron better-sqlite3:memory:with the save guard bound. There are 7 cases:organization_idis stored in that admin's organization;sys_queue's field for field, and has exactly one tenant index;VALIDATION_FAILED,organization_id/required) and stores nothing;Red first: the object file restored from the merge base, the rest at head
Green at head
Acceptance notes
composeWriteTenantWall) refuses a supplied foreignorganization_idon insert. The wall reads the column by name and the posture, never the field's declaration, so its verdict is the same before and after. Not pinned here: plugin-security is not a dependency of this package.organization_id: Bmoved the rule to B at engine level. At head the value is dropped with the engine's read-only warning and the rule stays in A, as onsys_queue. Under thegroupposture the wall admits a re-point to another of the caller's organizations (its documented rule, not measured here), so such a move used to be possible and now is not. Pinned by case 7.organization_idstays in the registered and served field list, under the same name, type and reference. Its attributes change from the object's own (required: true,group: 'System', its own description and translated label and help) to the platform tenant column's (required: false,hidden,readonly,system, the platform description). A data-API create gets wider: it no longer needs the key. A data-API update gets narrower: the key is dropped. What a metadata author can write is unchanged, because the object is a platform table.{ fields: ['organization_id'] }entry. Whetheros migrate planlists it as an index drop was not measured.Verification
Read first:
packages/plugins/plugin-sharing/src/objects/sys-assignment-rule.object.ts: the removed field and index entry, and the comment that now carries the non-null rule..changeset/39415-assignment-rule-organization-stamp.md.Two-minute check:
pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/objects/sys-assignment-rule.organization-stamp-39415.test.tsshould showTests 7 passed (7).🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9