ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/integration/tenant_mission_tag_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/tenant_mission_tag_integration_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/integration/tenant_mission_tag_integration_test.go
Original SHA-256dbd038f155b8db51609dc63062781c04f4162a2ebe14a2c19081e63e0c54a918
Git blob SHA2a4e072ff76bd284e27d40137db9b48599456508
Reading-copy SHA-256dbd038f155b8db51609dc63062781c04f4162a2ebe14a2c19081e63e0c54a918

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/tenant_mission_tag_integration_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/integration/tenant_mission_tag_integration_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

//go:build integration // Phase 5a tenant mission tagging, exercised against a REAL Postgres with RLS in force. It seeds an org // with a candidate whose headline mentions SIGINT, runs the tenant tagging service inside that org's // context (so every read and write goes through RunInTenantTx as the NOBYPASSRLS application role), and // asserts a candidate_mission_tags row with code SIGINT exists for that org and that a second org cannot // see it (RLS isolation). Mission tags are never a scoring input and never reach the eeo schema; this test // exercises the tagging service end to end and the tenancy guarantee, complementing the static // mission_tags_integration_test which exercises the raw upsert. package integration import ( "context" "testing" "github.com/jackc/pgx/v5" "github.com/missionworkforce/missionmatch/internal/modules/federalsignal" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" "github.com/missionworkforce/missionmatch/internal/platform/missionclass" ) func TestTenantTagServiceTagsCandidatesUnderRLS(t *testing.T) { orgA, orgB := seedOrg(t), seedOrg(t) // org A candidate whose headline mentions SIGINT, seeded via the migrator so the headline is set. hn := "SIGINT collection analyst" candA, err := dbgen.New(migrator).CreateCandidate(context.Background(), dbgen.CreateCandidateParams{ OrganizationID: orgA, FullName: "Alice Analyst", Headline: &hn, ClearanceLevel: "top_secret", ClearancePoly: "none", ClearanceStatus: "active", Available: true, }) if err != nil { t.Fatalf("seed org A candidate: %v", err) } // An empty AliasIndex: the SIGINT tag comes from the literal keyword in the headline, so this test does // not depend on the curated alias rows being present in the database under test. idx := missionclass.NewAliasIndex(map[string]string{}) svc := federalsignal.NewTenantTagService(federalsignal.NewTenantTagRepo(appDB), idx) // Tag org A's candidates in org A's context. Every read and write runs as the app role under RLS. res, err := svc.TagCandidatesForOrg(ctxOrg(orgA)) if err != nil { t.Fatalf("TagCandidatesForOrg (org A): %v", err) } if res.CandidatesScanned < 1 || res.CandidateTags < 1 { t.Fatalf("org A tagging produced no tags: %+v", res) } // Org A MUST see exactly one SIGINT tag for its candidate, with the keyword mechanism. var code, mechanism string if err := appDB.RunInTenantTx(ctxOrg(orgA), func(ctx context.Context, tx pgx.Tx) error { return tx.QueryRow(ctx, "SELECT mission_code, mechanism FROM candidate_mission_tags WHERE candidate_id = $1 AND mission_code = 'SIGINT'", candA.ID).Scan(&code, &mechanism) }); err != nil { t.Fatalf("org A read SIGINT tag: %v", err) } if code != "SIGINT" || mechanism != missionclass.MechKeyword { t.Fatalf("org A SIGINT tag = code %q mechanism %q, want SIGINT/keyword", code, mechanism) } // Org B MUST NOT see org A's tag: a count under org B's session is zero (RLS default deny). var nB int if err := appDB.RunInTenantTx(ctxOrg(orgB), func(ctx context.Context, tx pgx.Tx) error { return tx.QueryRow(ctx, "SELECT count(*) FROM candidate_mission_tags WHERE candidate_id = $1", candA.ID).Scan(&nB) }); err != nil { t.Fatalf("org B count tags: %v", err) } if nB != 0 { t.Fatalf("ISOLATION BREACH: org B saw %d of org A's candidate mission tags (want 0)", nB) } // And running the tagging service in org B's context tags nothing of org A's: org B has no candidates, // so the read returns zero rows and the write set is empty, proving the service is fully RLS scoped. resB, err := svc.TagCandidatesForOrg(ctxOrg(orgB)) if err != nil { t.Fatalf("TagCandidatesForOrg (org B): %v", err) } if resB.CandidatesScanned != 0 || resB.CandidateTags != 0 { t.Fatalf("org B tagging should scan and tag nothing (org A's candidate is invisible), got %+v", resB) } // Idempotency against the live database: a second run in org A keeps exactly one SIGINT tag. if _, err := svc.TagCandidatesForOrg(ctxOrg(orgA)); err != nil { t.Fatalf("second TagCandidatesForOrg (org A): %v", err) } var nA int if err := appDB.RunInTenantTx(ctxOrg(orgA), func(ctx context.Context, tx pgx.Tx) error { return tx.QueryRow(ctx, "SELECT count(*) FROM candidate_mission_tags WHERE candidate_id = $1 AND mission_code = 'SIGINT'", candA.ID).Scan(&nA) }); err != nil { t.Fatalf("org A recount SIGINT tag: %v", err) } if nA != 1 { t.Fatalf("idempotency broken: org A has %d SIGINT tags after a second run (want 1)", nA) } }

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