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 <noreply@anthropic.com>
This commit is contained in:
prateek 2026-06-01 03:38:23 +05:30 committed by itrytoohard
parent 28e1205d28
commit 42eab57d49
1 changed files with 9 additions and 0 deletions

View File

@ -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()