Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/ai/capture_readiness_test.go |
| Original SHA-256 | 02e7a7713e1bf6d2a55e4f429980af630cd53930899e5a023a30b522ed048908 |
| Git blob SHA | d9e0f8aaeba855cef860e7964d2f4c30da82cc8b |
| Reading-copy SHA-256 | 02e7a7713e1bf6d2a55e4f429980af630cd53930899e5a023a30b522ed048908 |
Every recorded occurrence
These 6 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/capture_readiness_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/ai/capture_readiness_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓110 lines · 3.8 KB
package ai
import (
"strings"
"testing"
"github.com/shopspring/decimal"
)
// the default seed weights, the governance chosen capture logic.
func captureWeights() map[string]decimal.Decimal {
return map[string]decimal.Decimal{
factorStaffingReadiness: dec("0.35"),
factorMarketWinLikelihood: dec("0.30"),
factorIncumbencyPosition: dec("0.20"),
factorPastPerformance: dec("0.15"),
}
}
func TestScoreCaptureReadinessIsAnExactWeightedAverage(t *testing.T) {
// every factor at 1.0 and the weights summing to one => the score is exactly 1.0 (no sigmoid distortion).
factors := []captureFactor{
{factorStaffingReadiness, dec("1"), ""},
{factorMarketWinLikelihood, dec("1"), ""},
{factorIncumbencyPosition, dec("1"), ""},
{factorPastPerformance, dec("1"), ""},
}
score, trace := scoreCaptureReadiness(captureWeights(), factors)
if !score.Equal(dec("1")) {
t.Fatalf("all factors at 1.0 must score exactly 1.0, got %s", score)
}
if len(trace) != 4 {
t.Fatalf("the trace must carry all four factors, got %d", len(trace))
}
// a specific mix: staffing 0.8, market 0.5, incumbency 1.0, past 0.0
// = 0.35*0.8 + 0.30*0.5 + 0.20*1.0 + 0.15*0.0 = 0.28 + 0.15 + 0.20 + 0 = 0.63
mix := []captureFactor{
{factorStaffingReadiness, dec("0.8"), ""},
{factorMarketWinLikelihood, dec("0.5"), ""},
{factorIncumbencyPosition, dec("1.0"), ""},
{factorPastPerformance, dec("0.0"), ""},
}
got, _ := scoreCaptureReadiness(captureWeights(), mix)
if !got.Equal(dec("0.63")) {
t.Fatalf("the weighted average must be exactly 0.63, got %s", got)
}
}
func TestScoreCaptureReadinessMissingWeightIsZeroContribution(t *testing.T) {
// a factor with no stored weight contributes nothing, the safe default.
factors := []captureFactor{{"unknown_factor", dec("1"), ""}}
score, _ := scoreCaptureReadiness(captureWeights(), factors)
if !score.Equal(decimal.Zero) {
t.Fatalf("a factor with no stored weight must contribute zero, got %s", score)
}
}
func TestCaptureBandThresholds(t *testing.T) {
cases := []struct {
score string
want string
}{
{"0.65", "GO"}, // at the GO threshold
{"0.80", "GO"}, // above
{"0.64", "REVIEW"}, // just below GO
{"0.45", "REVIEW"}, // at the NO_GO floor is still REVIEW
{"0.55", "REVIEW"},
{"0.44", "NO_GO"}, // just below the floor
{"0.10", "NO_GO"},
}
for _, c := range cases {
if got := captureBand(dec(c.score)); got != c.want {
t.Errorf("captureBand(%s) = %q, want %q", c.score, got, c.want)
}
}
}
func TestClamp01(t *testing.T) {
if !clamp01(dec("-0.2")).Equal(decimal.Zero) {
t.Error("a negative value must clamp to 0")
}
if !clamp01(dec("1.5")).Equal(dec("1")) {
t.Error("a value above one must clamp to 1")
}
if !clamp01(dec("0.42")).Equal(dec("0.42")) {
t.Error("an in range value must pass through")
}
}
func TestCaptureReadinessRegisteredAndGraphIntent(t *testing.T) {
if _, ok := IntentByName(IntentOpportunityCaptureReadiness); !ok {
t.Fatal("capture readiness must be a registered intent")
}
if !IsGraphIntent(IntentOpportunityCaptureReadiness) {
t.Error("capture readiness must be a graph intent so Answer routes it to AnswerGraph")
}
if IsModelIntent(IntentOpportunityCaptureReadiness) {
t.Error("capture readiness must NOT be a model intent (it is a deterministic composition)")
}
// It renders a GO/REVIEW/NO_GO recommendation and discloses it is not a candidate score.
det := renderCaptureReadiness(dec("0.63"), "REVIEW", []Contribution{
{FeatureName: factorStaffingReadiness, Value: dec("0.8"), Coefficient: dec("0.35"), Contribution: dec("0.28"), Rationale: "x"},
})
for _, want := range []string{"REVIEW", "Capture Readiness Score", "NOT a per candidate match score", "staffing_readiness"} {
if !strings.Contains(det, want) {
t.Errorf("the deterministic render must contain %q, got %q", want, det)
}
}
}
Mathematical records from this source
0102
func TestScoreCaptureReadinessIsAnExactWeightedAverage(t *testing.T)
This relation defines every factor at 1.0 and the weights summing to one in the source section “func TestScoreCaptureReadinessIsAnExactWeightedAverage(t *testing.T)”. It specifies…
Weighted capture-readiness test example
The example multiplies staffing, market, incumbency, and past-performance features by weights 0.35, 0.30, 0.20, and 0.15. The terms sum exactly to 0.63 with the stated inputs. It…