Repository navigation
docs(objectql,spec): the tenant column is stamped and never NULL on single-tenant stacks (C1) - #25135
Conversation
…ingle-tenant stacks Three comments still said organization_id stays NULL on single-tenant stacks. Since 7b-0 a table the driver creates carries the tenant column NOT NULL, and an insert is stamped (under `single` with the Default Organization). Reword them the way 7b-0 reworded applySystemFields' docblock and SystemFieldName.ORGANIZATION_ID. Comment text only. Claude-Session: https://claude.ai/code/session_01Xwr1aPkHuFRqE9RSahyogV Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xwr1aPkHuFRqE9RSahyogV Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 145 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 af63be7f6302cc9c0f36d034610874d7909835ba && git checkout af63be7f6302cc9c0f36d034610874d7909835ba
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1b3b65e643bf31d2cb4764dbfc18a04234194bbf ca06c671d4df5d31e6be64e44d4dc9dd8b19b314 && git checkout -B drift-repro 1b3b65e643bf31d2cb4764dbfc18a04234194bbf && git merge --no-ff ca06c671d4df5d31e6be64e44d4dc9dd8b19b314
node scripts/docs-audit/affected-docs.mjs --json 1b3b65e643bf31d2cb4764dbfc18a04234194bbf
|
Contract reviewServed-tier: Scope: the net diff against the merge base (4 files, +19/−6):
Read with them:
① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
席位核对 ·
|
| Item | Reading |
|---|---|
| Shape | Draft PR → main. The body opens with the C1/B6 line, then Fixes #25128. 4 files, +19/−6. Not governed: check-governed-merges matched 0 of 4 paths. |
| Scope | Three comments that still said the tenant column organization_id stays NULL on single-tenant stacks now say what main does since 7b-0: org-scoping stamps it on insert (under single with the Default Organization), and it is never NULL (ADR-0131 D1). The sites are objectql's registry.ts and registry-tenant-index-declaration.test.ts, and spec's systemFields docblock. |
| Seat's own read | The wording is the one 7b-0 already shipped at the sites it corrected. Each comment keeps the rest of what it said, including the multi-tenant index gate. No code, assertion, .describe() text or CHANGELOG line moves. |
| Review | TIER_DEFAULT. Record 6324719576 is PASS on this head. |
| Declaration | One changeset, @objectstack/spec patch (spec ships src/**/*.zod.ts; objectql's dist carries no comment text), with Clause-②: no (comment and docblock text only: …) and Metadata-protocol: none at line starts, as on the PR body. |
| Cross-lane | object.zod.ts declared to domain:spec on #6017 (6324737500); no objection at this read. The stale schema.mdx:723 sentence outside the fence is pointed to domain:devx on #6023 (6324756974), with no card filed. |
| Gates | Dev at ca06c671d: 94 derived, 94 run, all exit 0. objectql and spec typecheck exit 0. The tenant-index test passed 12/12. check:generated 14/14 up to date. Full turbo build 77/77. |
| CI | At this read on ca06c671d4: ci-failure GREEN, all 42 check-runs completed, none failed. Test Core (2/6) first died to runner loss: exit 143, "The runner has received a shutdown signal", every test before it green. Its one re-run (run 39659411362, attempt 2) passed. git merge-tree against today's origin/main (1b3b65e643) is clean. |
Disposition:
open_questions: one, answered A: the changeset names@objectstack/speconly.deviations: all accepted:- the changeset the Check Changeset gate requires;
- the spec bullet joined rather than replaced;
Fixeson the body's third line;- four pushes;
- the AGENTS.md commit trailers.
out_of_scope_findings: theschema.mdx:723sentence, pointed todomain:devx, not filed.
Landing: ordinary queue (pr_ready + automerge_enable through the relay). Fixes #25128 then closes the card; B6 lives on as #25132.
Generated by Claude Code
This PR carries item C1 only of #25128. Item B6 (narrowing the blanket pre-18 relax rigs) moved to #25132 under the claim's split; #25132 is not addressed here.
Fixes #25128
Clause-②: no (comment and docblock text only: no accept set, response, status, error, outcome or export moves)
Metadata-protocol: none
What changes
Since 7b-0 (#24940, merged as
5e9b100743), a table the driver creates carries its tenant column (organization_id) NOT NULL, and an insert is stamped (undersinglewith the Default Organization). Three comments still said the column stays NULL on single-tenant stacks. Each now uses the wording 7b-0 used for the two sites it corrected (applySystemFields' docblock inregistry.tsandSystemFieldName.ORGANIZATION_IDinsystem-names.ts): org-scoping stamps it on insert (undersinglewith the Default Organization), and it is never NULL (ADR-0131 D1). Each comment keeps the rest of what it said; in particular the INDEX is still gated on multi-tenant mode.packages/objectql/src/registry.tsorganization_idgate inapplySystemFields("it just stays NULL when no tenant context exists")packages/objectql/src/registry-tenant-index-declaration.test.tsexpect(def.fields.organization_id).toBeDefined()("it just stays NULL")packages/spec/src/data/object.zod.tsorganization_idbullet of thesystemFieldsdocblock ("It stays NULL on single-tenant stacks"). The multi-tenant attribution to@objectstack/organizations(theorg-scopingservice) is kept.changeset/25128-tenant-column-never-null-comments.mdpatchfor@objectstack/specNo code, assertion,
.describe()text or CHANGELOG changes.Cross-lane:
packages/spec/src/data/object.zod.tsis adomain:specfile. The seat declares it to the spec seat.What
maindoes (read before editing)createColumntakes atenantColumnargument, andif (declaresColumnNotNull(field) || tenantColumn)makes the column not-nullable on both exits. Only the CREATE TABLE sites pass it (initObjects' create branch,ensureShardTable). The driver-turso remote face'sbuildCreateTableSQLdoes the same. Pinned bysql-driver-tenant-column-not-null.test.tsandturso-remote-tenant-column-not-null.test.ts.single:ObjectQL.resolveSystemInsertOrganization(packages/objectql/src/engine.ts) runs after the beforeInsert hooks. For a system insert that carries no organization, it callsresolveSystemWriteOrganization(packages/core/src/security/system-write-organization.ts), which answersderivedwhen exactly one organization exists undersingle(the Default Organization). The engine threads that id asDriverOptions.tenantId, and the driver stamps the column with it. The comment's own block says "stamped with the derived organization or refused below — never left NULL". A session write carries its organization on the context.systemFieldsdocblock.build-docs.tsrenders fromjson-schema/(built from.describe()) plus each module's file-level header (renderFileDescription), never a property docblock. A repo-widegit grepof the docblock's text hits onlyobject.zod.ts. Afterpnpm --filter @objectstack/spec build,git statusis clean andcheck:generatedreports all 14 artifacts up to date. The text does ship, through the builtdist/andsrc/**/*.zod.tsin spec'sfiles[], so@objectstack/spectakes apatchchangeset. objectql'sfiles[]isdistonly: after a build,dist/holdsapplySystemFields(positive control) and none of the comment text.git grep -ifor "stays NULL", "NULL on single-tenant", "stays null", "remains NULL" and "left NULL", plus a single-tenant/NULL regexp, overpackages/objectqlandpackages/spec): only these three tenant-column sites. The other hits are unrelated (owner_id"when left NULL", nullable booleans, aggregates,notNull). Outside the fence, one hand-written page has the same stale sentence. It is named under Acceptance notes and not edited.Verification
All on head
ca06c671d, which includes the merge oforigin/main1b3b65e64, unless marked otherwise.pnpm exec turbo run build --concurrency=2(under the verify lock): 77/77 tasks, VERDICT command-exit 0.pnpm --filter @objectstack/objectql typecheck: exit 0 (tsc and check:test-typecheck OK).pnpm --filter @objectstack/spec typecheck: exit 0 (tsc, scripts-typecheck and check:test-typecheck OK).pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/registry-tenant-index-declaration.test.ts: 1 file, 12/12 tests passed.pnpm --filter @objectstack/spec check:generated: exit 0, all 14 generated artifacts up to date, and the build left no tracked change.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, with no paths: 94 commands derived and 94 run, every exit code captured before any pipe. All 94 exited 0.--ranreconciliation: "94 derived famil(ies) accounted for — 94 run, 0 NOT-MEASURED (a DERIVED zero — all 94 recorded an exit code and none of them is 3)", exit 0.3c3a5759b, the same derivation ran 94 commands (86, plus 8 once the changeset existed). All exited 0 exceptpnpm check:dual-build-cjs-loads, which exited 3 (PREREQUISITE NOT MET: nodist/). After the full build it ran again and exited 0.test:repo.Acceptance notes
content/docs/protocol/objectql/schema.mdx(section "Multi-Tenant Schemas") still says the injectedorganization_id"stays NULL where no organization context exists". It is a hand-written docs page outside this card's file surface, so it is named here and not edited. Carrier: none.Generated by Claude Code