Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/missionclass/missionclass_test.go |
| Original SHA-256 | a2477045f87fdc904ce0840ada6cf9164c975dc6ac10fdf2e8f3197ab91ecca9 |
| Git blob SHA | b808827380f260a4ac8221cd413bfebe6c31f8e3 |
| Reading-copy SHA-256 | a2477045f87fdc904ce0840ada6cf9164c975dc6ac10fdf2e8f3197ab91ecca9 |
Every recorded occurrence
These 15 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/platform/missionclass/missionclass_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/platform/missionclass/missionclass_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓137 lines · 4.6 KB
package missionclass
import "testing"
// codesOf extracts just the mission codes from a slice of hits, preserving order.
func codesOf(hits []Hit) []string {
out := make([]string, 0, len(hits))
for _, h := range hits {
out = append(out, h.Code)
}
return out
}
// equal reports whether two string slices are identical in length, order, and contents. nil and an
// empty slice compare equal so a no match (nil) matches the want of nil.
func equal(a, b []string) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
func contains(s []string, want string) bool {
for _, v := range s {
if v == want {
return true
}
}
return false
}
func TestClassifyKeyword(t *testing.T) {
cases := []struct {
text string
want []string // mission codes, in Codes order
}{
{"Provide SIGINT collection and COMSEC support", []string{"SIGINT", "COMSEC"}},
{"signals intelligence analysis for the customer", []string{"SIGINT"}},
{"satellite command and control operations", []string{"SAT_C2"}},
{"a cross domain solution accreditation effort", []string{"CDS"}},
{"general administrative support services", nil},
{"", nil},
// bare acronym must not match inside a longer word
{"the cdsa framework", nil},
}
for _, tc := range cases {
got := codesOf(ClassifyKeyword(tc.text))
if !equal(got, tc.want) {
t.Fatalf("ClassifyKeyword(%q) = %v, want %v", tc.text, got, tc.want)
}
}
}
func TestClassifyAlias(t *testing.T) {
idx := NewAliasIndex(map[string]string{
"sigint analyst": "SIGINT",
"signals intelligence": "SIGINT",
"comsec custodian": "COMSEC",
})
got := codesOf(ClassifyAlias("seeking a SIGINT Analyst and a COMSEC Custodian", idx))
want := []string{"SIGINT", "COMSEC"}
if !equal(got, want) {
t.Fatalf("ClassifyAlias = %v, want %v", got, want)
}
// Empty text yields no hit.
if got := ClassifyAlias("", idx); len(got) != 0 {
t.Fatalf("ClassifyAlias of empty text should yield nothing, got %v", got)
}
// The alias mechanism and evidence phrase are recorded for traceability.
hits := ClassifyAlias("hiring a SIGINT Analyst", idx)
if len(hits) != 1 || hits[0].Mechanism != MechAlias || hits[0].Evidence != "sigint analyst" {
t.Fatalf("alias hit must carry the alias mechanism and matched phrase, got %+v", hits)
}
}
func TestClassifyCodes(t *testing.T) {
// The AC PSC prefix (R&D, National Defense) is the one curated mapping: it yields SIGINT and EW.
got := codesOf(ClassifyCodes("AC12", ""))
if !contains(got, "SIGINT") || !contains(got, "EW") {
t.Fatalf("AC PSC prefix must map to SIGINT and EW, got %v", got)
}
if len(got) != 2 {
t.Fatalf("AC PSC prefix must yield exactly the two curated codes, got %v", got)
}
// The hits carry the psc mechanism and the uppercased code as evidence.
for _, h := range ClassifyCodes("ac12", "") {
if h.Mechanism != MechPSC || h.Evidence != "AC12" {
t.Fatalf("psc hit must carry the psc mechanism and uppercased code, got %+v", h)
}
}
// An unknown PSC and NAICS yields no mission rather than a wrong one.
if got := ClassifyCodes("ZZZZ", "999999"); len(got) != 0 {
t.Fatalf("unknown PSC and NAICS should yield no mission, got %v", got)
}
// A deliberately broad NAICS that is intentionally empty yields nothing.
if got := ClassifyCodes("", "541330"); len(got) != 0 {
t.Fatalf("intentionally broad NAICS 541330 must yield no mission, got %v", got)
}
}
func TestClassifyUnion(t *testing.T) {
// "case officer" carries HUMINT in the alias layer but has no keyword form, so the alias mechanism is
// the only path to HUMINT and genuinely wins (it is not shadowed by a keyword hit).
idx := NewAliasIndex(map[string]string{
"case officer": "HUMINT",
})
// A record with a keyword hit (SIGINT), an alias only hit (HUMINT via case officer), and a code hit
// (AC prefix => SIGINT, EW). SIGINT is reached by both keyword and code; the union dedupes by code and
// the keyword mechanism wins because keyword is unioned first.
hits := Classify("SIGINT collection led by a Case Officer", "AC10", "", idx)
got := codesOf(hits)
want := []string{"SIGINT", "HUMINT", "EW"}
if !equal(got, want) {
t.Fatalf("Classify union = %v, want %v", got, want)
}
byCode := map[string]Hit{}
for _, h := range hits {
byCode[h.Code] = h
}
if byCode["SIGINT"].Mechanism != MechKeyword {
t.Fatalf("SIGINT was reached by keyword and code, keyword must win, got %q", byCode["SIGINT"].Mechanism)
}
if byCode["HUMINT"].Mechanism != MechAlias {
t.Fatalf("HUMINT came only from the alias layer, got %q", byCode["HUMINT"].Mechanism)
}
if byCode["EW"].Mechanism != MechPSC {
t.Fatalf("EW came only from the PSC crosswalk, got %q", byCode["EW"].Mechanism)
}
}