Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/graph_skill_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_skill_test.go |
| Original SHA-256 | c98e1ebce40b3f6110abdc7c3eb0e0670214aae627f102dd61fc903e441fcbde |
| Git blob SHA | 1b5624200b47b93409c6029cbffa866112cd6539 |
| Reading-copy SHA-256 | c98e1ebce40b3f6110abdc7c3eb0e0670214aae627f102dd61fc903e441fcbde |
Every recorded occurrence
These 12 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_skill_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_skill_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓135 lines · 6.1 KB
package ai
import (
"strings"
"testing"
)
// TestGraphSkillIntentsAreRegistered proves the two G3 traversals are in the closed Registry, so
// ValidateRegistry asserts them at boot and ExecuteIntent can run them. A missing intent here means the
// init registration regressed.
func TestGraphSkillIntentsAreRegistered(t *testing.T) {
for _, name := range []string{IntentSkillSubstitutionClosure, IntentSkillGapBridge} {
it, ok := IntentByName(name)
if !ok {
t.Fatalf("intent %q must be registered in the closed Registry", name)
}
if len(it.Params) != 2 {
t.Errorf("intent %q must bind exactly two params (the start skill and the depth), got %d", name, len(it.Params))
}
if it.Params[0].Kind != ParamUUID {
t.Errorf("intent %q first param must be a uuid skill id, got %q", name, it.Params[0].Kind)
}
if it.Params[1].Kind != ParamInt {
t.Errorf("intent %q second param must be an int depth, got %q", name, it.Params[1].Kind)
}
}
}
// TestGraphSkillIntentsPassTheReadOnlyGuard is the load bearing security assertion: each registered graph
// intent passes GuardReadOnlyQuery against the real ReadAllowlist. A recursive CTE that referenced a non
// allowlisted base table, hid a mutation, or named an eeo marker would fail here, the same gate
// ValidateRegistry runs at boot and ExecuteIntent re runs at execution time.
func TestGraphSkillIntentsPassTheReadOnlyGuard(t *testing.T) {
for _, sql := range []string{skillSubstitutionClosureSQL, skillGapBridgeSQL} {
if err := GuardReadOnlyQuery(sql, ReadAllowlist); err != nil {
t.Errorf("a registered graph intent must pass the read only guard: %v", err)
}
}
}
// TestGraphSkillRecursiveDeterminism is the static proof that every recursive determinism guarantee the
// AEDT reproducibility mandate requires is present in the FIXED SQL: a hard depth cap bound to the depth
// param, a cycle guard (the visited path array plus the not member predicate plus UNION not UNION ALL),
// and a unique id tiebreaker on the final ORDER BY. The model never authors this SQL, so pinning its shape
// in a test is how the determinism is enforced by construction rather than by review.
func TestGraphSkillRecursiveDeterminism(t *testing.T) {
for _, tc := range []struct {
name string
sql string
}{
{"substitution_closure", skillSubstitutionClosureSQL},
{"gap_bridge", skillGapBridgeSQL},
} {
lower := strings.ToLower(tc.sql)
// The hard depth cap: the recursive arm admits a hop only while the carried depth is below the bound
// param $2. Without this the walk would only be bounded by the cycle guard.
if !strings.Contains(lower, "c.depth < $2") {
t.Errorf("%s: the recursive arm must enforce the hard depth cap (c.depth < $2)", tc.name)
}
// The cycle guard, three independent defenses: a carried visited path array, the not member predicate
// that excludes an already visited skill id, and UNION (set semantics) rather than UNION ALL.
if !strings.Contains(lower, "c.path || sr.to_skill_id") {
t.Errorf("%s: the recursive arm must carry and extend the visited path array", tc.name)
}
if !strings.Contains(lower, "not (sr.to_skill_id = any(c.path))") {
t.Errorf("%s: the recursive arm must exclude an already visited skill id (the cycle guard)", tc.name)
}
if strings.Contains(lower, "union all") {
t.Errorf("%s: the recursion must use UNION (set semantics), never UNION ALL", tc.name)
}
if !strings.Contains(lower, "union") {
t.Errorf("%s: the recursion must use UNION", tc.name)
}
// The id tiebreaker plus a total order: every ORDER BY carries the skill id tiebreaker AND ends with
// the full evidence path, so two rows that tie on depth, strength, and skill id (two distinct paths to
// the same node) still sort to a single byte stable order.
if !strings.Contains(lower, "order by") {
t.Errorf("%s: the final select must be ordered", tc.name)
}
if !strings.Contains(lower, "skill_id,") {
t.Errorf("%s: the ORDER BY must carry the skill_id tiebreaker", tc.name)
}
if !strings.HasSuffix(strings.TrimSpace(lower), "path") {
t.Errorf("%s: the ORDER BY must end with the full path, the total order disambiguator", tc.name)
}
// The curated graph, not the semantic matcher: the walk reads the curated edges, never an embedding.
// (cosine and embedding live in SkillAdjacency, which this file deliberately does not touch.)
if strings.Contains(lower, "embedding") || strings.Contains(lower, "<=>") {
t.Errorf("%s: the curated graph traversal must not use an embedding or cosine operator", tc.name)
}
// The curated edge filter: only verified substitutes_for and broader_than edges are walked.
if !strings.Contains(lower, "verified_at is not null") {
t.Errorf("%s: the walk must restrict to verified curated edges", tc.name)
}
if !strings.Contains(lower, "substitutes_for") || !strings.Contains(lower, "broader_than") {
t.Errorf("%s: the walk must restrict to the substitutes_for and broader_than relations", tc.name)
}
}
}
// TestGapBridgeUsesCrosswalk pins that the gap bridge intent additionally consults ontology_crosswalk for a
// taxonomy or certification bridge, the second arm the task requires alongside the curated closure.
func TestGapBridgeUsesCrosswalk(t *testing.T) {
lower := strings.ToLower(skillGapBridgeSQL)
if !strings.Contains(lower, "ontology_crosswalk") {
t.Error("the gap bridge intent must consult ontology_crosswalk for a taxonomy or certification bridge")
}
if !strings.Contains(lower, "ontology_crosswalk' as bridge_kind") {
t.Error("a crosswalk bridge row must be labeled with its bridge_kind so the caller can distinguish it")
}
}
// TestClampGraphDepth proves the depth is always normalized into the bounded, deterministic range, so no
// caller bound depth (zero, negative, or oversized) can turn a bounded walk into an unbounded one.
func TestClampGraphDepth(t *testing.T) {
cases := map[int]int{
0: DefaultGraphDepth,
-3: DefaultGraphDepth,
1: 1,
3: 3,
5: maxGraphDepth,
99: maxGraphDepth,
}
for in, want := range cases {
if got := ClampGraphDepth(in); got != want {
t.Errorf("ClampGraphDepth(%d) = %d, want %d", in, got, want)
}
}
}