Skip to content

refactor: deepen Keyring seam and remove dead weight#128

Merged
allisson merged 2 commits into
mainfrom
improve-codebase
May 23, 2026
Merged

refactor: deepen Keyring seam and remove dead weight#128
allisson merged 2 commits into
mainfrom
improve-codebase

Conversation

@allisson
Copy link
Copy Markdown
Owner

Summary

  • Delete auth/service.AuditSigner — zombie interface left behind when AuditLogUseCase migrated to keyring.KeySigner (ADR-0013). Removes the implementation, 456 lines of tests/benchmarks, and 153 lines of generated mocks. Signing now has one canonical home.
  • Embed KeySigner in Keyring interface — any Keyring adapter must satisfy signing at compile time. Collapses the runtime type assertion kr.(keyring.KeySigner) in Container.KeySigner() to a direct return.
  • Extract metrics.Record helper — replaces the repeated 4-line status/RecordOperation/RecordDuration block across 25 decorator methods (~220 lines saved across auth, transit, and secrets usecase packages).
  • Introduce http.RouterDeps structSetupRouter's 15 positional parameters become named fields, preventing silent handler-swap bugs when adding new handlers.

Test plan

  • make build passes
  • make test passes (all packages green, no regressions)
  • No behaviour change — purely structural refactors

🤖 Generated with Claude Code

allisson and others added 2 commits May 23, 2026 17:41
Four improvements surfaced by an architecture review:

1. Delete auth/service.AuditSigner — a zombie interface left behind when
   AuditLogUseCase was migrated to keyring.KeySigner (ADR-0013). Removes
   the implementation, 456 lines of tests/benchmarks, and 153 lines of
   generated mocks.

2. Embed KeySigner in the Keyring interface so any Keyring adapter must
   satisfy signing at compile time. Collapses the runtime type assertion
   in Container.KeySigner() to a direct return.

3. Extract metrics.Record(ctx, m, domain, op, start, err) into the metrics
   package. Replaces the repeated 4-line status/RecordOperation/
   RecordDuration block across 25 decorator methods (~220 lines saved).

4. Introduce http.RouterDeps struct. SetupRouter's 15 positional parameters
   become named fields, preventing silent handler-swap bugs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signing implementation moved from auth/service/audit_signer.go to
keyring/impl.go in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@allisson allisson merged commit c5a61e5 into main May 23, 2026
3 checks passed
@allisson allisson deleted the improve-codebase branch May 23, 2026 20:48
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