// Command verify-resolver loads the deterministic alias and relationship resolver against a database and // proves that a curated alias and a curated relationship resolve end to end. It is the live counterpart // to the resolver unit tests, which inject the maps directly: this exercises the real DB load (the // skills, skill_aliases, and skill_relationships queries, including the numeric strength scan). Read only. // // Usage: verify-resolver -dsn package main import ( "context" "flag" "fmt" "log" "os" "github.com/missionworkforce/missionmatch/internal/modules/matching" "github.com/missionworkforce/missionmatch/internal/modules/matching/engine" "github.com/missionworkforce/missionmatch/internal/platform/database" "github.com/missionworkforce/missionmatch/internal/platform/tenant" ) func main() { dsn := flag.String("dsn", os.Getenv("MM_APP_DATABASE_URL"), "database DSN (app or migrator)") flag.Parse() if *dsn == "" { log.Fatal("verify-resolver: -dsn is required") } ctx := context.Background() pool, err := database.NewPool(ctx, *dsn) if err != nil { log.Fatalf("db: %v", err) } defer pool.Close() resolver := matching.NewDeterministicAliasResolver(tenant.New(pool)) failed := false // Alias: a candidate holding Signals Intelligence resolves a SIGINT requirement (exact, similarity 1.0). probe(ctx, resolver, "alias SIGINT", engine.RequiredSkill{Name: "SIGINT"}, "Signals Intelligence", true, &failed) // Relationship: OpenShift substitutes_for Kubernetes, a partial credit at the curated strength. probe(ctx, resolver, "rel OpenShift to Kubernetes", engine.RequiredSkill{Name: "Kubernetes"}, "OpenShift", false, &failed) if failed { fmt.Println("VERIFY-RESOLVER: FAIL") os.Exit(1) } fmt.Println("VERIFY-RESOLVER: PASS (the resolver loaded the curated layer and resolved both probes)") } func probe(ctx context.Context, r *matching.DeterministicAliasResolver, label string, req engine.RequiredSkill, candName string, wantAlias bool, failed *bool) { m, ok := r.ResolveAlias(ctx, req, []engine.CandidateSkill{{Name: candName}}) if !ok || !m.Matched { fmt.Printf(" %-28s FAIL (no match for candidate %q)\n", label, candName) *failed = true return } fmt.Printf(" %-28s matched: similarity=%s exact=%v aliasMatched=%v\n", label, m.Similarity.String(), m.Exact, m.AliasMatched) if wantAlias && !m.AliasMatched { fmt.Printf(" %-28s FAIL (expected an alias sourced match)\n", label) *failed = true } }