Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ai/capture_readiness_route.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_route.go |
| Original SHA-256 | 44e059d0c07e6d98e8035f42727e21961b80f56dc2b888767e2fa9a13994399e |
| Git blob SHA | 050dc842b6309cce1d4f55590bcd49e7d8aa49ad |
| Reading-copy SHA-256 | 44e059d0c07e6d98e8035f42727e21961b80f56dc2b888767e2fa9a13994399e |
Recovered source transcript
Download complete source text ↓53 lines · 2.4 KB
package ai
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/missionworkforce/missionmatch/internal/platform/security"
)
// THE CAPTURE READINESS ROUTE, WHICH THE COMPOSITION NEVER HAD.
//
// answerCaptureReadiness has existed and been reachable only by ASKING FOR IT IN WORDS: the graph router
// recognises a natural language question about a pursuit and dispatches to it. That is a fine way to answer
// a question and a useless way to build a screen on, because a button cannot phrase a sentence and hope the
// router parses the right opportunity out of it.
//
// The consequence was concrete and it was mine. Phase 3 stores the readiness band and win probability AS
// THEY STOOD when a bid decision was made, which is the whole point of the snapshot. Nothing could fetch
// them for a given pursuit, so the capture review screen offered a decision form with no numbers on it and
// every decision it recorded snapshotted NULL. The record existed and the thing it was supposed to record
// against did not reach it.
//
// This is a READ of the same composition, on the same capability as the brain query, returning the score,
// the band and the ordered factor contributions. It computes no per candidate score and it is not an
// employment decision number; the frozen engine remains the only per candidate scorer.
func (h *Handler) CaptureRoutes(r chi.Router) {
r.With(security.RequireCapability(security.CapBrainQuery)).
Get("/ai/capture-readiness/{opportunityID}", h.captureReadiness)
}
func (h *Handler) captureReadiness(w http.ResponseWriter, r *http.Request) {
if h.orch == nil {
// The graceful posture the rest of this module takes when the inference plane is unconfigured:
// report unavailable rather than pretend, and never invent a number.
writeJSON(w, http.StatusServiceUnavailable, map[string]string{"error": "the brain is not configured on this node"})
return
}
id := chi.URLParam(r, "opportunityID")
if id == "" {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "an opportunity id is required"})
return
}
resp, err := h.orch.answerCaptureReadiness(r.Context(), id)
if err != nil {
// A pursuit in another organization is invisible under RLS and reports as not found, which is the
// correct disclosure: it does not exist FOR YOU.
writeJSON(w, http.StatusNotFound, map[string]string{"error": "that pursuit has no readiness to report"})
return
}
writeJSON(w, http.StatusOK, resp)
}