Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/eeo/repo.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/eeo/repo.go |
| Original SHA-256 | 3562db997ab4cb71988694b4dd174d70d961d5126c432853237e9a9fa1526c5b |
| Git blob SHA | bca46237b86134504be2704a1985abe0156b0e6f |
| Reading-copy SHA-256 | 3562db997ab4cb71988694b4dd174d70d961d5126c432853237e9a9fa1526c5b |
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/repo.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/eeo/repo.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓64 lines · 2.4 KB
package eeo
import (
"context"
"errors"
"time"
"github.com/jackc/pgx/v5"
)
// activeModelVersion returns the version string of the AEDT scoring model in force at snapshot time: the
// aedt_model_versions row with the latest effective_from, the same ordering the governance read path
// uses. The compliance role has SELECT on aedt_model_versions (granted in migration 0010). When the
// registry is empty it returns an empty string, which the snapshot stores as the model_version default.
func activeModelVersion(ctx context.Context, tx pgx.Tx) (string, error) {
var version string
err := tx.QueryRow(ctx, activeModelVersionQuery).Scan(&version)
if errors.Is(err, pgx.ErrNoRows) {
return "", nil
}
if err != nil {
return "", err
}
return version, nil
}
const activeModelVersionQuery = `
SELECT version
FROM aedt_model_versions
ORDER BY effective_from DESC, version
LIMIT 1`
// insertSnapshot appends one fairness_snapshots row through the compliance pool inside the tenant tx, so
// RLS scopes the write to the caller's org. The organization_id is taken from the GUC the tenant tx set,
// never from a client value, exactly like the candidate_demographics insert. selection_rate and
// impact_ratio bind as decimals (impact_ratio is NULL for the reference group).
func insertSnapshot(ctx context.Context, tx pgx.Tx, snapAt time.Time, model string, r snapshotRow) error {
var impact any
if r.impactRatio != nil {
impact = *r.impactRatio
}
_, err := tx.Exec(ctx, insertSnapshotQuery,
snapAt, r.decisionContext, r.groupLabel, r.selected, r.total,
r.selectionRate, impact, r.belowThreshold, model)
return err
}
const insertSnapshotQuery = `
INSERT INTO eeo.fairness_snapshots
(organization_id, snapshot_at, decision_context, group_label, selected, total,
selection_rate, impact_ratio, below_threshold, model_version)
VALUES (
NULLIF(current_setting('app.current_org_id', true), '')::uuid,
$1, $2, $3, $4, $5, $6, $7, $8, $9)`
// trendQuery reads every appended snapshot for the caller's org at or after the since instant, ordered
// by bucket then time so each (decision_context, group_label) series arrives chronologically. RLS scopes
// it to the caller's org. impact_ratio is nullable and scans into a pointer.
const trendQuery = `
SELECT decision_context, group_label, snapshot_at, selected, total, selection_rate, impact_ratio, model_version
FROM eeo.fairness_snapshots
WHERE snapshot_at >= $1
ORDER BY decision_context, group_label, snapshot_at`