Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 |
| Branch | master |
| Path or archive member | internal/modules/matching/aliasresolver_test.go |
| Original SHA-256 | 087e9dd4f9b220c257942915cacaea64222f27779be7ba0dfbedbca6f299ddb8 |
| Git blob SHA | b4e28a3a63a63f05765306b5427bea5f9415c482 |
| Reading-copy SHA-256 | 087e9dd4f9b220c257942915cacaea64222f27779be7ba0dfbedbca6f299ddb8 |
Every recorded occurrence
These 33 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/matching/aliasresolver_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws6-retrieval | 6c56e29231ec05735927fa265c97d517499dfeaf | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | phase2-eval-fairness | d361af254701975fe239927656ababb56374655e | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws2-alias-relationship | e4dada4601c6eb101830f9d223a9655dfa120616 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws6-retrieval | 6c56e29231ec05735927fa265c97d517499dfeaf | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | phase2-eval-fairness | d361af254701975fe239927656ababb56374655e | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws2-alias-relationship | e4dada4601c6eb101830f9d223a9655dfa120616 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/matching/aliasresolver_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓165 lines · 5.1 KB
package matching
import (
"context"
"testing"
"github.com/shopspring/decimal"
"github.com/missionworkforce/missionmatch/internal/modules/matching/engine"
)
// buildResolver is a shorthand that wires maps via the unexported test constructor.
func buildResolver(nameToID, aliasToID map[string]string, rels map[string][]relEdge) *DeterministicAliasResolver {
return newResolverFromMaps(nameToID, aliasToID, rels)
}
// TestAliasResolver_CandidateNameIsAlias: the candidate carries a name that is a curated alias for
// the required skill. Both canonical ids resolve to the same skill, so ResolveAlias returns
// Similarity 1.0, Exact true, AliasMatched true.
func TestAliasResolver_CandidateNameIsAlias(t *testing.T) {
nameToID := map[string]string{
"signals intelligence": "skill-sigint",
}
aliasToID := map[string]string{
"sigint": "skill-sigint",
}
r := buildResolver(nameToID, aliasToID, nil)
required := engine.RequiredSkill{SkillID: "skill-sigint", Name: "Signals Intelligence"}
cands := []engine.CandidateSkill{
{SkillID: "", Name: "SIGINT"}, // candidate holds it by alias name
}
m, ok := r.ResolveAlias(context.Background(), required, cands)
if !ok {
t.Fatal("expected a match, got none")
}
if !m.Similarity.Equal(decimal.NewFromInt(1)) {
t.Errorf("Similarity = %s, want 1", m.Similarity)
}
if !m.Exact {
t.Error("Exact should be true for alias canonical match")
}
if !m.AliasMatched {
t.Error("AliasMatched should be true")
}
if !m.Matched {
t.Error("Matched should be true")
}
}
// TestAliasResolver_RelationshipSubstitutesAboveThreshold: the candidate's canonical skill has a
// substitutes_for edge to the required canonical skill at strength 0.80 (above the 0.62 gate).
// Returns Similarity 0.80, Exact false, AliasMatched false.
func TestAliasResolver_RelationshipSubstitutesAboveThreshold(t *testing.T) {
nameToID := map[string]string{
"kubernetes": "skill-k8s",
"docker swarm": "skill-swarm",
}
rels := map[string][]relEdge{
"skill-swarm": {
{toID: "skill-k8s", relation: "substitutes_for", strength: decimal.RequireFromString("0.80")},
},
}
r := buildResolver(nameToID, nil, rels)
required := engine.RequiredSkill{SkillID: "skill-k8s", Name: "Kubernetes"}
cands := []engine.CandidateSkill{
{SkillID: "", Name: "Docker Swarm"},
}
m, ok := r.ResolveAlias(context.Background(), required, cands)
if !ok {
t.Fatal("expected a match via substitutes_for, got none")
}
if !m.Similarity.Equal(decimal.RequireFromString("0.80")) {
t.Errorf("Similarity = %s, want 0.80", m.Similarity)
}
if m.Exact {
t.Error("Exact should be false for relationship match")
}
if m.AliasMatched {
t.Error("AliasMatched should be false for relationship match")
}
if !m.Matched {
t.Error("Matched should be true")
}
}
// TestAliasResolver_RelationshipBelowThreshold: the same edge at strength 0.50 is below the 0.62
// gate, so ResolveAlias returns no match.
func TestAliasResolver_RelationshipBelowThreshold(t *testing.T) {
nameToID := map[string]string{
"kubernetes": "skill-k8s",
"docker swarm": "skill-swarm",
}
rels := map[string][]relEdge{
"skill-swarm": {
{toID: "skill-k8s", relation: "substitutes_for", strength: decimal.RequireFromString("0.50")},
},
}
r := buildResolver(nameToID, nil, rels)
required := engine.RequiredSkill{SkillID: "skill-k8s", Name: "Kubernetes"}
cands := []engine.CandidateSkill{
{SkillID: "", Name: "Docker Swarm"},
}
_, ok := r.ResolveAlias(context.Background(), required, cands)
if ok {
t.Fatal("expected no match below 0.62 threshold, but got a match")
}
}
// TestAliasResolver_NoAliasOrRelationship: neither an alias nor any qualifying relationship exists.
// Returns no match.
func TestAliasResolver_NoAliasOrRelationship(t *testing.T) {
nameToID := map[string]string{
"golang": "skill-go",
"rust": "skill-rust",
}
r := buildResolver(nameToID, nil, nil)
required := engine.RequiredSkill{SkillID: "skill-go", Name: "Golang"}
cands := []engine.CandidateSkill{
{SkillID: "", Name: "Rust"},
}
_, ok := r.ResolveAlias(context.Background(), required, cands)
if ok {
t.Fatal("expected no match when no alias or relationship exists")
}
}
// TestAliasResolver_RequiredResolvesViaAlias: the required skill name is itself an alias text. The
// candidate holds the canonical skill by id. Alias canonical resolution on both sides yields a match
// with Similarity 1.0, AliasMatched true.
func TestAliasResolver_RequiredResolvesViaAlias(t *testing.T) {
// required.Name "JS" is an alias for skill-javascript
aliasToID := map[string]string{
"js": "skill-javascript",
}
nameToID := map[string]string{
"javascript": "skill-javascript",
}
r := buildResolver(nameToID, aliasToID, nil)
// required has no SkillID set, name is the alias text
required := engine.RequiredSkill{Name: "JS"}
cands := []engine.CandidateSkill{
{SkillID: "skill-javascript", Name: "JavaScript"},
}
m, ok := r.ResolveAlias(context.Background(), required, cands)
if !ok {
t.Fatal("expected alias match when required resolves via alias, got none")
}
if !m.Similarity.Equal(decimal.NewFromInt(1)) {
t.Errorf("Similarity = %s, want 1", m.Similarity)
}
if !m.AliasMatched {
t.Error("AliasMatched should be true")
}
}