Repository navigation
feat(store): audit log in the store with a core tap; name is the role; cut ownerless (#1052 S4, #1041) - #1066
Merged
Merged
Conversation
…me is the role; cut ownerless (#1052 S4, #1041) - Audited writes record their event in store.sqlite (store_audit_events) in the same BEGIN IMMEDIATE transaction, pruned to auditRetention; the outbox, drain, backoff, flush, backlog refusal and drain marker are gone. Schema 7 moves any waiting outbox events into the log. - The audit event contract, validator, query and tap (AuditTap/AuditLog) move to core (@jimhoyd/urlcode/extensions); StoreExports.audit implements it. - urlcode-store audit (read-only list) and restore; one backup module. - packages/audit is deleted. - An independent package may take a first-party name while the first-party one is not installed; conformance test with an in-test sink named audit. - urlcode-store ownerless* and their API are removed; reassign stays. Part of #1052 and #1041. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re-1052 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-1052 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…store-1052 Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 30, 2026 16:11
…udit-into-store-1052 Keeps packages/audit deleted and drops it from the exports test's manifests and sibling-resolution check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
added a commit
that referenced
this pull request
Sep 30, 2026
…hs-filter plan and release-please config Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1052 and #1041.
Slice S4 of #1052, plus #1041 items 2 and 6.
What changed
The audit log belongs to the store now.
audit: truerecords its event as a row ofstore_audit_eventsinstore.sqlite. The row is written in the sameBEGIN IMMEDIATEtransaction as the change, so the event and the change commit together or not at all.extensions.store.config.auditRetentionevents (1000 to 10000000, default 100000). Older events are pruned in that same transaction.503 audit_backlogbackpressure and the drain marker (with the operator output'sundeliveredEvents,lastAuditDrainandwarning).store_audit_outboxinto the log, in order, then drops the outbox andstore_audit_drain.Query, retention and the CLI are store features.
urlcode-store audit --database <abs> [--source|--actor|--subject|--action|--action-prefix|--from|--to|--after|--limit|--order]prints one page. It opens the database read-only and never creates or upgrades it.urlcode-store restore --backup --destination, andrestoreStore.copyStorepath. A store backup includes the audit log.The tap, in core.
@jimhoyd/urlcode/extensionsnow exports the audit contract:AuditEvent,AuditStoredEvent,AuditQuery,AuditPage,AuditTap(peek(limit)/ack(ids)),AuditLog(the tap plusquery),AuditError,auditLimits,validateAuditEventandvalidateAuditQuery. The source ispackages/core/src/audit-events.ts, a pure module.StoreExports.auditimplementsAuditLog.ackmarks events as forwarded, and a sink deduplicates onid. Pruning ignores whether an event was forwarded.packages/auditis deleted.auditis conformance-tested instead.The name is the role.
addAddonsnow lets an independent package whose descriptor names a first-party role (audit,store,auth, …) install while the first-party package of that name is not installed.remove it first).urlcode extensions add <name>of the first-party package is refused while an independent stand-in provides that name.packages/store/test/audit.test.ts: an in-test extension namedaudit(requires: [store], core types only) is composed with the store. It forwards through the tap, and the test checks that events are delivered again after a restart when they were never acknowledged.test/addons.test.ts. The Auth.js proof now installs a stand-in namedauth.Ownerless commands cut (#1041 item 6).
urlcode-store ownerless,ownerless-assign,ownerless-deleteandreportOwnerless/assignOwnerless/deleteOwnerless, with their tests and docs.reassign/reassignOwnerstays. It now refuses the whole move, dry run included, when it would record more events thanauditRetentionkeeps.Unchanged constraints.
ack, runs inBEGIN IMMEDIATE.audit.sqliteand its lock are gone.Documentation and tooling updated.
docs/STORE.md,EXTENSIONS.md,OPERATIONS.md,OBSERVABILITY.md,CAPACITY.md,RESILIENCE.md,CI.md,VERSION-ALIGNMENT.md, andFRAMEWORK.md(package list and counts only).RIM-EXT-AUDIT-001;RIM-STORE-PERSIST-001andRIM-ADDON-001updated.scripts/package-audit.ts,ci-plan.tsand its test,ci.yml,publish.yml,check-workspace-links.ts,tsconfig.json, the lockfile, and thebench:storescript.Lines removed and added (
git diff --numstat origin/main)packages/*/src)test/,packages/*/test,*.integration.ts)*.md,*.txt, excluding generated)urlcode.json, store-schema config, llms-full, extension reference)Evidence
npm run verifypassed locally after the final merge oforigin/main. It includes lint, typecheck, docs checks, the root suite, every workspace's verify,audit:packages,test:addons,test:proof,test:proof:authjsandtest:ecosystem.npm run test:packagepassed.origin/mainwas merged three times while this was in progress (S5, S2@jimhoyd/urlcode/sqlite, S7 and S6). The conflicts were resolved by merge, not rebase.Limitations and follow-ups
docs/CAPACITY.mdstill carries audit-on throughput figures measured with the old outbox design. The page says so;npm run bench:storehas not been re-run.test/disk-full.integration.ts(a real ENOSPC filesystem) runs only on CI's Linux tmpfs leg. I updated it but did not run it locally.auditRetentionloses events silently. Only the page'soldestcursor shows that pruning passed it.CI passing is not an independent security review.
🤖 Generated with Claude Code