Uh oh!
There was an error while loading. Please reload this page.
docs(kernel): document services.audit as the slot it actually is - #9587
Merged
Conversation
The page described `record()` / `'set' | 'reset'`, which is `SettingsAuditSink` — a constructor-injected sink, never registered as or resolved from the kernel `audit` slot. The slot's only registrant is plugin-audit's `createAuthEventAuditSink`, whose surface is `recordAuthEvent(event)` with `action: 'login' | 'logout'`. Rewritten around the real slot, plus a disambiguation section naming the settings sink so the shape stays discoverable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
This was referenced Aug 18, 2026
os-steve
marked this pull request as ready for review
August 18, 2026 12:44
Uh oh!
There was an error while loading. Please reload this page.
os-steve added a commit
that referenced
this pull request
Aug 18, 2026
…nter, in a form published readers can follow (#9589) PR #9531 dropped this README's "See Also" pointer to the runtime-services audit page because the page documented the settings sink (`record()` / `'set' | 'reset'`) as if it were the `audit` slot. PR #9587 rewrote the page around the real slot, so the omission's reason has stopped holding. Restored because the page carries three things this README deliberately does not: the slot's own failure posture (`recordAuthEvent` never throws; error once per process then debug; row lost, nothing retries; silent no-op with no engine or no `userId`), the event's field-by-field shape, and the settings-sink disambiguation with its `TypeError` consequence. The README's own slot section states the interface and the closed action union and stops there. The restored line is not the removed line. That one was labelled "Audit Logging Best Practices" — a guide the page has never been — and spelled `/content/docs/.../audit-service.mdx`, which resolves for neither audience a published README has: on npm and GitHub a root-relative href resolves against npmjs.com / github.com, not the docs site. The replacement uses the absolute `https://docs.objectstack.ai/docs/...` form that create-objectstack's published READMEs already use. The one pre-existing site-root-relative docs link in the same file is converted to the same absolute form; its page and heading anchor both exist, only the spelling was unfollowable off the docs site. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
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 freeto 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.
Fixes#9534
What was wrong
content/docs/kernel/runtime-services/audit-service.mdxwas filed against the wrong seam. It is written asservices.auditand lives underruntime-services/, so it reads as the kernel service slot — but every claim on it describedSettingsAuditSink, a constructor-injected sink thatservice-settingsreceives directly and that is never registered as, or resolved from, that slot.A reader following the page and calling
getService('audit').record({ ... })got aTypeError.What the code actually says
Re-derived from source rather than from the card's phrasing:
service-settings/src/settings-service.types.tspackages/plugins/plugin-audit/src/auth-event-audit.tsrecord(entry)recordAuthEvent(event)AuthEventAuditSink,auth-event-audit.ts:112action: 'set' | 'reset'action: 'login' | 'logout'AuthSessionAuditAction,auth-event-audit.ts:68services.dataExactly one registrant,
AuditPlugin(audit-plugin.ts:117), and exactly one in-repo consumer,plugin-auth(auth-plugin.ts:363, typedAuthEventAuditSurface, whose inline shape matches field-for-field). No other shape occupies the slot in this repo or inobjectui, so "the registered service" is unambiguous.git grep "registerService(\s*'audit'", returns zero hits — the real registration spans two lines. The conclusion was right; the command printed in the card does not reproduce it. A line-based grep with a working positive control still reported nothing.The claim the card did not name
The card listed the method and the event union. The sweep found a third, independent error in Typical Errors, which said the caller awaits
record()without a surroundingtry/catch. That is backwards for both shapes:recordAuthEventcatches every failure internally and never throws (auth-event-audit.ts:255-263);this.audit.record(...)call intry/catch(settings-service.ts:1459-1482), a guard added deliberately so a ledger cannot fail a write that already landed.Also stale even as a description of the settings sink: the documented
record()parameter list predatestenantId.The rewritten Typical Errors section states the real posture — never throws, reports once per process then drops to
debug, silently no-ops without an engine or auserId, and the datasource-split cause behind most failing inserts.Deliberately unchanged
services.auditand the page's path. The 2026-06 hand-written docs audit ruledservices.*a chapter-wide descriptive convention rather than a literal registry key, and sibling pages follow it. Here it happens to also be the literal key. Keeping the path also keepscontent/docs/kernel/index.mdxandmeta.jsonvalid, so this PR touches one file.experimentalstability. Same audit ruled it a hand-asserted label with no code enum — not this card's call.sys_audit_log/sys_activityquery note, kept verbatim per the card.A short "Not this: the settings audit sink" section now names the
record()shape, its real canonical source, and why it is unreachable from this slot — so the shape the page used to carry stays discoverable, and the two are reconciled on the page instead of silently colliding.Verification
Gate union re-derived from the actual changed path with
node scripts/pm/dispatch-gates.mjs(identical to the dispatched list — no new families) and run at0b4d38c12, the final commit:check:docs-audit-scopeconfirms the page stays in the docs-accuracy-audit scope (179 hand-written docs in sync);check:role-wordpasses with the file still absent from the baseline (zero occurrences).No changeset:
content/docs/**only, no published package changes —skip-changesetapplied.Reported, not edited
Three findings are outside this card's one-file surface and were filed unassigned rather than ridden along:
runtime-services/index.mdxpoints "Audit bridge" at the settings sink, the same wrong seam #9534 fixed on the page it links to #9588 —content/docs/kernel/runtime-services/index.mdx:46points "Audit bridge" atsettings-service.types.ts: the same wrong seam, one file up. After this PR the index and the page it links to contradict each other.runtime-services/audit-service, dropped in PR #9531 because the page was wrong #9589 — the "See Also" link PR docs(plugin-audit): the published README stops documenting an API, a row shape and an action vocabulary that do not exist (#9517) #9531 dropped from plugin-audit's published README may now be worth restoring, since the page it pointed at is no longer wrong. Blocked on this PR landing; that README is plugin-audit's shipped README documents anauditServiceAPI and a row shape that do not exist — a published compliance-capability claim with no runtime behind it #9517's file.audit-service.mdxwith "None" #9590 (finding) — the 2026-06 docs-accuracy audit passed this page with an explicit "None", having verified the documented signature matchedSettingsAuditSink.recordEXACTLY. It did. The audit checks that a documented type exists and matches; it never asks whether that type is the one the page's seam resolves to.Generated by Claude Code