ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/ai/graph_wage_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/ai/graph_wage_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/ai/graph_wage_test.go
Original SHA-25697de34c8ed26bb934ab7c0dffaa842afd04ff14a56f79a97c799ea682f18a064
Git blob SHAaa78b218b62d717b6dd31faf2d3f410f8c1da268
Reading-copy SHA-25697de34c8ed26bb934ab7c0dffaa842afd04ff14a56f79a97c799ea682f18a064

Original source ↗

Every recorded occurrence

These 11 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/modules/ai/graph_wage_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package ai import ( "strings" "testing" "github.com/shopspring/decimal" ) // TestResolveAreaMapsKnownStates pins the conservative area resolver: a work_location naming Hawaii, HI, or a // Hawaii city maps to HI; New Mexico, NM, or a New Mexico city maps to NM; an unknown state maps to nothing so // the honest floor holds. The two letter abbreviation is matched only as a delimited token so a stray // substring never false matches. func TestResolveAreaMapsKnownStates(t *testing.T) { cases := []struct { in string wantArea string wantOK bool }{ {"Honolulu, Hawaii", "HI", true}, {"Honolulu, HI", "HI", true}, {"hawaii", "HI", true}, {"Pearl Harbor, HI", "HI", true}, {"Albuquerque, New Mexico", "NM", true}, {"Kirtland AFB, NM", "NM", true}, {"new mexico", "NM", true}, {"Fort Bragg, NC", "", false}, {"Arlington, Virginia", "", false}, {"Remote", "", false}, {"", "", false}, // A stray "hi" or "nm" inside a longer word must NOT false match (delimited token only). {"Chicago, IL", "", false}, {"Manhattan, NY", "", false}, } for _, c := range cases { gotArea, gotOK := resolveArea(c.in) if gotArea != c.wantArea || gotOK != c.wantOK { t.Errorf("resolveArea(%q) = (%q, %v), want (%q, %v)", c.in, gotArea, gotOK, c.wantArea, c.wantOK) } } } // TestResolveSOCMatchesTheCuratedCrosswalk pins the conservative role to SOC resolver over the existing // bls.GalapagosOccupations crosswalk: a title naming a Galapagos role or the OEWS occupation title resolves to // that occupation's SOC; an unmatchable title resolves to nothing so the honest floor holds. It reuses the ONE // curated crosswalk, never inventing a new one. func TestResolveSOCMatchesTheCuratedCrosswalk(t *testing.T) { cases := []struct { title string wantSOC string wantOK bool }{ {"Program Manager", "113021", true}, {"Senior Program Manager, Space Systems", "113021", true}, {"Systems Engineer", "151252", true}, {"ISSO and Cyber", "151212", true}, {"Information Security Analysts", "151212", true}, // matches by OEWS title {"Help Desk and IT Specialist", "151232", true}, {"Space and Cyber Architect", "151241", true}, {"Janitor", "", false}, {"Registered Nurse", "", false}, {"", "", false}, } for _, c := range cases { occ, ok := resolveSOC(c.title) if ok != c.wantOK { t.Errorf("resolveSOC(%q) ok = %v, want %v", c.title, ok, c.wantOK) continue } if ok && occ.SOC != c.wantSOC { t.Errorf("resolveSOC(%q) SOC = %q, want %q", c.title, occ.SOC, c.wantSOC) } } } // TestResolveSOCBroadenedMatchesTheIngestedOEWSSet pins the broadened, conservative title to SOC resolver // over an in memory ingested national OEWS occupation set (the M5 Phase 1 expansion beyond the five curated // Galapagos roles). A requirement title that contains exactly one OEWS occupation title resolves to that // SOC; the LONGEST occupation title wins when several overlap (the most specific occupation); a title that // matches two DIFFERENT SOCs at the same longest length is ambiguous and returns false so the honest floor // holds; an unmatchable title and an empty occupation set return false. It never fabricates a SOC. func TestResolveSOCBroadenedMatchesTheIngestedOEWSSet(t *testing.T) { occs := []nationalOccupation{ {SOC: "151212", Title: "Information Security Analysts"}, {SOC: "151252", Title: "Software Developers"}, {SOC: "172112", Title: "Industrial Engineers"}, {SOC: "172141", Title: "Mechanical Engineers"}, {SOC: "119041", Title: "Architectural and Engineering Managers"}, } cases := []struct { name string title string wantSOC string wantOK bool }{ {"contains one occupation title", "Senior Information Security Analysts, Cyber", "151212", true}, {"exact occupation title", "Mechanical Engineers", "172141", true}, {"longest match wins over a shorter contained span", "Architectural and Engineering Managers", "119041", true}, {"unmatchable title keeps the floor", "Underwater Basket Weaver", "", false}, {"empty title returns false", "", "", false}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { occ, ok := resolveSOCBroadened(c.title, occs) if ok != c.wantOK { t.Fatalf("resolveSOCBroadened(%q) ok = %v, want %v", c.title, ok, c.wantOK) } if ok && occ.SOC != c.wantSOC { t.Errorf("resolveSOCBroadened(%q) SOC = %q, want %q", c.title, occ.SOC, c.wantSOC) } }) } // An ambiguous title that matches two DIFFERENT SOCs at the same longest length returns false. Both // "Data Scientists" entries below share the same title length but distinct SOCs, so the tie degrades to // the honest floor rather than binding one arbitrarily. ambiguous := []nationalOccupation{ {SOC: "152051", Title: "Data Scientists"}, {SOC: "152098", Title: "Data Scientists"}, } if _, ok := resolveSOCBroadened("Senior Data Scientists", ambiguous); ok { t.Error("a title matching two different SOCs at the same length must return false") } // An empty occupation set returns false (an unpopulated catalog degrades to the honest floor). if _, ok := resolveSOCBroadened("Mechanical Engineers", nil); ok { t.Error("an empty occupation set must return false") } } // TestNationalOccupationsSQLPassesTheReadOnlyGuard proves the broadened national occupation read passes // GuardReadOnlyQuery against the real ReadAllowlist: a single read over the allowlisted bls_wages table with // no mutating keyword, the same gate the wage band read passes. func TestNationalOccupationsSQLPassesTheReadOnlyGuard(t *testing.T) { if err := GuardReadOnlyQuery(nationalOccupationsSQL, ReadAllowlist); err != nil { t.Fatalf("the national occupations SQL must pass the read only guard: %v", err) } } // TestCapturePriceToWinLineFallsBackToOccupationTitleForNational proves the surfaced line names the OEWS // occupation title when the band carries an empty role (the national rows), so a national band still names // its occupation, and it names United States as the area. It carries no dash in surfaced prose. func TestCapturePriceToWinLineFallsBackToOccupationTitleForNational(t *testing.T) { band := WageBand{ SOC: "172141", OccupationTitle: "Mechanical Engineers", Role: "", // a national row carries no Galapagos role Area: "US", AreaName: "United States", AnnualMean: decimal.RequireFromString("102000.00"), AnnualMedian: decimal.RequireFromString("97000.00"), } got := capturePriceToWinLine(band) for _, want := range []string{"Mechanical Engineers", "United States", "$102000.00", "$97000.00", "BLS OEWS", "advisory"} { if !strings.Contains(got, want) { t.Errorf("the national price to win line must contain %q, got %q", want, got) } } if strings.Contains(got, "-") { t.Errorf("the price to win line must carry no dash in surfaced prose, got %q", got) } } // TestLaborRateBandSQLPassesTheReadOnlyGuard is the load bearing security assertion for M5: the wage band SQL // passes GuardReadOnlyQuery against the real ReadAllowlist with no error. It must be a single read over the // allowlisted bls_wages table with no mutating keyword and no eeo marker, the same gate ValidateRegistry runs // at boot and ExecuteIntent would re run. func TestLaborRateBandSQLPassesTheReadOnlyGuard(t *testing.T) { if err := GuardReadOnlyQuery(laborRateBandSQL, ReadAllowlist); err != nil { t.Fatalf("the labor rate band SQL must pass the read only guard: %v", err) } } // TestValidateRegistryWithLaborRateBand proves the whole closed Registry, now carrying the M5 labor rate band // intent, validates at boot. ValidateRegistry runs GuardReadOnlyQuery on every intent's SQL, so the new // intent's SQL must itself pass the guard for the whole Registry to validate. func TestValidateRegistryWithLaborRateBand(t *testing.T) { if err := ValidateRegistry(); err != nil { t.Fatalf("ValidateRegistry must pass with the M5 labor rate band intent registered: %v", err) } } // TestLaborRateBandIntentIsRegistered proves labor_rate_band is in the closed Registry binding a role or SOC // text param and an area enum bounded to HI and NM, and is a graph intent (so Answer routes it to AnswerGraph) // but NOT a bench intent (it is public reference data, never suppressed). func TestLaborRateBandIntentIsRegistered(t *testing.T) { it, ok := IntentByName(IntentLaborRateBand) if !ok { t.Fatalf("intent %q must be registered in the closed Registry", IntentLaborRateBand) } if len(it.Params) != 2 { t.Fatalf("the labor rate band intent must bind exactly two params, got %d", len(it.Params)) } if it.Params[1].Kind != ParamEnum { t.Errorf("the area param must be an enum, got %q", it.Params[1].Kind) } for _, want := range []string{"HI", "NM"} { if !allowedValue(want, it.Params[1].Allowed) { t.Errorf("the area enum must allow %q", want) } } if !IsGraphIntent(IntentLaborRateBand) { t.Error("the labor rate band intent must be a graph intent so Answer routes it to AnswerGraph") } if IsBenchIntent(IntentLaborRateBand) { t.Error("the labor rate band intent reads public reference data and must NOT be a bench intent") } } // TestWageClassifierBindsOnlyOnResolvableRoleAndState pins the conservative NL posture: a labor rate question // routes to the wage intent ONLY when it carries both a quoted role we can resolve to a SOC and a named state // we can resolve to a known OEWS area; an unresolvable role or an unknown state falls back to RAG (a nil // route) rather than guessing a rate. func TestWageClassifierBindsOnlyOnResolvableRoleAndState(t *testing.T) { gr := graphClassify(`what is the labor rate for a "Program Manager" in Hawaii`) if gr == nil { t.Fatal("a labor rate question with a resolvable role and state must route to the wage intent") } if gr.intent != IntentLaborRateBand { t.Errorf("the wage question must route to %q, got %q", IntentLaborRateBand, gr.intent) } if len(gr.args) != 2 || gr.args[0] != "113021" || gr.args[1] != "HI" { t.Errorf("the wage route must bind the resolved SOC and area, got %v", gr.args) } // A wage question with a resolvable role but an unknown state falls back to RAG. if got := graphClassify(`prevailing wage for a "Program Manager" in Virginia`); got != nil { t.Errorf("a wage question in a state with no wage data must fall back to RAG, got %+v", got) } // A wage question with a known state but an unresolvable quoted role falls back to RAG. if got := graphClassify(`labor rate for a "Underwater Basket Weaver" in Hawaii`); got != nil { t.Errorf("a wage question with an unresolvable role must fall back to RAG, got %+v", got) } // A wage question with no quoted role at all falls back to RAG (a bare role is ambiguous). if got := graphClassify(`what is the labor rate for a program manager in Hawaii`); got != nil { t.Errorf("a wage question with no quoted role must fall back to RAG, got %+v", got) } } // TestCapturePriceToWinLineNamesTheBandAndNeverADash pins the surfaced price to win line rendered from a // resolved wage band: it names the role, the area name, the annual mean and annual median in dollars to cents, // labels the source BLS OEWS advisory, and carries no dash in surfaced prose (the platform writing rule). func TestCapturePriceToWinLineNamesTheBandAndNeverADash(t *testing.T) { band := WageBand{ SOC: "113021", OccupationTitle: "Computer and Information Systems Managers", Role: "Program Manager", Area: "HI", AreaName: "Hawaii", AnnualMean: decimal.RequireFromString("185000.00"), AnnualMedian: decimal.RequireFromString("172500.50"), } got := capturePriceToWinLine(band) for _, want := range []string{"Program Manager", "Hawaii", "$185000.00", "$172500.50", "BLS OEWS", "advisory"} { if !strings.Contains(got, want) { t.Errorf("the price to win line must contain %q, got %q", want, got) } } if strings.Contains(got, "-") { t.Errorf("the price to win line must carry no dash in surfaced prose, got %q", got) } }

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