Skip to content

refactor(core, plugin-security, plugin-sharing): one isFederatedObject binding, read from the spec predicate - #31896

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-pbq1qf
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-pbq1qf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #31849

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:“这个对象是不是联邦对象(ADR-0015 external)”在运行时只剩一个函数:core 的 isFederatedObject,它直接读 spec 的 platformProvisionsStorage;plugin-security、plugin-sharing 改为转出 core 的同一个函数,另外 7 处手写的 external 判断也改为调用它。
  • 为什么改:同一个判断写了十来遍,将来“联邦”的含义一变(比如改读 schemaMode)就得逐处去找,漏一处就会出现两层答案不一致。
  • 风险与回滚:行为不变:对所有对象记录以及 null、undefined、数组、原始值,新旧答案相同。回滚即撤本 PR。
  • 先看:packages/core/src/security/tenant-field.ts(isFederatedObject 本体);packages/plugins/plugin-security/src/federated-phantom-anchors.ts(删掉的副本);packages/core/src/security/tenant-field.test.ts(新钉)。
  • 两分钟验证:git grep -n "external != null\|external == null" packages/core packages/objectql packages/plugins 预期在非测试源码里零命中。
  • 需要你做的:无,席位落地。

What changes

  • @objectstack/core isFederatedObject (security/tenant-field.ts) returns !platformProvisionsStorage(schema) from @objectstack/spec/data, the spelling [Decision] applySystemFields injects platform anchors into external objects the platform provisions no storage for — three consumers have now independently re-derived "that column is not really there" #7865's convergence map names.
  • @objectstack/plugin-security and @objectstack/plugin-sharing federated-phantom-anchors.ts drop their own copy (security: external != null; sharing: its own !platformProvisionsStorage wrapper) and export { isFederatedObject } from @objectstack/core. The export name stays where it was, so every importer keeps resolving. @objectstack/objectql keeps re-exporting the core binding, unchanged.
  • The other runtime copies of the presence test, found by the measure below, now ask the same binding:
    • packages/objectql/src/search-companion.ts isDdlManaged (external == null)
    • packages/cli/src/commands/migrate/unmapped-columns.ts (the "federated" outside reason)
    • packages/cli/src/utils/schema-migrate.ts (managed-drift driver scan)
    • packages/cli/src/utils/schema-migration-plugins.ts (coverage pass federated count)
    • packages/services/service-analytics/src/plugin.ts isExternalObject (ADR-0062 D6 gate)
    • packages/triggers/trigger-schedule/src/time-relative-trigger.ts organizationScopeIsInertFor
    • packages/metadata-protocol/src/protocol-save-door-refusals.ts (datasource-bound external read; was !== undefined && !== null)
  • Comment-only rewording where a docblock named the old expression as the predicate: objectql engine-driver-options.ts, integrity/dangling-reference-audit.ts; plugin-security security-plugin.ts; plugin-sharing sharing-service.ts.
  • One forced test edit: packages/objectql/src/federated-injected-column-readers.test.ts gains a READERS row search-companion.ts#isDdlManaged :: isFederatedObject() (not-a-read), because the search companion now calls the seam by name.

Why

Measure on origin/main 3f0e3ac (git grep -n "external != null\|external == null\|external !== undefined\|isFederatedObject\|platformProvisionsStorage" under packages/, non-test): besides the card's table, seven more source sites restated the presence test (listed above). Seat ruling 1 converges them too. Not converged, because they are a different question: service-datasource external-datasource-service.ts:1374 (external !== undefined || datasource !== 'default', a wider "routed off the default datasource" test) and datasource-admin-service.ts (patch.external, a patch field, not an object). packages/spec keeps the one definition (no spec edit).

Input equivalence (seat ruling 2): platformProvisionsStorage answers true (not federated) for null, undefined, arrays and any non-object, and the old ?.external != null answered false (not federated) on each of those, so the two agree. The only inputs where they differ are a function or an array that carries an own external property; no producer hands one to these seams (all read registry or overlay object records).

Tests

  • packages/core/src/security/tenant-field.test.ts (new): isFederatedObject(x) === !platformProvisionsStorage(x) and the expected verdict for {}, { external: {} }, { external: null }, { external: undefined }, null, undefined, []; plus barrel identity.
  • packages/plugins/plugin-security/src/federated-object-binding.test.ts and packages/plugins/plugin-sharing/src/federated-object-binding.test.ts (new): the module export toBe core's binding.
  • Why identity: a restored local copy answers the same as core on every record, so no behavioural pin can see it (measured: the core ablation below stays green). Identity is the only thing that changes.
Ablations (ruling 4), each restored with blob == HEAD and empty diff
  • plugin-security: delete the core import and restore export function isFederatedObject(schema) { return schema?.external != null } → federated-object-binding.test.ts RED (expected [Function isFederatedObject] to be [Function isFederatedObject] // Object.is equality), federated-tenant-layer0.test.ts stays green (behaviour identical). Tests 1 failed | 8 passed.
  • plugin-sharing: delete the core import and restore the old !platformProvisionsStorage wrapper → federated-object-binding.test.ts RED, same assertion; Tests 1 failed | 57 passed.
  • core: revert the body to ?.external != null → tenant-field.test.ts stays GREEN (8/8): the agreement pin cannot see a revert, by design, which is why the re-export layers carry the identity pin.
  • Mutations landed through scripts/ablation-replace.mjs (anchor 1 → 0, marker grep 1); tests import the module under test from src, so no dist leg.

Acceptance notes

  • Test files still name external != null in prose or as a test variant (e.g. injected-system-columns-parity.test.ts, the dangling-audit federated phantom test); they describe what a mutation would look like, not a predicate copy.
  • packages/spec/src/data/injected-system-column-provenance.ts:263 still says plugin-security holds a hand-rolled copy; that doc is spec prose and this card forbids packages/spec/** edits.

Verification

Head 10eb82ed (origin/main 1a66fcf merged in; the merge brought #31876, which edits plugin-sharing and core in other files).

  • git grep -n "external != null\|external == null" packages/core packages/objectql packages/plugins (non-test, CHANGELOG excluded): 0 hits. Under all of packages/, the only remaining hits are the definition in packages/spec/src/data/injected-system-column-provenance.ts.
  • Build: turbo run build --filter='./packages/**' --filter='./examples/**' under the verify lock, VERDICT command-exit 0.
Package suites and typecheck

At 10eb82ed (after the main merge):

  • core: typecheck + test, Test Files 141/141, Tests 3237/3237
  • plugin-sharing: typecheck + test, Test Files 73/73, Tests 1497/1497
  • plugin-security: typecheck + test, Test Files 252/252, Tests 6051 passed, 45 skipped
  • objectql: typecheck + federated-injected-column-readers, federated-object, search-companion*, package-scoped* (6 files, 212/212)
  • cli, metadata-protocol, service-analytics, trigger-schedule: typecheck, exit 0

At 73db2448 (before the merge; the code these suites exercise is unchanged since):

  • objectql full: Test Files 580/580, Tests 11935/11935
  • service-analytics full: Test Files 214/214, Tests 5140 passed, 332 skipped
  • trigger-schedule full: Test Files 12/12, Tests 230/230
  • metadata-protocol full: Test Files 330 passed, 5 skipped; Tests 22626 passed, 29 skipped
  • cli --project unit: 404/406 on the first run. The 2 failures were published-subpath-console.pin and published-subpath-hook-body.pin, which need packages/cli/dist and stopped with "packages/cli is not built". After the full build they passed 2/2 (29 tests). The integration tier is left to CI.
  • Lint: root eslint --no-inline-config on the changed .ts files, exit 0.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 10eb82ed: all 80 derived families exit 0. --ran reconciliation: "80 derived famil(ies) accounted for — 80 run, 0 NOT-MEASURED". node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 0 anchors lost.

Human Minimum

None; the seat lands it.


Generated by Claude Code

Core's isFederatedObject now returns !platformProvisionsStorage(schema).
plugin-security and plugin-sharing re-export core's binding instead of
holding their own copies, and the other runtime copies of the external
presence test (objectql search companion, cli migrate x3, analytics
federation gate, schedule trigger bind line, save-door datasource
binding) ask the same binding.

Claude-Session: https://claude.ai/code/session_01ADHkmSLoDy6zFb6HpabaTT
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 8 package(s): @objectstack/cli, @objectstack/core, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/plugin-security, @objectstack/plugin-sharing, @objectstack/service-analytics, @objectstack/trigger-schedule, touching 11 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/objectql/src/engine-driver-options.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/data-modeling/queries.mdx (via os migrate unmapped-columns (command, read off packages/cli/src/commands/migrate/unmapped-columns.ts))
  • content/docs/deployment/cli.mdx (via os migrate unmapped-columns (command, read off packages/cli/src/commands/migrate/unmapped-columns.ts))
  • content/docs/plugins/packages.mdx (via AnalyticsServicePlugin (symbol, a top-level class))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via AnalyticsServicePlugin (symbol, a top-level class))
  • content/docs/releases/v17/17-7.mdx (via os migrate unmapped-columns (command, read off packages/cli/src/commands/migrate/unmapped-columns.ts))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/objectql/src/engine-driver-options.ts) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 107 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 85 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ac8fede8f938439d2228f5b1404042d113a3812e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 2e68567ae236e7502a78fc600a3931f3de960c02 — the merge of head 10eb82edc405e735543d18b08e21f1ec1dee51c7 into base ac8fede8f938439d2228f5b1404042d113a3812e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 2e68567ae236e7502a78fc600a3931f3de960c02 && git checkout 2e68567ae236e7502a78fc600a3931f3de960c02
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ac8fede8f938439d2228f5b1404042d113a3812e 10eb82edc405e735543d18b08e21f1ec1dee51c7 && git checkout -B drift-repro ac8fede8f938439d2228f5b1404042d113a3812e && git merge --no-ff 10eb82edc405e735543d18b08e21f1ec1dee51c7

node scripts/docs-audit/affected-docs.mjs --json ac8fede8f938439d2228f5b1404042d113a3812e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs ac8fede8f938439d2228f5b1404042d113a3812e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQKZzp4DLtqiCkZZRM

维护者速读

  • 改了什么: "这个对象是不是联邦对象(表在外部数据库)"的判断,以前在 core、plugin-security、plugin-sharing 以及另外 7 处各写一遍 external != null;现在都读 @objectstack/spec/data 的 platformProvisionsStorage 一个判定(core 的 isFederatedObject 是它的取反,其他包转出或调用同一个函数)。
  • 为什么改: 联邦对象的定义以后只需改 spec 一处,不会各处说法分叉。
  • 风险与回滚: 行为不变,每一处的判断结果与原来相同。回滚即还原本 PR。
  • 先看: packages/core/src/security/tenant-field.ts。
  • 需要你做的: 无,由席位落地。
  • 席位意见: ACCEPT。

席位核对 — ACCEPT · domain:server#2 · Head-sha 10eb82edc405e735543d18b08e21f1ec1dee51c7 · 2026-11-09T11:13Z

  1. Shape: draft to main, Fixes #31849, Clause-②: no, Metadata-protocol: none, patch changesets. 19 files, +156/−36.
  2. Delta rulings, checked against the diff:
    • One predicate: core's isFederatedObject is !platformProvisionsStorage(schema); plugin-security and plugin-sharing re-export core's binding from federated-phantom-anchors.ts under the same names, pinned by toBe identity.
    • Measured census: 7 more source copies found and converged (objectql search-companion, cli unmapped-columns / schema-migrate / schema-migration-plugins, service-analytics, trigger-schedule, the metadata-protocol save-door datasource binding). Two left alone because they ask a different question (external-datasource-service's non-default-datasource arm, and the admin patch.external): accepted.
    • Same answers: on a non-object input the spec answers "provisioned", so this answers "not federated", as the presence test did. The function/array-with-external divergence has no producer and is not pinned (ruled).
  3. Gates:
    • Dev: core 7-input pin plus barrel identity; both identity ablations red and restored; 80/80 derived gates, 0 NOT-MEASURED; typecheck green on 8 packages; the affected suites green.
    • Check-runs on this head: 54 success, 11 skipped, 0 failed.
    • Governed surfaces: 0 of 19 paths on the register.
  4. Sequencing: PR feat(objectql, cli, metadata-protocol, spec, runtime)!: a namespace never equals an object name at every door #31887 (seat 1, K) edits protocol-save-door-refusals.ts in other hunks; whichever lands second merges main.
  5. Landing: pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 9, 2026 11:15
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 9, 2026 11:15
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit d9f626b Nov 9, 2026
66 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-pbq1qf branch November 9, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(core, plugin-security): isFederatedObject is spelled four times; every copy should read the spec predicate platformProvisionsStorage

1 participant