Repository navigation
fix(objectql)!: store a code package's action as its ActionSchema parse, so a bound action's requiresFeature is lowered - #25699
Conversation
Code-package action items reached the registry with no ActionSchema parse, so requiresFeature / requiresMembershipReach were never lowered into visible and the bound attachment served them inert. registerItem now stores the parse, or refuses an action that does not parse with the INVALID_METADATA envelope. Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
…hangeset Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
A package's action is now stored as its ActionSchema parse, so the fixtures that registered off-spec action bodies carry declarations that parse; the registry's generic-item cases use a type with no parse. Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
…und-action-schema-parse
…cker Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
…s target Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 19 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 0272a05caa125d65b5a2d3184556a133c38ae7ee && git checkout 0272a05caa125d65b5a2d3184556a133c38ae7ee
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b77bb37eb2c738c40093acb04f19fa8fc2dd605a f9330127c2a40594278c9e14e11e096928dc1d43 && git checkout -B drift-repro b77bb37eb2c738c40093acb04f19fa8fc2dd605a && git merge --no-ff f9330127c2a40594278c9e14e11e096928dc1d43
node scripts/docs-audit/affected-docs.mjs --json b77bb37eb2c738c40093acb04f19fa8fc2dd605a
|
席位核对REWORK ·
Generated by Claude Code |
… its ADR-0087 disposition Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
席位核对ACCEPT (seat review,
Not landed in this act. The Generated by Claude Code |
Contract reviewServed-tier: Face: ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS
Generated by Claude Code |
Fixes #25649
Clause-②: no (narrowing) —
SchemaRegistry.registerItem, and with itObjectQL.registerAppand every door that registers a code package's items, now refuses with422 INVALID_METADATAanactionbody that does not satisfyActionSchema. Before, it registered that body as written. Nothing is widened.Metadata-protocol: none —
ActionSchemais unchanged and no key is added, retired or re-shaped. Every body the registry now refuses already fails the same schema atdefineStack,os validateand the metadata save door, so what a metadata author can write under the protocol does not move. The runtime door converges on it.BREAKING for a package that registers an action body
ActionSchemadoes not accept. Such a body used to be stored as written, with its declared gates inert. Now its registration is refused withINVALID_METADATA(422), naming the action and its package, andissues[]locates each failure. An action that passesos validateor a strictdefineStackis unaffected. ADR-0087 disposition (in the changeset):not-required (no-migration-prescription).ActionSchemais byte-unchanged, so there is nothing forobjectstack migrate metato rewrite.What changed
SchemaRegistry.registerItem(packages/objectql/src/registry.ts) now stores a code package'sactionitem as itsActionSchemaparse. If the item does not parse, the registry refuses it loudly. Before, the item was stored as the package wrote it.registerItemis the one site every code-package action passes:ObjectQL.registerApp, nested plugins, the metadata facade and the ObjectQL plugin's metadata-service sync all register through it. The new step runs right afterapplyProtectionand before anything is stored. It applies when the type isaction, apackageIdis passed, andisCodeArtifactBodyholds. A registration with nopackageIdis the bare slot (sys_metadatahydration, the write-through) and is not judged here, the same rule the security-catalog and default-page checks in that method follow.ActionSchema's transform lowersrequiresMembershipReachandrequiresFeatureintovisibleand deletes both keys. No runtime code reads either key raw. So an unparsed stored action carried both gates declared and inert, andattachBoundActionsserved it that way. Platform objects' actions are parsed where they are authored (ObjectSchema.create), which is whyrename_organizationwas lowered and cloud's boundchange_slugwas not.toBepinned).attachBoundActionsis unchanged, so rung 1 before rung 2 and dedupe by name both hold.INVALID_METADATA/ 422 envelope (ADR-0112), the code this package already uses for metadata that fails the spec. The message names the action and its package.issues[]gives each failure withpath,messageandcode. No new error code.What the parse does to a code-package action (measured)
Measured on
@objectstack/specat this branch's base, with a stamped body (applyProtection, package id and version):requiresFeatureis lowered:visible: "record.x == 1"withrequiresFeature: multiOrgEnabledbecomes{ dialect: 'cel', source: '(record.x == 1) && features.multiOrgEnabled != false' }, and the key is deleted.requiresMembershipReachis lowered the same way.refreshAfter: false, andtypedefaults to'script'.{ dialect, source }.unrecognized_keys; the schema is closed)._packageId,_packageVersion,_provenance,_lock) is declared on the schema and passes through.parse(parse(x))equalsparse(x).In-repo shipped actions: none refused. The registry door's accept set narrows (above), but every top-level action the in-repo stacks ship goes through a strict
defineStackordefineAction, and all of them parse. I ran each stamped action throughActionSchema.safeParseand compared the canonical (key-sorted) JSON before and after:examples/app-crmexamples/app-todoexamples/app-showcase(allActions)No top-level
actions:collection exists inpackages/plugins/**,packages/services/**orpackages/runtime/src/**source. The refusal reaches only the test fixtures triaged below.Tests
New, in
packages/objectql/src/bound-action-foreign-object.test.ts, through the realObjectQL.registerAppandprotocol.getMetaItem({ type: 'object' }), the read behindGET /api/v1/meta/objects/:name:requiresFeature: 'multiOrgEnabled'and a CELvisibleis served with the conjunct lowered,(record.name != '') && features.multiOrgEnabled != false, and with norequiresFeaturekey. The value equals what the platform object's own action with the same declaration (ObjectSchema.create) is served. The attachment istoBethe registry item.visibleof its own is served the gate alone.ObjectSchema.createproduced it.requiresFeaturebesidevisible: falseis refused withINVALID_METADATA/ 422. The message nameschange_slugandcom.test.binder,issues[]containspath: 'requiresFeature', and the item is not stored or attached.Ablation (
scripts/ablation-replace.mjs, wrap mode). The test imports./registry.jsfrom source, so no dist leg applies. The anchoritem = parsePackageAction(item, baseName, packageId) as T;hit once and was replaced by a comment; the blob went0aa44217to07883fa6. Result: 3 tests failed and 15 passed. The three red were the lowering, gate-alone and refusal tests; the control stayed green, as intended. Restore: blob0aa44217equals HEAD andgit diff HEADis empty.Fixture triage (the refusal's consumer radius)
Each fixture below registered an off-spec action body. Each one got the missing declaration ("supply the declaration"). Nothing pinned the removed behaviour:
objectql/src/package-disable-enforcement.test.ts: the shippedactionspecimen gainstype: 'url'andtarget.objectql/src/engine-nested-plugin-collections.test.ts: theactionsprobe gainstype: 'url'andtarget.objectql/src/registry-package-version-stamp.test.ts: thescriptaction gains atarget.objectql/src/registry.test.ts: the "generic metadata" cases now use typereport;actionis no longer a generic item.objectql/src/bound-action-collision-report.test.ts: the owner's object is authored withObjectSchema.create, as an object is, so its action is the parse of what was written, like the carrier's registered copy.runtime/src/domains/mcp-package-object-discovery.test.ts: the AIdescriptionis 40 characters or more, the lengthActionSchemarequires.runtime/src/stored-metadata-reader-contexts.pin.test.ts: the host-handlerscriptaction names itstarget. The runtime never reads ascriptaction'stargetserver-side, since dispatch is by handler key, so the pin's subject is unchanged.Local verification
Final head
f9330127c2. The rework commit changes only the changeset.pnpm --filter @objectstack/dogfood test, noOS_TEST_SHARD, no paths), after building the@objectstack/dogfood^...closure:Test Files 295 passed | 3 skipped (298),Tests 2520 passed | 18 skipped (2538), exit 0. Lock:VERDICT command-exit 0.@objectstack/objectqllocal project, full:Test Files 466 passed (466),Tests 8704 passed (8704), exit 0.@objectstack/objectqltypecheck: exit 0, includingcheck:test-typecheck: OK.node scripts/check-adr-0087-registration.mjs --base origin/main: exit 0. It reads one declared-breaking changeset,[BREAKING+bang+clause-②-narrowing], with dispositionnot-required (no-migration-prescription).node scripts/check-changeset-no-major.mjs --base origin/main: exit 0. With--eventcarrying this body, it also exits 0 and readsclause-② no (narrowing), metadata-protocolnone, no changeset gradedminoror above.node scripts/check-empty-changeset.mjs --base origin/main: exit 0.eslint --no-inline-configover the 9 touched.tsfiles: exit 0.@objectstack/runtimelocal project full (441 files; the one red file was triaged, and both triaged files rerun green, 171 tests), runtime typecheck exit 0,@objectstack/restfull (325 files),@objectstack/metadata-protocolfull (263 passed, 3 skipped). At89ecd31788, the 74 familiesdispatch-gates.mjs --commandsderived all exit 0 (--ran: 74 derived, 74 run, 0 NOT-MEASURED).Acceptance notes
strict: falsestack registered withregisterAppstores its objects' ownactionsunparsed, because the object path'svalidateis a diagnostic only. Measured: a probe registering{ objects: [{ …, actions: [{ name: 'gated', …, requiresFeature: 'multiOrgEnabled' }] }] }reads back fromprotocol.getMetaItem({ type: 'object' })withrequiresFeatureraw and novisible. This is the same declared-not-enforced family; the seat carries it, outside this PR.Generated by Claude Code