Skip to content

fix(spec): list plugin-security's class-field error codes under its own ledger key - #19782

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-19441-plugin-security-ledger-rows
Sep 23, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-19441-plugin-security-ledger-rows

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #19441

Clause-②: yes

What changed

Two halves, in two packages, landed together (the triage rider: the registration and the comment are not interchangeable).

  1. packages/spec ledgerERROR_CODE_LEDGER['@objectstack/plugin-security'] gains three provenance rows, INVALID_STATE, NOT_FOUND, NOT_OVERRIDABLE, each with a comment naming the throwing class, its status and its door. They cover all four emission points the card listed (NOT_OVERRIDABLE is stamped by two classes, one row). Every code was already registered under another package (@objectstack/rest, @objectstack/metadata-protocol), so the ErrorCode union and the wire are unchanged: provenance, not identity. The NOT_FOUND entry in STANDARD_SYNONYM_WAIVERS keeps its code/shadows; its reason text now names plugin-security among the emitters (the same edit the FORBIDDEN waiver got when cloud-connection joined).
  2. plugin-security — the PackagedPermissionSetLockedError docblock no longer says "the code is a StandardErrorCode, so no ledger entry is minted". It now says what is true: NOT_OVERRIDABLE is a registered extension code, NOT a StandardErrorCode member, and this package's own owner key lists it. The two overlay-discard error classes get a one-line pointer to their rows. The plugin-security edits are comments only.

Premise check (on origin/main 041c8cf6)

  • The four stamps are at packaged-permission-set-lock.ts:266, :287 and permission-set-overlay-discard.ts:91, :101, all spelled readonly code = '...'.
  • All four are live. assertPermissionSetNotPackageDeclared is called from permission-set-projection.ts (three sites) and packaged-permission-set-lock-gate.ts. discardPermissionSetOverlay is registered by security-plugin.ts and served by rest's POST .../security/permission-sets/:id/discard-overlay. The classes are exported from index.ts.
  • They ship: after the build, each of the three literals hits 1 file in packages/plugins/plugin-security/dist/*.js (control UNIQUE_VIOLATION: 1).
  • None of the three was listed under plugin-security before this PR.
  • check:error-code-provenance declares class fields out of its scan (see its header, "BLIND ... and a class field"), so it was green before this PR and is still green now (exit 0).

Tests

  • New pin in error-code-ledger.test.ts: lists the plugin-security class-field stamps under their stamping package. It checks each code is listed under plugin-security AND is still listed under its first owner, and that it parses as an ErrorCode. It also checks NOT_OVERRIDABLE is absent from StandardErrorCode.options, with a lit control: PERMISSION_DENIED is present.
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/api/error-code-ledger.test.ts: 21 passed.
  • src/api (44 files): 1518 passed.
  • plugin-security packaged-permission-set-lock*.test.ts and permission-set-overlay-discard.test.ts (3 files): 33 passed.
  • typecheck for @objectstack/spec (including scripts-typecheck and test-typecheck) and for @objectstack/plugin-security: exit 0.
  • Ablation (one-off, not left in the tree): I deleted the plugin-security NOT_OVERRIDABLE row with scripts/ablation-replace.mjs (anchor x1 -> x0, marker x0 -> x1) and ran the pin: 1 failed | 20 passed, failing with NOT_OVERRIDABLE listed under plugin-security: expected [ 'INVALID_METADATA', ...(5) ] to include 'NOT_OVERRIDABLE'. After the restore the blob equals HEAD (d8ad7285) and git diff HEAD is empty. The suite imports the ledger from src, so no dist rebuild was involved. My first attempt was a no-op: the replacement text was already inside the anchor, so the tool refused and restored. It is not counted.

Gates (head 5a1a2efd)

dispatch-gates.mjs --commands listed 89 commands; --ran reconciled all of them (86 run, 3 NOT MEASURED, 0 unrun). All 86 that ran exited 0, including check:error-code-provenance, check:dispatcher-error-vocabulary, check:error-code-casing, check:api-surface, check:docs, check:authorable-surface, check:adr-0087-registration, check-changeset-no-major and check:nul-bytes.
NOT MEASURED, each exit 3 PREREQUISITE (they need a whole-workspace build that was not done locally; left to CI): check:dual-build-cjs-loads, check:i18n, check:type-check-debt. pnpm lint (a repo-wide scan) was not run locally; that is CI's run.

Changeset level

The dispatch suggested patch. The changeset grades @objectstack/spec minor instead: AGENTS.md's Post-Task Checklist says Clause-②: yes takes at least minor, check-changeset-no-major.mjs's level axis enforces that, and the ledger header says registering a code widens the published face. The precedent is #19437 (the prior plugin-security ledger row: spec minor). plugin-security has no changeset entry because its diff is comments only.

Acceptance notes

  • The card's other idea, making check:error-code-provenance see class-field spellings, is not done here. That is a gate-population change and a separate decision. Measurement for it: these four stamps were invisible to the gate because class fields are out of its scan. The new vitest pin holds only these rows; a future class-field stamp in any package would still be invisible to the gate.

Generated by Claude Code

…wn ledger key

Adds INVALID_STATE, NOT_FOUND and NOT_OVERRIDABLE provenance rows under
@objectstack/plugin-security, and replaces the packaged-set lock comment
that claimed NOT_OVERRIDABLE was a StandardErrorCode needing no row.

Claude-Session: https://claude.ai/code/session_01VWsFyWDp8Rjb2Ma6a3Cyo8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tests tooling labels Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-security, @objectstack/spec, touching 5 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/packaged-permission-set-lock.ts, packages/plugins/plugin-security/src/permission-set-overlay-discard.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/api/client-sdk.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-catalog.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-handling-server.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/automation/approvals.mdx (via INVALID_STATE (literal, a string literal in ERROR_CODE_LEDGER))
  • content/docs/kernel/contracts/data-engine.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/kernel/runtime-services/queue-service.mdx (via INVALID_STATE (literal, a string literal in ERROR_CODE_LEDGER))
  • content/docs/kernel/runtime-services/sharing-service.mdx (via NOT_FOUND (literal, a string literal in ERROR_CODE_LEDGER))
  • content/docs/permissions/permission-sets.mdx (via /security/permission-sets/:id (route, a path literal in a comment in ERROR_CODE_LEDGER))

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

  • content/docs/releases/v17/17-0.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-1.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-4.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))

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
  • 2 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/packaged-permission-set-lock.ts, packages/plugins/plugin-security/src/permission-set-overlay-discard.ts) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 139 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 4b23e4fab548c43c17754925fe0e1c66dbacd99cpackageMentionDocs.

Which tree this was computed on

This run read content/docs from 992be0195a29f10b7f393448e9235343ee80f4b8 — the merge of head 5a1a2efda0e5b6a01b0779f8e7ce4c96606084e3 into base 4b23e4fab548c43c17754925fe0e1c66dbacd99c, 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 992be0195a29f10b7f393448e9235343ee80f4b8 && git checkout 992be0195a29f10b7f393448e9235343ee80f4b8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4b23e4fab548c43c17754925fe0e1c66dbacd99c 5a1a2efda0e5b6a01b0779f8e7ce4c96606084e3 && git checkout -B drift-repro 4b23e4fab548c43c17754925fe0e1c66dbacd99c && git merge --no-ff 5a1a2efda0e5b6a01b0779f8e7ce4c96606084e3

node scripts/docs-audit/affected-docs.mjs --json 4b23e4fab548c43c17754925fe0e1c66dbacd99c

⚠️ 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 4b23e4fab548c43c17754925fe0e1c66dbacd99c → 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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5a1a2efda0e5b6a01b0779f8e7ce4c96606084e3

① Derived judgments

  • ERROR_CODE_LEDGER['@objectstack/plugin-security'] += INVALID_STATE — RIGHT. Stamped by PermissionSetOverlayStateError (class field); already registered under @objectstack/rest ⇒ no new code, ErrorCode union unchanged. Live: wired in security-plugin.ts, served by rest POST …/security/permission-sets/:id/discard-overlay; exported from index.ts.
  • …['@objectstack/plugin-security'] += NOT_FOUND — RIGHT. Stamped by PermissionSetNotFoundError; already registered under @objectstack/rest and @objectstack/plugin-sharing; the synonym gate is per code and NOT_FOUND already has its STANDARD_SYNONYM_WAIVERS row.
  • …['@objectstack/plugin-security'] += NOT_OVERRIDABLE (one row, two stamps) — RIGHT. PackagedPermissionSetLockedError + PackagedPermissionSetProvenanceUnknownError; already registered under @objectstack/metadata-protocol ⇒ provenance only. Live call sites in permission-set-projection.ts and packaged-permission-set-lock-gate.ts.
  • STANDARD_SYNONYM_WAIVERS NOT_FOUND row — reason text only; code / shadows unchanged; no test pins the string. Safe.
  • ErrorCode union / registered-code set / wire — UNCHANGED (all three codes exist on origin/main under other keys).
  • Rewritten comment in packaged-permission-set-lock.ts — now TRUE: NOT_OVERRIDABLE absent from packages/spec/src/api/errors.zod.ts at head (git grep exit 1; lit control PERMISSION_DENIED hits in the same file).
  • New test is discriminating: on origin/main the plugin-security array is [INVALID_METADATA, SUGGESTION_NOT_FOUND, SUGGESTION_STATE, UNIQUE_VIOLATION], so each toContain fails without the rows; control leg lit.
  • Missed stamps: NONE — 14 readonly code = sites in plugin-security at head; the other 10 are StandardErrorCode members or already listed under plugin-security.
  • check:error-code-provenance unchanged, consistent with the card; the class-field widening is deferred in the PR's Acceptance notes.

② Semver level

@objectstack/spec: minor — CORRECT: the ledger header says registering a code widens this face and is a Clause-② change; AGENTS.md: Clause-②: yes takes at least minor; the changeset carries the Clause-②: yes line. plugin-security without a changeset — acceptable: its diff is comment text only.

③ Boundary flags

  • The triage rider's two halves (ledger rows + false-comment rewrite) land together. Satisfied.
  • Widening past the card: NONE (5 files, +83/−6; the waiver reason edit is declared as a deviation).
  • "Ships in dist" verified from source (exports + live call sites + served route), not from a built dist.

Implemented-by: claude/issue-19441-plugin-security-ledger-rows
Reviewed-by: session_01VWsFyWDp8Rjb2Ma6a3Cyo8

VERDICT: PASS

Rendered by an isolated at-tier review subagent (fed the card, the PR and the head's check-runs only — not the dispatch order), adopted by domain:spec seat 4 after re-measuring two of its readings on the head. Checks at review time: 0 failures, CI still in progress — landing waits for every check green.


Generated by Claude Code

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/s tests tooling

Projects

None yet

1 participant