Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/graph_loop_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/ai/graph_loop_test.go |
| Original SHA-256 | cafbc69d0fc07d3815478227fdf50f9ecd4631917a7fb75f3db8dc8d323743a3 |
| Git blob SHA | 1d48a2407891ecb9e191cb62ca014c7f5d5d4081 |
| Reading-copy SHA-256 | cafbc69d0fc07d3815478227fdf50f9ecd4631917a7fb75f3db8dc8d323743a3 |
Every recorded occurrence
These 11 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/ai/graph_loop_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_loop_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓118 lines · 6.3 KB
package ai
import (
"strings"
"testing"
)
// TestRequirementSegmentSQLPassesTheReadOnlyGuard is the load bearing security assertion for G6: the segment
// resolver SQL passes GuardReadOnlyQuery against the real ReadAllowlist with no error. It must be a single
// read over allowlisted tables (requirements, opportunities, opportunity_records) with no set returning
// function in a FROM or JOIN position, no mutating keyword, and no eeo marker, the same gate ValidateRegistry
// runs at boot and ExecuteIntent would re run. It is the SQL the composition runs to resolve the segment
// under RLS and the registered SQL of the composed intent.
func TestRequirementSegmentSQLPassesTheReadOnlyGuard(t *testing.T) {
if err := GuardReadOnlyQuery(requirementSegmentSQL, ReadAllowlist); err != nil {
t.Fatalf("the requirement segment resolver SQL must pass the read only guard: %v", err)
}
}
// TestValidateRegistryWithCaptureIntent proves the whole closed Registry, now carrying the G6 composed
// capture intent alongside the TAG, G3, G1, G9, G7, G2, G5, and G4 intents, validates at boot. ValidateRegistry
// runs GuardReadOnlyQuery on every intent's SQL, so the composed intent's registered SQL (the segment
// resolver read) must itself pass the guard for the whole Registry to validate. This is the assertion the api
// boot runs.
func TestValidateRegistryWithCaptureIntent(t *testing.T) {
if err := ValidateRegistry(); err != nil {
t.Fatalf("ValidateRegistry must pass with the G6 capture intent registered: %v", err)
}
}
// TestCaptureIntentIsRegistered proves capture_picture_for_requirement is in the closed Registry binding
// exactly one ParamUUID requirement_id, so ValidateRegistry asserts it at boot and the bench fork can bind its
// id. A missing intent or a wrong param shape means the registration regressed.
func TestCaptureIntentIsRegistered(t *testing.T) {
it, ok := IntentByName(IntentCapturePictureForRequirement)
if !ok {
t.Fatalf("intent %q must be registered in the closed Registry", IntentCapturePictureForRequirement)
}
if len(it.Params) != 1 {
t.Fatalf("the capture intent must bind exactly one param, got %d", len(it.Params))
}
if it.Params[0].Kind != ParamUUID {
t.Errorf("the capture intent must bind a ParamUUID requirement id, got %q", it.Params[0].Kind)
}
if it.SQL != requirementSegmentSQL {
t.Error("the capture intent's registered SQL must be the segment resolver read, the only guarded read it carries")
}
}
// TestCaptureIntentIsGraphAndBenchIntent proves the composed capture intent is BOTH a graph intent (so the
// Answer dispatcher routes it to AnswerGraph) AND a bench intent (so it is auth gated, rejected on the raw
// ExecuteIntent path, and forked to its composition). A regression dropping it from either set would let it
// route to TAG or run unsuppressed.
func TestCaptureIntentIsGraphAndBenchIntent(t *testing.T) {
if !IsGraphIntent(IntentCapturePictureForRequirement) {
t.Error("the capture intent must be a graph intent so Answer routes it to AnswerGraph")
}
if !IsBenchIntent(IntentCapturePictureForRequirement) {
t.Error("the capture intent reads the bench and must be a bench intent so it is auth gated and raw path rejected")
}
}
// TestCaptureClassifierBindsOnlyOnExplicitRequirementUUID pins the conservative NL posture: a capture picture
// question routes to the composed intent ONLY when it carries an explicit canonical requirement UUID, and a
// capture phrasing with no UUID falls back to RAG (a nil route) rather than guessing a requirement, the same
// posture as the bench gap and readiness routes.
func TestCaptureClassifierBindsOnlyOnExplicitRequirementUUID(t *testing.T) {
reqID := "11111111-2222-3333-4444-555555555555"
gr := graphClassify(`give me the capture picture for requirement ` + reqID)
if gr == nil {
t.Fatal("a capture picture question carrying an explicit requirement UUID must route to the composed intent")
}
if gr.intent != IntentCapturePictureForRequirement {
t.Errorf("the capture question must route to %q, got %q", IntentCapturePictureForRequirement, gr.intent)
}
if len(gr.args) != 1 || gr.args[0] != reqID {
t.Errorf("the capture route must bind the explicit requirement id, got %v", gr.args)
}
// A capture phrasing with NO explicit requirement id falls back to RAG (nil route), never a guessed id.
if got := graphClassify("can we staff this and what is the market"); got != nil {
t.Errorf("a capture question with no explicit requirement id must fall back to RAG, got %+v", got)
}
}
// TestCaptureNarrativeNamesThePriceFloorAndNeverADash pins two surfaced invariants of the deterministic
// narrative: it always states the price to win honest floor verbatim (no fabricated rate), and it carries no
// dash in surfaced prose (the platform writing rule). The bench legs are empty here, so the narrative is the
// pure structural and floor text with no person data.
func TestCaptureNarrativeNamesThePriceFloorAndNeverADash(t *testing.T) {
seg := RequirementSegment{Agency: "", NAICS: "", RequiredLevel: "secret", Found: true}
market := []string{"the market segment could not be bound: this requirement names no customer agency and links no opportunity."}
got := captureNarrative(seg, nil, nil, market, capturePriceToWinFloor)
if !strings.Contains(got, capturePriceToWinFloor) {
t.Errorf("the capture narrative must state the price to win honest floor, got %q", got)
}
if strings.Contains(got, "-") {
t.Errorf("the capture narrative must carry no dash in surfaced prose, got %q", got)
}
}
// TestSegmentBindRules pins the honest floor discipline: the agency keyed leg runs only with a non empty
// agency, the (agency, naics) keyed leg only with both, and SegmentBound (whether any market arm can run) is
// the non empty agency floor.
func TestSegmentBindRules(t *testing.T) {
none := RequirementSegment{Found: true}
if none.AgencyBound() || none.NAICSBound() || none.SegmentBound() {
t.Error("an empty segment must bind no market arm")
}
agencyOnly := RequirementSegment{Agency: "DEPT OF THE AIR FORCE", Found: true}
if !agencyOnly.AgencyBound() || agencyOnly.NAICSBound() || !agencyOnly.SegmentBound() {
t.Error("an agency only segment must bind the agency arm but not the naics arm")
}
full := RequirementSegment{Agency: "DEPT OF THE AIR FORCE", NAICS: "541512", Found: true}
if !full.AgencyBound() || !full.NAICSBound() || !full.SegmentBound() {
t.Error("a full segment must bind both market arms")
}
}