Uh oh!
There was an error while loading. Please reload this page.
docs(metadata-protocol,objectql): stop teaching the retired environment_id column stamp/filter - #13665
Conversation
…ent_id` column stamp/filter
Seven JSDoc/comment passages across three files still documented
`saveMetaItem` stamping an `environment_id` column on new `sys_metadata`
rows and `loadMetaFromDb` filtering by it. ADR-0005 (revised 2026-05) /
ADR-0006 v4 retired that job when each environment got its own physical
database; `organization_id` is the isolation key that survived.
Measured on this tree: zero non-comment `environment_id` occurrences in
the three files, with `organization_id` answering 44 in `protocol.ts`
under the same filter as the positive control. `loadMetaFromDb`'s real
where-clause is `{ state: 'active', organization_id: null }`.
Prose only. The `environmentId` option is untouched: its non-comment
site counts are identical before and after (12 / 9 / 6).
Part of #13434
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 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 e4cca3b8d4d5bdb2a88915b76d7d3177dc0fbd33 && git checkout e4cca3b8d4d5bdb2a88915b76d7d3177dc0fbd33
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 575ce836d1c990cb82bb4ba8cb507997d4857a74 3899e15ceeb1c7562c4b237959d9ba6332b66ad0 && git checkout -B drift-repro 575ce836d1c990cb82bb4ba8cb507997d4857a74 && git merge --no-ff 3899e15ceeb1c7562c4b237959d9ba6332b66ad0
node scripts/docs-audit/affected-docs.mjs --json 575ce836d1c990cb82bb4ba8cb507997d4857a74
|
zhuangjianguo
commented
Aug 31, 2026
PM verdict: ACCEPT — fully green, releasingAll 32 checks on The central claim, verified independently rather than taken on trustThe PR asserts the diff is comment-only. I checked it hunk by hunk: every added and removed line across all three source files sits inside a JSDoc block ( ⭐ The dispatch order's sharpest warning was the one that paidZone 2 A2.1 predicted the card's coordinates would be stale and required re-location by needle, never by line number. Measured: the anchors had drifted by up to +150 lines between This lane hit line-number rot twice in one night — here, and on #13635's doc-census anchors. Worth carrying forward as a standing reading, not a one-off. Three things done beyond the brief
⭐ It argued against the easier path, on measurementA comments-only diff looks like a clean Scope held
Docs-drift row: checked, and it is a false positive for this defect class
Releasing: draft cleared, auto-merge enabled. ⛔ Not merged by this seat, and no approving review from it. Generated by Claude Code |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#13434
Prose only. No behaviour changes, no test moves, and the
environmentIdoption is untouched — its non-comment site counts are byte-for-byte identical before and after (protocol.ts12,metadata-protocol/src/plugin.ts9,objectql/src/plugin.ts6). Verified at121f2c332c.What was wrong
Seven passages across three files still documented
saveMetaItemstamping anenvironment_idcolumn on newsys_metadatarows andloadMetaFromDbfiltering by it. ADR-0005 (revised 2026-05) / ADR-0006 v4 retired that job when each environment got its own physical database;organization_idis the isolation key that survived.The danger was not staleness but subject. These sit on the plugin options interfaces — the first thing a reader configuring per-environment scoping meets — and they describe an isolation barrier. An author reading
protocol.ts's "every saveMetaItem insert/update and loadMetaFromDb query is filtered byenvironment_id = environmentId" would believe an environment-level boundary existed insidesys_metadata. It does not.They also ship: the two options docblocks are emitted verbatim into both packages' published
.d.tson the exportedObjectQLPluginOptionsandMetadataProtocolPluginOptions, so this is the editor tooltip a consumer actually reads. That measurement is also why this PR carries a changeset rather than theskip-changesetlabel — see "Changeset, not skip-changeset" below.The measurement
environment_idnon-comment occurrences, with the card's own filter, ateaba72e48c:environment_idorganization_idpackages/metadata-protocol/src/protocol.tspackages/metadata-protocol/src/plugin.tspackages/objectql/src/plugin.tsThe zero is a reading, not a broken grep: the control fires at 44 in the same file under the same filter. Stronger than the regex, the complete raw set is small enough to classify by hand — all 12 raw occurrences across the three files sit inside comments, none in code.
Corroborating, in-tree, unchanged by this PR:
loadMetaFromDb's actual where-clause is{ state: 'active', organization_id: null }— roughly 60 lines below the docstring that claimed anenvironment_idfilter, and its own in-body comment already stated the correct rule.packages/metadata-core/src/objects/sys-metadata.object.ts:138-148—@deprecated, "no longer written by saveMetaItem and not consulted by overlay reads".packages/metadata/src/loaders/database-loader.ts:82-89—@deprecated, "accepted for back-compat but ignored".packages/metadata/src/loaders/database-loader.test.tspins the new behaviour.The seven sites, re-located by needle
The card's coordinates were measured at
c813e7ac7and had drifted by up to +150 lines. Every site was re-found by its quoted prose, never by line number.eaba72e48cpackages/objectql/src/plugin.tspackages/objectql/src/plugin.tspackages/metadata-protocol/src/plugin.tspackages/metadata-protocol/src/protocol.tspackages/metadata-protocol/src/protocol.tspackages/metadata-protocol/src/protocol.tspackages/metadata-protocol/src/protocol.tsThree sites beyond the card's four, named explicitly
The card's list was line-anchored and undercounted. Re-running its own
git grepas a census turned up three more passages carrying the identical false claim, all in files this PR already touches:protocol.ts:4492— "environmentIdkeeps its row-scoping jobs — theenvironment_idstamp/filter and the ADR-0005 overlay-whitelist gate." The same sentence as site 3, in an inline comment.protocol.ts:5090, ongetProjectId()— "route a read through the protocol'senvironment_id-filtered lookup." There is no such lookup.objectql/src/plugin.ts:76, the member docstring one line below site 1 — "Scope sys_metadata reads/writes to this project." The same claim in miniature; it contains no literalenvironment_id, which is why a grep-anchored census missed it.Leaving site 6 in place would have left "the protocol's
environment_id-filtered lookup" standing four lines from a corrected block. All three are the same defect class as the card's four, in the same files, with the correct form already pinned by the evidence above, and no other open PR claims these paths.The census also found three passages that are already correct and were deliberately left alone, since they are the in-tree corroboration:
protocol.ts:5027("environment_idis no longer a discriminator"),protocol.ts:14308("each env = its own DB, soenvironment_idis redundant"), andobjectql/src/plugin.ts:2017("saveMetaItem no longer stampsenvironment_id").What the replacements say
Not a bare deletion — that loses the signal for the next reader who wonders whether environment scoping was ever there. Each passage now says what is true now and that the column job was retired, matching the wording already used by
database-loader.tsandsys-metadata.object.ts.environmentIdkeeps every job it actually has, and the corrected prose lists them from measurement of the 12 live sites inprotocol.tsand 6 inobjectql/src/plugin.ts: the ADR-0005 overlay-whitelist gate (save and delete doors), the ADR-0010 metadata-lock evaluation, the SchemaRegistry hydration and listing posture, the metadata-service bridge skip, and the local metadata-storage provisioning decision.Changeset, not skip-changeset
The
skip-changesetcriterion is "publishes nothing from any package", and a comments-only diff looks like it qualifies. Measured against the built output, it does not: both edited options docblocks appear in the emitted declarations (packages/objectql/dist/index.d.ts:1160+on the exportedObjectQLPluginOptions,packages/metadata-protocol/dist/index.d.ts:6025+on the exportedMetadataProtocolPluginOptions). A consumer's tooltip changes, so the change is published and apatchchangeset is the honest answer.Verification, at
121f2c332c*,//or/*. Nothing else moved.node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack(the script reads the change set itself). 31 commands, run with the exit code captured before any pipe. 29 exit 0. The two non-zero are both exit 3 = PREREQUISITE NOT MET, which those gates define as NOT MEASURED rather than a finding:check-test-completeness.mjsgrades a savedturbo run testlog and none was named, andcheck:dual-build-cjs-loadsneeds a whole-treepnpm build(54 packages have nodist/), which is a repo-wide operation CI owns.pnpm lint(eslint . --no-inline-config) exit 0.pnpm check:nul-bytes:OK (scanned 7551 text file(s) ... no raw ASCII control bytes).@objectstack/metadata-protocol—Test Files 146 passed | 2 skipped (148),Tests 2040 passed | 10 skipped (2050).@objectstack/objectql—Test Files 248 passed (248),Tests 4287 passed (4287). No test file appears in this diff; nothing was skipped, disabled, quarantined, allow-listed, deleted or re-baselined by this PR.pnpm --filter @objectstack/objectql typecheckexit 0, andtsc --listFilesconfirms the editedplugin.tsis genuinely in that program.@objectstack/metadata-protocolcarries notypecheckscript by design (DEBT ledger);node scripts/check-type-check-coverage.mjsis green, and the package's declaration build reads the file end to end.dist/*.d.ts.Both
Test Coreshards are expected red on arrival via #13645, which is unrelated to this diff and separately dispatched.Scope
Not addressed here, and left untouched on purpose: #13416 is not routed for dispatch (still
finding, nopm:queue), sopackages/metadata-core/src/record-organization.tsis not in this diff. #13433 remains open — it changes code and an index and goes separately. One new finding was filed while measuring this one: #13664, thepackages/speccloud docblock listingsys_metadataas a control-plane table "(withenvironment_id)", which ships to both the docs site and the published.d.ts; it is not repaired here because it is a different package and the correct wording turns on a fact about the cloud control plane that this tree cannot settle.Escalation gate: did not fire
Triage armed one: if any current design or review had cited these passages to argue an isolation barrier exists, this stops being a docs card. Searched the whole repo for the distinctive phrases (
stamps \environment_id`, ``filtered byenvironment_id``,environment_id = environmentId, `environment_id = this.environmentId`, `environment_id-filtered`, `stamp/filter`) outside the passages themselves: zero hits. No ADR, doc or review quotes them.Generated by Claude Code