Uh oh!
There was an error while loading. Please reload this page.
test(plugin-security): measure the provenance a real seeder run leaves on the platform default permission sets - #8804
Conversation
…s on the platform default permission sets (#8692) Measurement only — no behaviour change. Seeds through the real shipped defaultPermissionSets against a real ObjectQL engine over better-sqlite3, which is the wiring security-plugin.ts and `os meta resync` both use. Measured: a seeder-created row is stored `managed_by: 'admin'` (the object's declared defaultValue), not NULL — so `os meta resync` reports resynced 0 / resyncSkipped 8 and logs an "intentional override" for every platform default set, the inverse of what #2705 built the flag for. The three existing hand-seeded cases are unchanged; they cover the resync branch, and none of them goes through the real seeder, which is the gap. An attribution counterfactual boots a clone of the declaration whose default is respelled to 'platform' and flips both counts, establishing all three links at once: the seeder writes no managed_by, the engine applies a declared defaultValue on insert, and the `!row.managed_by` limb is live. Whether these rows SHOULD be platform-owned or env-authored is the open product question in #8692 and is deliberately not decided here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NaS1PAHJcPfAA2acnV53Tn
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
qq9340100
commented
Aug 15, 2026
ACCEPT — PM review, |
Uh oh!
There was an error while loading. Please reload this page.
…latform'` so `os meta resync` reconciles them (#8692) `bootstrapPlatformAdmin` seeded the default permission sets without writing `managed_by`, so the value fell to the declaration's `defaultValue: 'admin'`. `os meta resync` reconciles only platform-owned rows, so every shipped default set took the skip branch (measured: resynced 0 / resyncSkipped 8) and each skip was logged as an "intentional override" for a row no admin had touched. Implements the maintainer ruling of 2026-08-15 (Option A): - the seed insert stamps `managed_by: 'platform'` explicitly, matching `bootstrap-builtin-positions.ts` and `bootstrap-system-capabilities.ts`; - FORWARD ONLY -- no migration, no restamp of existing 'admin' rows, since a stored 'admin' cannot be told apart from a real Setup takeover and rewriting it could silently overwrite admin edits on the next resync; - the skip warn drops its "(intentional override)" claim of intent; - the seeder docblock records what pre-ruling installs carry and why they keep the skip; - two comments claiming the posture "keeps the platform defaults env-authored -- the posture bootstrapDeclaredPermissions relies on" are removed: measured false, since bootstrapDeclaredPermissions special-cases only 'package'. The #8804 pin suite now asserts both sides: a fresh install stores 'platform' and resyncs every set, and a pre-ruling 'admin' row is still skipped with its content intact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y26DJEHSBhhAQ6wwfsHNza
Part of #8692
This card asked for a reading, not a fix — in its own words, "this needs a reading before it needs a fix." So this PR adds one test file and changes no behaviour: no field default touched, no resync condition altered, no log line "corrected", no
managed_byadded to the seeder's insert.The measurement
Seeded through the real shipped
defaultPermissionSetsagainst a realObjectQLengine over a real better-sqlite3SqlDriver— the same wiringsecurity-plugin.tsandos meta resyncboth use, each handing the bare engine straight tobootstrapPlatformAdmin.managed_byon the seeder-createdadmin_full_accessrow (stored, read at the driver)"admin"find(what the resync branch reads)"admin"resyncedafter a real resync of all 8 shipped default sets0resyncSkipped8(every one of them)[security] resync left admin_full_access untouched — row is admin-owned (intentional override)The card's mechanism reproduces exactly. The engine applies the object's declared
defaultValue: 'admin'on insert, so the!row.managed_bylimb of the resync condition is unreachable for every row this seeder creates, andos meta resyncreconciles nothing while reporting an "intentional override" for rows no admin ever touched.Which link supplies the value — proven, not inferred
A counterfactual in the test boots a second engine on a clone of the declaration whose
managed_bydefault is respelled to'platform', then runs the same unmodified seeder over the same unmodified sets. Predicted direction, written down before running: both counts should flip. They do — the row stores'platform',resyncedbecomes 8,resyncSkippedbecomes 0.That single flip establishes all three links at once, which no direct assertion can:
managed_byof its own (it would otherwise beat the clone's default);defaultValueon insert — the card's one stated unknown;!row.managed_by || row.managed_by === 'platform'limb is live and working, so the skip is caused by the stored value alone, not by a broken condition.The clone is a test-local object. The shipped declaration is asserted untouched in the same case.
What is deliberately NOT decided here
The upstream product question the card identifies stays open and is a maintainer call:
The source still argues both ways — the resync condition's
!row.managed_by ||half reads as though NULL was expected, while the comment directly above the insert calls the posture one that "keeps the platform defaults env-authored". Both cannot be true, and the measurement above does not adjudicate between them; it only establishes which branch the code actually takes. The test header says so and points back at this card, so a future reader cannot mistake a recording for an endorsement.Because the reading is only half the card, this PR is
Part ofrather than a closing PR: #8692 remains open for that decision.The three existing cases are untouched
bootstrap-platform-admin.test.tshand-seedsmanaged_byasnull/'user'/'package'and asserts the resync branch three ways. Those are correct unit coverage and are unchanged. The gap they leave is that a fakeqlstores exactly the columns it is handed, so a declared field default never runs — meaning the one row shape the platform actually creates was the one shape nothing exercised. This file adds that end-to-end case rather than replacing any of them.Verification
All at
6bd664ea8, the head this PR proposes:pnpm --filter @objectstack/plugin-security test— 63 files, 1195 tests passed (5 new)pnpm --filter @objectstack/plugin-security typecheck— cleannode scripts/pm/dispatch-gates.mjs, then run:check:cross-package-test-inputs,check:test-source-alias,check:type-source-resolution,check:nul-bytes,check:engine-double-contract,check:i18n,check:query-options-erasure,check:type-check-coverage,check:type-check-debt— all green.Two notes on gates that first refused to run (a refusal is not a pass):
check:i18nneeded@objectstack/clibuilt andcheck:type-check-debt --re-measureneeded the full workspace closure built. Both were built and both gates then ran for real and passed — exit codes read directly, not through a pipe, since both scripts warn that piping reports the pipe's status.No changeset: this PR adds a test file and ships no user-visible change, so it carries
skip-changeset.Generated by Claude Code