Repository navigation
refactor: restructure layers and close the leaks it surfaced - #1
Merged
Merged
Conversation
…ends on internal/config
…plates are comments only
…unused repository methods
…the rest with a generic 500
…ed, and refresh the README layout
…afe errors to pkg/clienterr
…atus or plan changes
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.
Restructures the repository so each layer has one name and one place, and fixes the security bugs the restructuring surfaced. Every fix has a test that fails when the fix is reverted.
Security
CreateTenantskipped the platform permission. REST checked it in a route middleware; the gRPC interceptor only checks membership of the caller's own tenant, so withGRPC_ADDRset any member of any tenant, a viewer included, could create tenants. The check now lives ininternal/usecase/operation, which both ports call.TenantScopeand 25 handler paths in the control plane, plus 57 inexamples/verticals, wroteerr.Error(), so an outage returned the driver message with host and port, often under a 404 or 403. Client-safe errors are nowpkg/clienterr;internal/handler/respondanswers anything else with a logged, generic 500 on its own, independent of the app's error handler. The checkout.com adapter's raw provider response no longer reaches the browser.Structure
internal/usecase/registry, DTOs next to their handlers.ListUsers) still call the repository directly; ADR-0009 records why and when that stops being true.pkg/databasemoved tointernal/database(it importedinternal/config). An architecture test now forbidspkg/importinginternal/.go:embed. The container image never copiedtemplates/, so any template with real SQL would have been skipped silently.Dockerfileat the root, swagger page underapi/docs, k6 profile inscripts/.projectexample module (never mounted), and about 60 unreachable functions found withdeadcodeandstaticcheck.Behaviour changes
examples/verticalsanswer 500 instead of 400 on database or provider failures. User-facing payment errors keep their message.Verification
go test -race ./...against real PostgreSQL (26 packages),gofmt,go vet,staticcheck -checks U1000,scripts/langcheck.py, and a Docker build.