Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/graph_bench_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_bench_test.go |
| Original SHA-256 | 971dbfb8fad868d738050b46a8eb6f4e72549c2070cd2fbfa99c8ff8d93b80f5 |
| Git blob SHA | 0fb8ab78baf1d825531467726503d4d6c28b7fd3 |
| Reading-copy SHA-256 | 971dbfb8fad868d738050b46a8eb6f4e72549c2070cd2fbfa99c8ff8d93b80f5 |
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_bench_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/ai/graph_bench_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓152 lines · 6.9 KB
package ai
import (
"strings"
"testing"
)
// TestGraphBenchIntentsAreRegistered proves the three G4 bench intents are in the closed Registry, so
// ValidateRegistry asserts them at boot and ExecuteIntent can run them. A missing intent means the
// registration regressed. Each binds exactly one SQL param (a ParamUUID id); the suppression threshold is
// a Go argument, never a bound SQL param.
func TestGraphBenchIntentsAreRegistered(t *testing.T) {
cases := map[string]int{
IntentBenchSkillCoverage: 1, // skill_id
IntentBenchReadinessDistribution: 1, // requirement_id
IntentBenchGapForRequirement: 1, // requirement_id
}
for name, wantParams := range cases {
it, ok := IntentByName(name)
if !ok {
t.Fatalf("intent %q must be registered in the closed Registry", name)
}
if len(it.Params) != wantParams {
t.Errorf("intent %q must bind exactly %d params, got %d", name, wantParams, len(it.Params))
}
if len(it.Params) == 1 && it.Params[0].Kind != ParamUUID {
t.Errorf("intent %q must bind a ParamUUID id, got %q", name, it.Params[0].Kind)
}
}
}
// TestGraphBenchIntentsPassTheReadOnlyGuard is the load bearing security assertion the task requires: each
// of the three new bench SQL consts passes GuardReadOnlyQuery against the real ReadAllowlist with no error.
// A query that referenced a non allowlisted table, hid a mutation, put a set returning function in a FROM
// or JOIN position, or named an eeo marker would fail here, the same gate ValidateRegistry runs at boot and
// ExecuteIntent re runs at execution time.
func TestGraphBenchIntentsPassTheReadOnlyGuard(t *testing.T) {
for _, tc := range []struct {
name string
sql string
}{
{"bench_skill_coverage", benchSkillCoverageSQL},
{"bench_readiness_distribution", benchReadinessDistributionSQL},
{"bench_gap_for_requirement", benchGapForRequirementSQL},
} {
if err := GuardReadOnlyQuery(tc.sql, ReadAllowlist); err != nil {
t.Errorf("the registered bench intent %q must pass the read only guard: %v", tc.name, err)
}
}
}
// TestValidateRegistryWithBenchIntents proves the whole closed Registry, now carrying the three G4 bench
// intents alongside the TAG, G3, G1, G9, G7, G2, and G5 intents, validates at boot. This is the assertion
// the api boot runs.
func TestValidateRegistryWithBenchIntents(t *testing.T) {
if err := ValidateRegistry(); err != nil {
t.Fatalf("ValidateRegistry must pass with the three G4 bench intents registered: %v", err)
}
}
// TestBenchIntentsAreGraphIntents proves the three G4 intents are classified as graph intents, so the
// Answer dispatcher routes them to AnswerGraph rather than AnswerTAG. A regression that dropped one from
// graphIntents would surface here.
func TestBenchIntentsAreGraphIntents(t *testing.T) {
for _, name := range []string{IntentBenchSkillCoverage, IntentBenchReadinessDistribution, IntentBenchGapForRequirement} {
if !IsGraphIntent(name) {
t.Errorf("the bench intent %q must be a graph intent", name)
}
}
}
// TestBenchIntentsAreBenchIntents proves the three G4 intents are in the benchIntents set, the person
// touching intents that the D1 route gate will require an authenticated tenant context for. A regression
// that dropped one would let a person touching read run without a resolved org.
func TestBenchIntentsAreBenchIntents(t *testing.T) {
for _, name := range []string{IntentBenchSkillCoverage, IntentBenchReadinessDistribution, IntentBenchGapForRequirement} {
if !IsBenchIntent(name) {
t.Errorf("the bench intent %q must be in the benchIntents set", name)
}
}
// The G5 reference reads are NOT bench intents (no person data), so the gate must not require an
// authenticated tenant for them; bench_clearance_coverage IS person touching, so it is a bench intent.
if IsBenchIntent(IntentClearanceReachability) {
t.Error("the clearance reachability reference read must NOT be a bench intent")
}
if !IsBenchIntent(IntentBenchClearanceCoverage) {
t.Error("bench_clearance_coverage is person touching and must be a bench intent")
}
}
// TestBenchSkillCoverageOrdersByBucketTiebreaker pins the byte stable mandate on the two bucket skill
// coverage partition: it ends its ORDER BY with the bucket label, a total order over the two buckets.
func TestBenchSkillCoverageOrdersByBucketTiebreaker(t *testing.T) {
lower := strings.ToLower(benchSkillCoverageSQL)
idx := strings.LastIndex(lower, "order by")
if idx < 0 {
t.Fatal("the skill coverage partition must be ordered for byte stability")
}
if !strings.Contains(lower[idx:], "bucket") {
t.Errorf("the skill coverage ORDER BY must end with the bucket tiebreaker, got %q", lower[idx:])
}
}
// TestBenchReadinessReadsTheAuditedEvaluations pins that the readiness distribution reads the already
// audited candidate_evaluations band, never recomputing a score. The band column is the frozen engine's
// decision at evaluation time; the intent reports its distribution, it does not score anyone.
func TestBenchReadinessReadsTheAuditedEvaluations(t *testing.T) {
lower := strings.ToLower(benchReadinessDistributionSQL)
if !strings.Contains(lower, "candidate_evaluations") {
t.Error("the readiness distribution must read the already audited candidate_evaluations table")
}
if !strings.Contains(lower, "band") {
t.Error("the readiness distribution must partition by the stored band, never a recomputed score")
}
}
// TestBenchIntentsFilterErasedCandidates pins that the skill coverage and gap counts exclude a soft deleted
// or an anonymized candidate, mirroring count_candidates_by_clearance, so an erased candidate is never
// counted into a structural headcount.
func TestBenchIntentsFilterErasedCandidates(t *testing.T) {
for name, sql := range map[string]string{
"bench_skill_coverage": benchSkillCoverageSQL,
"bench_gap_for_requirement": benchGapForRequirementSQL,
} {
lower := strings.ToLower(sql)
if !strings.Contains(lower, "deleted_at is null") {
t.Errorf("%s: the count must exclude soft deleted candidates (deleted_at IS NULL)", name)
}
if !strings.Contains(lower, "anonymized_at is null") {
t.Errorf("%s: the count must exclude anonymized candidates (anonymized_at IS NULL)", name)
}
}
}
// TestNoFloatTouchesABenchNumber pins the decimal mandate across the three bench intents: no float cast may
// touch any surfaced number. Every bench intent surfaces an int headcount, so no float cast belongs
// anywhere on this plane.
func TestNoFloatTouchesABenchNumber(t *testing.T) {
for name, sql := range map[string]string{
"bench_skill_coverage": benchSkillCoverageSQL,
"bench_readiness_distribution": benchReadinessDistributionSQL,
"bench_gap_for_requirement": benchGapForRequirementSQL,
} {
lower := strings.ToLower(sql)
for _, floatCast := range []string{"::float8", "::float", "::double precision", "::real"} {
if strings.Contains(lower, floatCast) {
t.Errorf("%s: a float cast %q must never touch a bench number (decimal mandate)", name, floatCast)
}
}
}
}