Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/integration/federal_signal_integration_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 |
| Branch | ws7-federal-signal |
| Path or archive member | internal/integration/federal_signal_integration_test.go |
| Original SHA-256 | ba1076e0debd90c0c54015420a1cc7dc925159d2ee3ff87a61da3c09ae136628 |
| Git blob SHA | 4ec202981b9ad0a83dd502038a41b161a7569a8a |
| Reading-copy SHA-256 | ba1076e0debd90c0c54015420a1cc7dc925159d2ee3ff87a61da3c09ae136628 |
Every recorded occurrence
These 5 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/integration/federal_signal_integration_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/integration/federal_signal_integration_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/integration/federal_signal_integration_test.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/integration/federal_signal_integration_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/integration/federal_signal_integration_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
Recovered source transcript
Download complete source text ↓145 lines · 5.7 KB
//go:build integration
// WS7 Phase 6 Command Center surfacing: the federal signal panel. Proves the two additive, read only
// views populate from the global catalogs and carry their provenance, the WS7 acceptance criterion that
// every inference is traceable to its source text. OpenByMission returns only the solicitation tagged to
// the requested mission code and never an untagged one; IncumbentMix returns the incumbent labor mix on a
// recompete relevant award with the evidence phrase. Mission tags are never a scoring input and never
// reach the eeo schema; this test only exercises the surfacing.
package integration
import (
"context"
"testing"
"time"
"github.com/jackc/pgx/v5/pgtype"
"github.com/shopspring/decimal"
"github.com/missionworkforce/missionmatch/internal/modules/commandcenter"
"github.com/missionworkforce/missionmatch/internal/platform/database/dbgen"
)
func TestFederalSignalOpenByMission(t *testing.T) {
ctx := context.Background()
org := seedOrg(t)
// Seed two active solicitations through the migrator (the global catalog is migrator written). One is
// tagged SIGINT, the other is left untagged so the filter must exclude it.
stamp := time.Now().UTC().Format("20060102150405.000000")
taggedSrc := "FS-TAG-" + stamp
untaggedSrc := "FS-UNTAG-" + stamp
for _, src := range []string{taggedSrc, untaggedSrc} {
if err := dbgen.New(migrator).UpsertOpportunityRecord(ctx, dbgen.UpsertOpportunityRecordParams{
SourceName: "SAM.gov", SourceRecordID: src, DedupeKey: src, RecordKind: "active_solicitation",
Title: "Cyber support " + src, Agency: "DEPT OF DEFENSE", Naics: "541512", PopState: "HI",
ValueSource: "operator", IsPlanning: false,
PostedDate: pgtype.Date{Time: time.Now().UTC(), Valid: true}, FetchedAt: time.Now().UTC(),
RawObjectKey: "opportunity_records/sam.gov/" + src + ".json", RawSha256: "deadbeef",
}); err != nil {
t.Fatalf("seed solicitation %s: %v", src, err)
}
}
// Resolve the generated uuid for the tagged record and write a SIGINT federal_mission_tag (global,
// migrator owned). federal_mission_tags keys on record_id as the text form of the uuid.
var taggedID, untaggedID string
if err := migrator.QueryRow(ctx,
"SELECT id::text FROM opportunity_records WHERE source_record_id=$1", taggedSrc).Scan(&taggedID); err != nil {
t.Fatalf("resolve tagged id: %v", err)
}
if err := migrator.QueryRow(ctx,
"SELECT id::text FROM opportunity_records WHERE source_record_id=$1", untaggedSrc).Scan(&untaggedID); err != nil {
t.Fatalf("resolve untagged id: %v", err)
}
if err := dbgen.New(migrator).UpsertFederalMissionTag(ctx, dbgen.UpsertFederalMissionTagParams{
RecordTable: "opportunity_records", RecordID: taggedID, MissionCode: "SIGINT",
Mechanism: "keyword", Evidence: "signals intelligence",
Confidence: decimal.RequireFromString("1.00"),
}); err != nil {
t.Fatalf("write federal mission tag: %v", err)
}
svc := commandcenter.NewService(appDB)
v, err := svc.FederalSignal(ctxOrg(org), "SIGINT")
if err != nil {
t.Fatalf("FederalSignal SIGINT: %v", err)
}
sawTagged, sawUntagged := false, false
for _, o := range v.OpenByMission {
if o.RecordID == taggedID {
sawTagged = true
if o.MissionCode != "SIGINT" || o.MissionMechanism != "keyword" || o.MissionEvidence != "signals intelligence" {
t.Fatalf("tagged solicitation missing provenance: %+v", o)
}
}
if o.RecordID == untaggedID {
sawUntagged = true
}
}
if !sawTagged {
t.Fatal("OpenByMission(SIGINT) must return the SIGINT tagged solicitation")
}
if sawUntagged {
t.Fatal("OpenByMission(SIGINT) must NOT return the untagged solicitation")
}
// An unknown mission code is rejected, never silently returning everything.
if _, err := svc.FederalSignal(ctxOrg(org), "NOPE"); err == nil {
t.Fatal("FederalSignal must reject an unknown mission code")
}
}
func TestFederalSignalIncumbentMix(t *testing.T) {
ctx := context.Background()
org := seedOrg(t)
// Seed a USASpending award with a period of performance that is ending (the recompete signal) and one
// incumbent labor role with an evidence phrase. The award catalog and the role table are global and
// migrator written.
awardID := "FS-AWD-" + time.Now().UTC().Format("20060102150405.000000")
amt := decimal.RequireFromString("3200000.00")
if _, err := migrator.Exec(ctx,
`INSERT INTO usaspending_awards
(generated_internal_id, recipient_name, awarding_agency, naics_code, award_amount, pop_end_date, raw)
VALUES ($1, $2, $3, $4, $5, $6, '{}'::jsonb)`,
awardID, "Acme Defense LLC", "DEPT OF THE AIR FORCE", "541512", amt,
time.Now().UTC().AddDate(0, 3, 0)); err != nil {
t.Fatalf("seed award: %v", err)
}
if err := dbgen.New(migrator).UpsertAwardIncumbentRole(ctx, dbgen.UpsertAwardIncumbentRoleParams{
RecordTable: "usaspending_awards", RecordID: awardID, LaborCategory: "SIGINT Analyst",
RoleCount: 3, Evidence: "SIGINT Analyst x3",
}); err != nil {
t.Fatalf("write incumbent role: %v", err)
}
svc := commandcenter.NewService(appDB)
v, err := svc.FederalSignal(ctxOrg(org), "")
if err != nil {
t.Fatalf("FederalSignal incumbent mix: %v", err)
}
found := false
for _, a := range v.IncumbentMix {
if a.RecordID != awardID {
continue
}
found = true
if a.RecipientName != "Acme Defense LLC" || a.Source != "USASpending" {
t.Fatalf("award identity wrong: %+v", a)
}
if a.AwardValue == nil || *a.AwardValue != "3200000.00" {
t.Fatalf("award value not rendered: %v", a.AwardValue)
}
if len(a.Roles) != 1 || a.Roles[0].LaborCategory != "SIGINT Analyst" ||
a.Roles[0].RoleCount != 3 || a.Roles[0].Evidence != "SIGINT Analyst x3" {
t.Fatalf("incumbent role or evidence wrong: %+v", a.Roles)
}
}
if !found {
t.Fatal("IncumbentMix must return the seeded recompete relevant award with its incumbent role")
}
}