ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/integration/hybrid_search_tagged_integration_test.go
Original SHA-256a64bca25c2d0a483eca536d5231906662eca54f82f77cc178f307948df2e1b49
Git blob SHA3bfda9042be0cdf3c202fe0c493eb9219d8a0978
Reading-copy SHA-256a64bca25c2d0a483eca536d5231906662eca54f82f77cc178f307948df2e1b49

Original source ↗

Every recorded occurrence

These 15 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/integration/hybrid_search_tagged_integration_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

//go:build integration // WS7 structured mission scoped retrieval, exercised against a REAL Postgres with pgvector, full text, and // RLS in force. It proves SearchCandidatesHybridMissionTagged gates retrieval on the structured // candidate_mission_tags predicate, not on candidate text: it seeds two org A candidates whose text would // BOTH satisfy the WS6 search_tsv mission filter, tags only ONE of them SIGINT in candidate_mission_tags // (written through the APP pool under org A's context, so the write is RLS scoped), embeds both, runs the // tagged query, and asserts ONLY the tagged candidate returns. A second org's tagged candidate must never // leak. This mirrors TestHybridSearchMissionScopeExecutes but for the WS7 structured path. Mission tags are // never a scoring input and never reach the eeo schema; this test only exercises retrieval scoping and the // tenancy guarantee. It tests the query directly via dbgen with a deterministic embedding, so it needs no // inference client. package integration import ( "context" "testing" "github.com/google/uuid" "github.com/jackc/pgx/v5" "github.com/pgvector/pgvector-go" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" "github.com/missionworkforce/missionmatch/internal/platform/embeddings" ) func TestSearchCandidatesHybridMissionTaggedStructuredScope(t *testing.T) { orgA, orgB := seedOrg(t), seedOrg(t) emb := embeddings.NewDeterministic(384) // seedTagged seeds a candidate via the migrator (so the headline is set) and returns its id. The headline // deliberately contains the SIGINT keyword for EVERY seeded candidate, so the WS6 text filter would match // all of them; only the structured tag, applied selectively below, should narrow the WS7 result. seed := func(org uuid.UUID, name string) uuid.UUID { vec, _ := emb.Embed(context.Background(), name+" intelligence analyst") pv := pgvector.NewVector(vec) hn := "SIGINT collection and analysis" c, err := dbgen.New(migrator).CreateCandidate(context.Background(), dbgen.CreateCandidateParams{ OrganizationID: org, FullName: name, Headline: &hn, ClearanceLevel: "top_secret", ClearancePoly: "none", ClearanceStatus: "active", Available: true, ResumeEmbedding: &pv, }) if err != nil { t.Fatalf("seed candidate %q: %v", name, err) } return c.ID } taggedA := seed(orgA, "Alice Tagged") // org A, will be tagged SIGINT untaggedA := seed(orgA, "Bob Untagged") // org A, NOT tagged, must be excluded by the structured gate foreignB := seed(orgB, "Eve Foreign") // org B, tagged SIGINT, must never leak into org A's scope // Tag only Alice (org A) and Eve (org B) through the APP pool under each org's own context, so each write // is RLS scoped to that org. tag := func(org, cand uuid.UUID) { if err := appDB.RunInTenantTx(ctxOrg(org), func(ctx context.Context, tx pgx.Tx) error { return dbgen.New(tx).UpsertCandidateMissionTag(ctx, dbgen.UpsertCandidateMissionTagParams{ OrganizationID: org, CandidateID: cand, MissionCode: "SIGINT", Mechanism: "keyword", Evidence: "signals intelligence", }) }); err != nil { t.Fatalf("tag candidate %s for org %s: %v", cand, org, err) } } tag(orgA, taggedA) tag(orgB, foreignB) qv := pgvector.NewVector(mustEmbed(emb, "intelligence analyst")) var rows []dbgen.SearchCandidatesHybridMissionTaggedRow err := appDB.RunInTenantTx(ctxOrg(orgA), func(ctx context.Context, tx pgx.Tx) error { if _, e := tx.Exec(ctx, "SET LOCAL hnsw.ef_search = 200"); e != nil { return e } var e error rows, e = dbgen.New(tx).SearchCandidatesHybridMissionTagged(ctx, dbgen.SearchCandidatesHybridMissionTaggedParams{ QueryVector: qv, RowLimit: 10, TextQuery: "intelligence analyst", MissionCode: "SIGINT", }) return e }) if err != nil { t.Fatalf("structured tagged hybrid search failed: %v", err) } // Exactly the one tagged org A candidate returns: the untagged org A candidate is excluded by the // structured gate even though its text matches, and org B's tagged candidate is hidden by RLS. if len(rows) != 1 { names := make([]string, len(rows)) for i, r := range rows { names[i] = r.FullName } t.Fatalf("structured tagged scope returned %d rows %v, want exactly the 1 tagged candidate", len(rows), names) } got := rows[0] if got.ID != taggedA { t.Fatalf("structured tagged scope returned %s (%s), want the tagged candidate %s", got.FullName, got.ID, taggedA) } if got.OrganizationID != orgA { t.Fatalf("structured tagged scope leaked a foreign tenant row: %s (%s)", got.FullName, got.OrganizationID) } if got.ID == untaggedA { t.Fatal("structured tagged scope returned the UNTAGGED org A candidate, the structured gate did not apply") } if got.ID == foreignB { t.Fatal("ISOLATION BREACH: structured tagged scope returned org B's tagged candidate") } // The probe the retrieval branch uses must see org A's tag (so the structured path is chosen) and zero // for an untagged third org (so an un backfilled tenant takes the WS6 fallback). var nA int64 if err := appDB.RunInTenantTx(ctxOrg(orgA), func(ctx context.Context, tx pgx.Tx) error { var e error nA, e = dbgen.New(tx).CountCandidateMissionTags(ctx) return e }); err != nil { t.Fatalf("org A count probe: %v", err) } if nA < 1 { t.Fatalf("CountCandidateMissionTags for org A = %d, want at least 1 so the structured path is chosen", nA) } orgC := seedOrg(t) var nC int64 if err := appDB.RunInTenantTx(ctxOrg(orgC), func(ctx context.Context, tx pgx.Tx) error { var e error nC, e = dbgen.New(tx).CountCandidateMissionTags(ctx) return e }); err != nil { t.Fatalf("org C count probe: %v", err) } if nC != 0 { t.Fatalf("CountCandidateMissionTags for an untagged org = %d, want 0 so it falls back to the WS6 text filter", nC) } }

Search equations, builds, manuscript text, and recovered sources.