From 42eab57d49f4de654c1bbf26038d13ac054aca08 Mon Sep 17 00:00:00 2001 From: prateek Date: Mon, 1 Jun 2026 03:38:23 +0530 Subject: [PATCH] refactor(storage): add compile-time port guards on *Store Re-add the blank-identifier interface assertions lost when wiring.Adapter was collapsed: *Store now directly satisfies ports.SessionStore and ports.PRWriter, so prove it at the point of definition. Drift between either port and the implementation now fails here instead of at the call sites in lifecycle_wiring or tests. Addresses greptile review comment on #60. Co-Authored-By: Claude Opus 4.8 --- backend/internal/storage/sqlite/pr_store.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/internal/storage/sqlite/pr_store.go b/backend/internal/storage/sqlite/pr_store.go index e23626240..1d57b40d4 100644 --- a/backend/internal/storage/sqlite/pr_store.go +++ b/backend/internal/storage/sqlite/pr_store.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/aoagents/agent-orchestrator/backend/internal/domain" + "github.com/aoagents/agent-orchestrator/backend/internal/ports" "github.com/aoagents/agent-orchestrator/backend/internal/storage/sqlite/gen" ) @@ -17,6 +18,14 @@ import ( // "nothing known yet" value (matching the CHECK constraints), and ints widen to // int64. +// Compile-time proof that *Store satisfies both ports it is wired into, so a +// drift between either interface and this implementation fails here at the point +// of definition rather than later at the call sites in lifecycle_wiring / tests. +var ( + _ ports.SessionStore = (*Store)(nil) + _ ports.PRWriter = (*Store)(nil) +) + // UpsertPR inserts or replaces the scalar PR facts for a PR URL. func (s *Store) UpsertPR(ctx context.Context, r domain.PRRow) error { s.writeMu.Lock()