Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/eeo/fairness_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/eeo/fairness_test.go |
| Original SHA-256 | b8784d2b38c18009a09150f3bf19ea8f2c99f89aa1f2b18b1d3b93ec09fddd5b |
| Git blob SHA | 4ce4379d72013c6381a734f69e272f631c170402 |
| Reading-copy SHA-256 | b8784d2b38c18009a09150f3bf19ea8f2c99f89aa1f2b18b1d3b93ec09fddd5b |
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/eeo/fairness_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/eeo/fairness_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓113 lines · 4.7 KB
package eeo
import "testing"
// point builds a FairnessPoint with the given impact ratio string for the pure alert logic tests.
func point(ratio string) FairnessPoint {
return FairnessPoint{ImpactRatio: ratio, SelectionRate: "0.5000"}
}
func TestAlertWhenLatestBelowThreshold(t *testing.T) {
// The series ends below 0.80, so it must alert regardless of the prior trajectory.
fs := &FairnessSeries{Points: []FairnessPoint{point("0.9000"), point("0.7500")}}
evaluateAlert(fs)
if !fs.Alert {
t.Fatalf("a latest ratio of 0.7500 must alert, reason %q", fs.AlertReason)
}
}
func TestAlertOnDriftDropEvenAboveThreshold(t *testing.T) {
// Both points are at or above 0.80, but the drop 0.95 to 0.89 is 0.06, more than the 0.05 drift
// limit, so a best in world tool warns before the group ever crosses the threshold.
fs := &FairnessSeries{Points: []FairnessPoint{point("0.9500"), point("0.8900")}}
evaluateAlert(fs)
if !fs.Alert {
t.Fatalf("a 0.06 drop above the threshold must alert, reason %q", fs.AlertReason)
}
}
func TestNoAlertOnSmallDriftAboveThreshold(t *testing.T) {
// A 0.03 drop, both above 0.80, is within the drift limit and above the threshold, so no alert.
fs := &FairnessSeries{Points: []FairnessPoint{point("0.9500"), point("0.9200")}}
evaluateAlert(fs)
if fs.Alert {
t.Fatalf("a 0.03 drop above the threshold must not alert, reason %q", fs.AlertReason)
}
}
func TestExactDriftDeltaDoesNotAlert(t *testing.T) {
// A drop of exactly 0.05 is NOT more than the limit (the alert is strictly greater than driftDelta),
// so the boundary case does not alert when both points stay above the threshold.
fs := &FairnessSeries{Points: []FairnessPoint{point("0.9500"), point("0.9000")}}
evaluateAlert(fs)
if fs.Alert {
t.Fatalf("a drop of exactly 0.05 must not alert, reason %q", fs.AlertReason)
}
}
func TestNAPointsDoNotContributeToDrift(t *testing.T) {
// An n/a ratio (the reference group or a cut with too few known groups) is skipped, so a series of
// only n/a points never alerts and never panics.
fs := &FairnessSeries{Points: []FairnessPoint{point("n/a"), point("n/a")}}
evaluateAlert(fs)
if fs.Alert {
t.Fatalf("a series of only n/a points must not alert")
}
}
func TestSingleBelowThresholdPointAlerts(t *testing.T) {
// One snapshot, already below 0.80, alerts without a prior to compare against.
fs := &FairnessSeries{Points: []FairnessPoint{point("0.6000")}}
evaluateAlert(fs)
if !fs.Alert {
t.Fatalf("a single below threshold point must alert")
}
}
func TestSnapshotRowFromImpactReferenceGroupHasNoRatio(t *testing.T) {
// The reference group's report ratio is "n/a", so the snapshot row carries a nil impact ratio and is
// not below threshold (a null impact_ratio in the column, never a fabricated 1.0).
row := snapshotRowFromImpact("selection :: by sex", ImpactRow{Group: "male", Selected: 8, Considered: 10, Rate: "0.8000", ImpactRatio: "n/a"})
if row.impactRatio != nil {
t.Fatalf("a reference group must store a null impact ratio, got %v", row.impactRatio)
}
if row.belowThreshold {
t.Fatalf("a reference group must not be below threshold")
}
if !row.selectionRate.Equal(decimalOrZero("0.8000")) {
t.Fatalf("selection rate not preserved, got %s", row.selectionRate)
}
}
func TestSnapshotRowFromImpactFlagsBelowThreshold(t *testing.T) {
// A group with ratio 0.5000 is below 0.80, so below_threshold must be true and the ratio preserved.
row := snapshotRowFromImpact("selection :: by sex", ImpactRow{Group: "female", Selected: 4, Considered: 10, Rate: "0.4000", ImpactRatio: "0.5000"})
if row.impactRatio == nil || !row.impactRatio.Equal(decimalOrZero("0.5000")) {
t.Fatalf("impact ratio not preserved, got %v", row.impactRatio)
}
if !row.belowThreshold {
t.Fatalf("a 0.5000 ratio must be below threshold")
}
}
func TestSnapshotRowsCoverBothStagesAndAllCuts(t *testing.T) {
// One ImpactRow in every cut of both stages must produce six snapshot rows, so the time series covers
// selection and screening across by sex, by race or ethnicity, and intersectional.
one := []ImpactRow{{Group: "g", Selected: 1, Considered: 2, Rate: "0.5000", ImpactRatio: "1.0000"}}
rep := Report{
Selection: AnalysisSection{Stage: "selection (recorded slate decisions)", ByGender: one, ByRace: one, Intersectional: one},
Screening: AnalysisSection{Stage: "screening (served scores)", ByGender: one, ByRace: one, Intersectional: one},
}
rows := snapshotRowsFromReport(rep)
if len(rows) != 6 {
t.Fatalf("expected 6 snapshot rows across both stages and three cuts, got %d", len(rows))
}
seen := map[string]bool{}
for _, r := range rows {
seen[r.decisionContext] = true
}
if len(seen) != 6 {
t.Fatalf("expected 6 distinct decision_context labels, got %d: %v", len(seen), seen)
}
}