ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision39df94f92b2a33f852481fe1954dabed841524bb
Branchw0-aedt-compliance
Path or archive memberinternal/modules/matching/intelligence/intelligence_test.go
Original SHA-256a380397e17268bc0d1c2a0c0682445af2dcc66afa48a8f64297a686f0f700f46
Git blob SHA495ed7f419e354f1da468c1082310508d7ff3bec
Reading-copy SHA-256a380397e17268bc0d1c2a0c0682445af2dcc66afa48a8f64297a686f0f700f46

Original source ↗

Recovered source transcript

package intelligence import ( "testing" "time" "github.com/missionworkforce/missionmatch/internal/modules/matching/engine" ) // perfect candidate vs a Secret/DISA/5yr requirement => total 100, green. func perfect() (engine.Candidate, engine.Requirement, engine.MatchResult) { c := engine.Candidate{ ID: "c1", Clearance: engine.Clearance{Level: engine.ClearanceTSSCI, Poly: engine.PolyFullScope, Status: engine.StatusActive}, Certifications: []string{"Security+"}, CustomerExperience: []string{"DISA"}, YearsExperience: 10, Available: true, } r := engine.Requirement{ ID: "r1", RequiredLevel: engine.ClearanceSecret, CustomerAgency: "DISA", RequiredCerts: []string{"Security+"}, RequiredYears: 5, KeyPersonnel: true, } return c, r, engine.ScoreCandidate(c, r, nil) } func TestReadinessMapsToMissionLanguage(t *testing.T) { _, _, res := perfect() mr := Readiness(res) if mr.Status != "Mission Ready" || mr.StatusCode != "ready" || mr.Band != "green" { t.Fatalf("expected Mission Ready/green, got %+v", mr) } if mr.Score != "100.00" { t.Fatalf("score = %s, want 100.00", mr.Score) } if len(mr.Categories) != 6 { t.Fatalf("expected 6 readiness categories, got %d", len(mr.Categories)) } want := map[string]bool{ "Clearance Readiness": true, "Skills Readiness": true, "Certification Readiness": true, "Customer Readiness": true, "Experience Readiness": true, "Availability Readiness": true, } for _, cat := range mr.Categories { if !want[cat.Name] { t.Errorf("unexpected category name %q", cat.Name) } if cat.State != "ready" { t.Errorf("category %s state = %s, want ready", cat.Name, cat.State) } } } func TestReadinessStatesAcrossBands(t *testing.T) { // Confidential candidate vs a Secret requirement => clearance 0 (gap), total 75 (yellow). c := engine.Candidate{ID: "c", Clearance: engine.Clearance{Level: engine.ClearanceConfidential, Status: engine.StatusActive}, Available: true} r := engine.Requirement{ID: "r", RequiredLevel: engine.ClearanceSecret} mr := Readiness(engine.ScoreCandidate(c, r, nil)) if mr.StatusCode != "review" { t.Fatalf("expected review, got %s (score %s)", mr.StatusCode, mr.Score) } for _, cat := range mr.Categories { if cat.Name == "Clearance Readiness" && cat.State != "gap" { t.Fatalf("clearance should be a gap, got %s", cat.State) } } } func TestNextStepsByBand(t *testing.T) { _, _, green := perfect() if NextSteps(green)[0].Action != "Move to Candidate Slate" { t.Fatalf("green first step wrong: %+v", NextSteps(green)) } red := engine.ScoreCandidate( engine.Candidate{ID: "c"}, engine.Requirement{ID: "r", RequiredLevel: engine.ClearanceTSSCI}, nil) if NextSteps(red)[0].Action != "Recruit Additional Candidates" { t.Fatalf("red first step wrong: %+v", NextSteps(red)) } } func TestBattleCardStrengthsAndGaps(t *testing.T) { c, r, res := perfect() bc := BattleCardFor(c, r, res) hasStrength := func(sub string) bool { for _, s := range bc.Strengths { if s == sub { return true } } return false } if !hasStrength("TS/SCI Active") { t.Fatalf("expected 'TS/SCI Active' strength, got %v", bc.Strengths) } if !hasStrength("DISA experience") || !hasStrength("Security+") { t.Fatalf("expected DISA + Security+ strengths, got %v", bc.Strengths) } if len(bc.Gaps) != 0 { t.Fatalf("perfect candidate should have no gaps, got %v", bc.Gaps) } // A candidate missing a mandatory skill should surface it as a gap. c2 := engine.Candidate{ID: "c2", Clearance: engine.Clearance{Level: engine.ClearanceSecret, Status: engine.StatusActive}, Available: true} r2 := engine.Requirement{ID: "r2", RequiredLevel: engine.ClearanceSecret, RequiredSkills: []engine.RequiredSkill{{SkillID: "go", Name: "Go", Mandatory: true}}} res2 := engine.ScoreCandidate(c2, r2, nil) bc2 := BattleCardFor(c2, r2, res2) if len(bc2.Gaps) == 0 { t.Fatalf("expected a gap for the missing mandatory skill") } } func TestClearanceIntelligence(t *testing.T) { asOf := time.Date(2026, 6, 23, 0, 0, 0, 0, time.UTC) granted := asOf.AddDate(-3, 0, 0) // 36 months ago expires := asOf.AddDate(0, 1, 0) // not expired ci := Clearance(ClearanceFacts{ Level: engine.ClearanceTSSCI, Poly: engine.PolyFullScope, Status: engine.StatusActive, GrantedAt: &granted, ExpiresAt: &expires, CustomerAgencies: []string{"DISA"}, }, asOf) if ci.Current != "TS/SCI" || !ci.SCIEligible || !ci.FullScopePoly || !ci.CIPolyEligible { t.Fatalf("clearance intel wrong: %+v", ci) } if ci.Expired { t.Fatal("should not be expired") } if ci.InvestigationAgeMonths == nil || *ci.InvestigationAgeMonths != 36 { t.Fatalf("investigation age should be 36 months, got %v", ci.InvestigationAgeMonths) } if !ci.RecentClassifiedSupport { t.Fatal("should have recent classified support (has DISA)") } // expired clearance exp := asOf.AddDate(0, 0, -1) ci2 := Clearance(ClearanceFacts{Level: engine.ClearanceSecret, Status: engine.StatusActive, ExpiresAt: &exp}, asOf) if !ci2.Expired || ci2.SCIEligible { t.Fatalf("expected expired + not SCI eligible, got %+v", ci2) } } func TestContractReadinessAreasAndRisks(t *testing.T) { c, r, res := perfect() asOf := time.Date(2026, 6, 23, 0, 0, 0, 0, time.UTC) soon := asOf.AddDate(0, 0, 30) // expires in 30 days => risk cr := Contract(c, r, res, ClearanceFacts{ExpiresAt: &soon, CustomerAgencies: []string{"DISA"}}, asOf) if len(cr.Areas) != 5 { t.Fatalf("expected 5 contract areas, got %d", len(cr.Areas)) } for _, a := range cr.Areas { if !a.Met { t.Fatalf("perfect candidate should meet area %q", a.Area) } } foundExpiry := false for _, risk := range cr.Risks { if risk.Severity == "warning" && contains(risk.Message, "expires in 30 days") { foundExpiry = true } } if !foundExpiry { t.Fatalf("expected a clearance-expiry risk, got %+v", cr.Risks) } } func TestWinImpact(t *testing.T) { c, r, res := perfect() wi := Win(c, r, res) if wi.LevelCode != "high" || wi.Level != "High Impact" { t.Fatalf("perfect+keypersonnel should be High Impact, got %+v", wi) } if wi.StaffingStrength != "100.00" { t.Fatalf("staffing strength = %s, want 100.00", wi.StaffingStrength) } hasReason := func(sub string) bool { for _, rsn := range wi.Reasons { if rsn == sub { return true } } return false } if !hasReason("Active TS/SCI") || !hasReason("Matches Key Personnel requirements") { t.Fatalf("expected TS/SCI + Key Personnel reasons, got %v", wi.Reasons) } } func contains(s, sub string) bool { return len(s) >= len(sub) && (func() bool { for i := 0; i+len(sub) <= len(s); i++ { if s[i:i+len(sub)] == sub { return true } } return false })() }

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