Skip to content

refactor: deepen module seams — inline SHA256, add NullSigner, move repository interfaces to domain#137

Merged
allisson merged 1 commit into
mainfrom
improve-codebase
May 26, 2026
Merged

refactor: deepen module seams — inline SHA256, add NullSigner, move repository interfaces to domain#137
allisson merged 1 commit into
mainfrom
improve-codebase

Conversation

@allisson
Copy link
Copy Markdown
Owner

Summary

  • Candidate 1: Delete SHA256HashService shallow interface and inline the hash function as a private tokenValueHash helper in tokenizationUseCase. The interface was a pass-through with zero leverage; tests now exercise the real hash path instead of mocking it.
  • Candidate 2: Add keyring.NullSigner{} as an explicit no-op KeySigner for tests, and remove the silent nil-guard in AuditLogUseCase. Integration test legacy-log scenarios now insert rows directly via the repository — correctly modelling pre-signing-era data.
  • Candidate 3: Move repository interfaces (SecretRepository, TokenizationKeyRepository, TokenRepository, ClientRepository, AuditLogRepository) from usecase packages into their corresponding domain packages, following the pattern established by transit/domain. Remove the TransitKeyRepository type alias from transit/usecase. All usecase implementations and DI wiring updated.

Test plan

  • make test passes (1176 tests, 42 packages)
  • go vet ./... clean
  • make test-integration against a live database

🤖 Generated with Claude Code

…epository interfaces to domain

Three independent architectural improvements:

1. Delete SHA256HashService shallow interface and inline the hash function
   directly into tokenizationUseCase as a private tokenValueHash helper.
   The interface was a pass-through with no leverage; inlining gives callers
   real hash values in tests instead of mocked stubs.

2. Add keyring.NullSigner{} as an explicit no-op KeySigner for tests that
   do not exercise signing behaviour, and remove the silent nil-guard code
   path in AuditLogUseCase. Legacy unsigned audit logs in integration tests
   are now written directly via the repository, correctly modelling data
   that predates the signing feature.

3. Move repository interfaces (SecretRepository, TokenizationKeyRepository,
   TokenRepository, ClientRepository, AuditLogRepository) from usecase
   packages into their corresponding domain packages, following the
   pattern already established by transit/domain. Remove the
   TransitKeyRepository type alias from transit/usecase. All usecase
   implementations and DI wiring updated to use the domain-qualified names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@allisson allisson merged commit bb84bdb into main May 26, 2026
@allisson allisson deleted the improve-codebase branch May 26, 2026 13:35
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