Skip to content

feat(audit): add per-session sequence counter#195

Closed
SasSwart wants to merge 1 commit intosas/session-id-at-startupfrom
sasswart/feat-audit-sequence-counter
Closed

feat(audit): add per-session sequence counter#195
SasSwart wants to merge 1 commit intosas/session-id-at-startupfrom
sasswart/feat-audit-sequence-counter

Conversation

@SasSwart
Copy link
Copy Markdown
Contributor

@SasSwart SasSwart commented Apr 30, 2026

PR Map

  1. feat(boundary): generate session ID at startup #194 (closed — merged into feat(audit): session ID generation, sequence counter, and BoundaryLog wiring #196)
  2. 👉🏼 feat(audit): add per-session sequence counter #195 (closed — merged into feat(audit): session ID generation, sequence counter, and BoundaryLog wiring #196)
  3. feat(audit): session ID generation, sequence counter, and BoundaryLog wiring #196
  4. feat(config): session correlation header injection configuration #197
  5. feat(proxy): inject session ID and sequence number headers on matching requests #198

Introduces SequenceCounter, a shared atomic.Uint64 counter intended to be initialized once per boundary session and shared between the socket auditor and the proxy.

Next() returns a zero-based, monotonically increasing value so the audit event and any injected header for the same request agree on the sequence number.

No wiring yet; this PR only adds the type and its tests.

Changes

  • audit/sequence.go: SequenceCounter type with Next() helper.
  • audit/sequence_test.go: Tests covering zero-start, sequential increment, concurrent safety (8 goroutines x 1000 calls, no duplicates/gaps), and independent instance isolation.

Generated by Coder Agents

Introduce SequenceCounter, a shared atomic uint64 counter intended to
be initialized once per boundary session and shared between the socket
auditor and the proxy. The Next() method returns a zero-based,
monotonically increasing value so the audit event and any injected
header for the same request agree on the sequence number.

No wiring yet; this commit only adds the type and its tests.
Copy link
Copy Markdown
Contributor Author

Closing in favour of #196, which now includes this work.

@SasSwart SasSwart closed this Apr 30, 2026
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.

1 participant