Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 09015496d565a172bcaa15cfe9a8e4b072b13df0 |
| Branch | workstream-b-screenmatch |
| Path or archive member | internal/modules/matching/intelligence/intelligence_test.go |
| Original SHA-256 | 1062239778179876be65caac9ada7da3c99818a774706aa38d9b8e604235b170 |
| Git blob SHA | 2b65117af1bed16f46d9b873e0e7a84113e211d9 |
| Reading-copy SHA-256 | 1062239778179876be65caac9ada7da3c99818a774706aa38d9b8e604235b170 |
Every recorded occurrence
These 35 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/modules/matching/intelligence/intelligence_test.go | workstream-b-screenmatch | 09015496d565a172bcaa15cfe9a8e4b072b13df0 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-a-opportunity-intelligence | 1675031db74316e100782d063e9eda1a597fe3a1 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-d-command-center | 255e7d1d420abf5e277d0cd8c9b14f6f72b6acb9 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-d-missionmatch | 3be46ba89edb737182075a2b320509b42dc916f8 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-e-dataflow-deploy | 433815a042f9741411e60fa553fe72143e9b10db | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | w3-ai-staffing-recommendations | 43d56387270ef4da4cabd794d97ca6a49909bc7d | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-e-commercial-stubs | 4437da660539284a400ee380b9b427a300c369ee | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-c-slatematch | 5cd60c918301b46ecd6ed3e03e20c395da0062e2 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ai-intelligence-layer | 5d5ddff70393a197c5f54a45280bb5dd42b24755 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | per-tenant-routing | 9bde0f9a74b89d01980fa658e5253acda7528d0c | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ai-brain-live | aac32fc49c878cc5bca099459307611562d0bac1 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ws1-ontology-sync | b596f449a32a1016fbd403c36505cc00a1ac9ee6 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ruthless-debug-sweep | b7d742f8f032984be3817efffa3eb8b13b651c1f | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | deploy-and-ops | bdacd9d0b4d5998d25fc74bf4007f4c3ec538c7a | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-b-sam-contract-awards | d5101cceb98e70000cebb31d3e7ac73d747d3a6d | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-a-shared-core | e0de03ac3a1ec826bd15d0e048e3b02baa23eeff | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ws2-alias-relationship | e4dada4601c6eb101830f9d223a9655dfa120616 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | per-tenant-routing | 9bde0f9a74b89d01980fa658e5253acda7528d0c | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-a-shared-core | e0de03ac3a1ec826bd15d0e048e3b02baa23eeff | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-c-slatematch | 5cd60c918301b46ecd6ed3e03e20c395da0062e2 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ws1-ontology-sync | b596f449a32a1016fbd403c36505cc00a1ac9ee6 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | w3-ai-staffing-recommendations | 43d56387270ef4da4cabd794d97ca6a49909bc7d | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-d-command-center | 255e7d1d420abf5e277d0cd8c9b14f6f72b6acb9 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-e-dataflow-deploy | 433815a042f9741411e60fa553fe72143e9b10db | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ruthless-debug-sweep | b7d742f8f032984be3817efffa3eb8b13b651c1f | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ai-intelligence-layer | 5d5ddff70393a197c5f54a45280bb5dd42b24755 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-a-opportunity-intelligence | 1675031db74316e100782d063e9eda1a597fe3a1 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | deploy-and-ops | bdacd9d0b4d5998d25fc74bf4007f4c3ec538c7a | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-b-screenmatch | 09015496d565a172bcaa15cfe9a8e4b072b13df0 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-e-commercial-stubs | 4437da660539284a400ee380b9b427a300c369ee | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | ai-brain-live | aac32fc49c878cc5bca099459307611562d0bac1 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-d-missionmatch | 3be46ba89edb737182075a2b320509b42dc916f8 | Open original |
| Janady13/missionmatch / internal/modules/matching/intelligence/intelligence_test.go | workstream-b-sam-contract-awards | d5101cceb98e70000cebb31d3e7ac73d747d3a6d | Open original |
Recovered source transcript
Download complete source text ↓199 lines · 6.7 KB
package intelligence
import (
"context"
"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(context.Background(), 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(context.Background(), 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(context.Background(),
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(context.Background(), 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
})()
}