Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/magstore/rerank_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/magstore/rerank_test.go |
| Original SHA-256 | 57e65d80da1483e6414e3f2af4d6a467a81e1b3a1e6c925259aa8a2f65a44d2b |
| Git blob SHA | a0c3b4b5485e1cc08cbcc63cec2106b133f32d66 |
| Reading-copy SHA-256 | 57e65d80da1483e6414e3f2af4d6a467a81e1b3a1e6c925259aa8a2f65a44d2b |
Every recorded occurrence
These 10 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/platform/magstore/rerank_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/platform/magstore/rerank_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓85 lines · 3.1 KB
package magstore
import (
"reflect"
"testing"
)
func mem(slate, cand string, approved bool, f ...float64) SlateMember {
return SlateMember{SlateID: slate, CandidateID: cand, Approved: approved, Features: f}
}
func TestRerankCoeffsInFeatureOrder(t *testing.T) {
m := Model{Coeffs: map[string]float64{
"clearance_score": 1, "skills_score": 2, "certs_score": 3,
"customer_score": 4, "experience_score": 5, "location_score": 6,
}}
got := RerankCoeffs(m)
if !reflect.DeepEqual(got, []float64{1, 2, 3, 4, 5, 6}) {
t.Fatalf("coeffs must come back in RerankFeatureOrder, got %v", got)
}
}
func TestOrderMembersByUtilityStableTiebreak(t *testing.T) {
// weight only the first feature; a higher first feature sorts first.
coeffs := []float64{1, 0, 0, 0, 0, 0}
members := []SlateMember{
mem("s", "low", false, 10, 0, 0, 0, 0, 0),
mem("s", "high", true, 90, 0, 0, 0, 0, 0),
mem("s", "mid", false, 50, 0, 0, 0, 0, 0),
}
ordered := OrderMembers(coeffs, members)
got := []string{ordered[0].CandidateID, ordered[1].CandidateID, ordered[2].CandidateID}
if !reflect.DeepEqual(got, []string{"high", "mid", "low"}) {
t.Fatalf("must order by utility descending, got %v", got)
}
}
func TestOrderMembersZeroWeightPreservesEngineOrder(t *testing.T) {
// zero weights => every utility ties => the stable incoming (engine) order is preserved exactly.
coeffs := []float64{0, 0, 0, 0, 0, 0}
members := []SlateMember{
mem("s", "a", true, 1, 0, 0, 0, 0, 0),
mem("s", "b", false, 9, 0, 0, 0, 0, 0),
mem("s", "c", true, 5, 0, 0, 0, 0, 0),
}
ordered := OrderMembers(coeffs, members)
got := []string{ordered[0].CandidateID, ordered[1].CandidateID, ordered[2].CandidateID}
if !reflect.DeepEqual(got, []string{"a", "b", "c"}) {
t.Fatalf("a zero weight must preserve the engine order, got %v", got)
}
}
func TestTopKSelectionUsesApprovedCount(t *testing.T) {
// two approved on this slate => the top 2 by utility are the selection the ranking nudges.
coeffs := []float64{1, 0, 0, 0, 0, 0}
groups := []SlateGroup{{SlateID: "s", Members: []SlateMember{
mem("s", "top", true, 90, 0, 0, 0, 0, 0),
mem("s", "second", false, 80, 0, 0, 0, 0, 0),
mem("s", "third", true, 10, 0, 0, 0, 0, 0),
}}}
sel := TopKSelection(coeffs, groups)
// two approved => top 2 by the weight (top=90, second=80) are selected; third (10) is not.
if !sel["s|top"] || !sel["s|second"] {
t.Fatalf("the top two by utility must be selected, got %v", sel)
}
if sel["s|third"] {
t.Fatalf("the third ranked must not be in a top two selection, got %v", sel)
}
if len(sel) != 2 {
t.Fatalf("the selection size must equal the approved count (2), got %d", len(sel))
}
}
func TestTopKSelectionSkipsUnanimousReject(t *testing.T) {
// no approvals => nothing is selected (no ordering signal to gate).
coeffs := []float64{1, 0, 0, 0, 0, 0}
groups := []SlateGroup{{SlateID: "s", Members: []SlateMember{
mem("s", "a", false, 90, 0, 0, 0, 0, 0),
mem("s", "b", false, 10, 0, 0, 0, 0, 0),
}}}
if sel := TopKSelection(coeffs, groups); len(sel) != 0 {
t.Fatalf("a slate with no approvals must select nothing, got %v", sel)
}
}