Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/tag_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 |
| Branch | master |
| Path or archive member | internal/modules/ai/tag_test.go |
| Original SHA-256 | 6b3b716dbd6e26f86c6e2ec72dbcc9eb78bbbc177db1e283f2216240c766eb29 |
| Git blob SHA | 4f79d8cec0fa2f9dbfdebf3e81a6add4d02228ec |
| Reading-copy SHA-256 | 6b3b716dbd6e26f86c6e2ec72dbcc9eb78bbbc177db1e283f2216240c766eb29 |
Every recorded occurrence
These 19 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/tag_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ai/tag_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓54 lines · 2.0 KB
package ai
import (
"github.com/google/uuid"
"testing"
)
// TestValidateIntentArgsClampsAndChecks proves the structured API hardening: a bounded ParamInt (max_depth)
// is clamped to its range and a ParamEnum value outside its allowed set is refused, so a caller cannot bind
// an unbounded recursion depth or an out of vocabulary enum on the /ai/query path.
func TestValidateIntentArgsClampsAndChecks(t *testing.T) {
closure, ok := IntentByName(IntentSkillSubstitutionClosure)
if !ok {
t.Fatalf("intent %q not registered", IntentSkillSubstitutionClosure)
}
id := uuid.New()
// max_depth above Max clamps to Max (5), below Min clamps to Min (1), in range is unchanged.
for _, tc := range []struct {
in, want int
}{{9999999, 5}, {0, 1}, {3, 3}, {-7, 1}, {5, 5}} {
out, err := validateIntentArgs(closure, []any{id, tc.in})
if err != nil {
t.Fatalf("validateIntentArgs(max_depth=%d): %v", tc.in, err)
}
if got := out[1].(int); got != tc.want {
t.Errorf("max_depth %d clamped to %d, want %d", tc.in, got, tc.want)
}
}
// A JSON style float64 whole number coerces and clamps; a fractional one is refused.
if out, err := validateIntentArgs(closure, []any{id, float64(2)}); err != nil || out[1].(int) != 2 {
t.Errorf("float64(2) should coerce to int 2, got %v err %v", out, err)
}
if _, err := validateIntentArgs(closure, []any{id, 2.5}); err == nil {
t.Error("a fractional max_depth must be refused")
}
// A ParamEnum value outside Allowed is refused; a valid one passes.
clearance, ok := IntentByName("count_candidates_by_clearance")
if !ok {
t.Fatal("count_candidates_by_clearance not registered")
}
if _, err := validateIntentArgs(clearance, []any{"cosmic_top_secret"}); err == nil {
t.Error("an out of vocabulary clearance enum must be refused")
}
if _, err := validateIntentArgs(clearance, []any{"secret"}); err != nil {
t.Errorf("a valid clearance enum must pass, got %v", err)
}
if _, err := validateIntentArgs(clearance, []any{""}); err != nil {
t.Errorf("the empty all clearances sentinel must pass, got %v", err)
}
}