Skip to content

docs: audit seq emit invariant + counter install order (post-#173/#174)#178

Merged
initializ-mk merged 1 commit into
mainfrom
docs/sync-audit-seq-invariant
Jun 16, 2026
Merged

docs: audit seq emit invariant + counter install order (post-#173/#174)#178
initializ-mk merged 1 commit into
mainfrom
docs/sync-audit-seq-invariant

Conversation

@initializ-mk

Copy link
Copy Markdown
Contributor

Summary

Sync the canonical audit doc and the comprehensive knowledge skill to reflect PR #173 (fix: stamp seq on `tool_exec` + `session_end`) and PR #174 (fix: install `SequenceCounter` before the auth middleware so `auth_verify` lands `seq=1`) — both merged to `main`.

No code change. Docs-only. TOC anchors unchanged. Broken-link sweep is clean.

Changes

`docs/security/audit-logging.md` — under `### Sequence numbers`

Two new H4 subsections:

`.claude/skills/forge.md` — three surgical edits

Test plan

  • Confirm the skill file's TOC anchors still resolve (`grep '^## ' .claude/skills/forge.md`).
  • Sanity-read the two new H4 subsections in `docs/security/audit-logging.md` render correctly on the docs site.
  • Confirm the named regression tests exist on `main`:
    • `TestToolExecAudit_CarriesSequenceFromContext` (`forge-cli/runtime/audit_tool_exec_seq_test.go`)
    • `TestAuthAudit_SeqStampedWhenCounterInstalled`, `TestEnsureSequenceCounter_ReusesExisting` (`forge-cli/runtime/auth_audit_seq_test.go`)

Closes the docs side of #173 and #174. Does NOT close #175 (that's a code follow-up to add the lint).

Reflects PRs #173 and #174 (both merged to main) in the canonical
audit doc and the comprehensive knowledge skill.

docs/security/audit-logging.md — under "Sequence numbers", added:
  - Counter installation order — the SequenceCounter is installed by
    installSequenceCounterMiddleware (wraps the auth chain) so
    auth_verify / auth_fail land seq=1; the runner's request entry
    uses EnsureSequenceCounter to reuse the wrapper-installed counter
    and only allocate fresh on the --no-auth path. Pinned by
    TestAuthAudit_SeqStampedWhenCounterInstalled +
    TestEnsureSequenceCounter_ReusesExisting.
  - Emit invariant — per-invocation events MUST emit via
    EmitFromContext (or a typed helper); plain Emit skips the counter
    and the trace cross-link. The regression behind #173 (tool_exec +
    session_end) and #174 (auth_verify). A 4-row table names the
    sites that intentionally stay on plain Emit (egress proxy
    subprocess CONNECT, MCP startup events, scheduler tick, startup
    banners) and why. Issue #175 is named as the lint follow-up.

.claude/skills/forge.md — three sections updated:
  - § 3 path trace: middleware order now shows
    installSequenceCounterMiddleware as outermost; runner request
    entry uses EnsureSequenceCounter.
  - § 12.4 FWS-8 section: added the Emit invariant paragraph naming
    the regression pins and exception list.
  - § 18 FWS-8 row: appended #173 / #174 follow-up summary +
    #175 lint tracker.

No code change. TOC anchors unchanged. Broken-link sweep clean.
@initializ-mk initializ-mk merged commit 27be222 into main Jun 16, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint: AuditLogger.Emit inside per-invocation scope should be EmitFromContext

1 participant