refactor: deepen Keyring seam and remove dead weight#128
Merged
Conversation
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>
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.
Summary
auth/service.AuditSigner— zombie interface left behind whenAuditLogUseCasemigrated tokeyring.KeySigner(ADR-0013). Removes the implementation, 456 lines of tests/benchmarks, and 153 lines of generated mocks. Signing now has one canonical home.KeySignerinKeyringinterface — anyKeyringadapter must satisfy signing at compile time. Collapses the runtime type assertionkr.(keyring.KeySigner)inContainer.KeySigner()to a direct return.metrics.Recordhelper — replaces the repeated 4-linestatus/RecordOperation/RecordDurationblock across 25 decorator methods (~220 lines saved acrossauth,transit, andsecretsusecase packages).http.RouterDepsstruct —SetupRouter's 15 positional parameters become named fields, preventing silent handler-swap bugs when adding new handlers.Test plan
make buildpassesmake testpasses (all packages green, no regressions)🤖 Generated with Claude Code