-
Notifications
You must be signed in to change notification settings - Fork 0
eval: populate canary source governance report #1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ export type EvalQualityProviderMode = "openai" | "offline"; | |
|
|
||
| type EvalQualityArgs = { | ||
| fixture: string; | ||
| sourceGovernanceResults?: string; | ||
| ownerEmail?: string; | ||
| ownerId?: string; | ||
| limit?: number; | ||
|
|
@@ -293,6 +294,7 @@ function parseArgs(argv: string[]): EvalQualityArgs { | |
| index += 1; | ||
|
|
||
| if (token === "--fixture") args.fixture = value; | ||
| if (token === "--source-governance-results") args.sourceGovernanceResults = value; | ||
| if (token === "--owner-email") args.ownerEmail = value; | ||
| if (token === "--owner-id") args.ownerId = value; | ||
| if (token === "--limit") args.limit = Number.parseInt(value, 10); | ||
|
|
@@ -597,14 +599,19 @@ function summarizeRagQualityResults(results: RagQualityResult[], providerMode: E | |
| export function buildEvalQualityReport(args: { | ||
| generatedAt?: string; | ||
| retrievalResults: GoldenRetrievalResult[]; | ||
| sourceGovernanceResults?: GoldenRetrievalResult[]; | ||
| ragResults: RagQualityResult[]; | ||
| sourceMetadataDebtAcceptance?: SourceMetadataDebtAcceptance; | ||
| providerMode?: EvalQualityProviderMode; | ||
| }) { | ||
| const providerMode = args.providerMode ?? "openai"; | ||
| const retrievalSummary = summarizeGoldenRetrievalResults(args.retrievalResults); | ||
| const ragSummary = summarizeRagQualityResults(args.ragResults, providerMode); | ||
| const governance = topResultGovernanceCounts(args.retrievalResults); | ||
| // `--rag-only` intentionally leaves retrieval metrics and gates empty. The | ||
| // canary can still supply the preceding golden-retrieval artifact so this | ||
| // report renders its source-governance metadata without rerunning retrieval | ||
| // or changing the answer gate's pass/fail contract. | ||
| const governance = topResultGovernanceCounts(args.sourceGovernanceResults ?? args.retrievalResults); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎.
Comment on lines
+602
to
+614
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Fail closed on artifact scope and governance field values. Line 614 lets a supplied artifact replace live retrieval governance during non- Reject Also applies to: 1205-1223 🤖 Prompt for AI Agents |
||
| const thresholdFailures: string[] = []; | ||
| const providerEvidence = { | ||
| mode: providerMode, | ||
|
|
@@ -1195,6 +1202,32 @@ function asRecord(value: unknown, label: string) { | |
| return value as Record<string, unknown>; | ||
| } | ||
|
|
||
| export function sourceGovernanceResultsFromArtifact(value: unknown): GoldenRetrievalResult[] { | ||
| const artifact = asRecord(value, "source governance results artifact"); | ||
| if (!Array.isArray(artifact.results)) { | ||
| throw new Error("source governance results artifact results must be an array."); | ||
| } | ||
|
|
||
| return artifact.results.map((result, resultIndex) => { | ||
| const record = asRecord(result, `source governance results[${resultIndex}]`); | ||
| if (typeof record.id !== "string" || !record.id.trim()) { | ||
| throw new Error(`source governance results[${resultIndex}] id must be a non-empty string.`); | ||
| } | ||
| if (!Array.isArray(record.topResults)) { | ||
| throw new Error(`source governance results[${resultIndex}] topResults must be an array.`); | ||
| } | ||
| record.topResults.forEach((topResult, topResultIndex) => { | ||
| asRecord(topResult, `source governance results[${resultIndex}].topResults[${topResultIndex}]`); | ||
| }); | ||
| return record as unknown as GoldenRetrievalResult; | ||
| }); | ||
| } | ||
|
|
||
| async function loadSourceGovernanceResults(path: string) { | ||
| const parsed = JSON.parse(await readFile(path, "utf8")) as unknown; | ||
| return sourceGovernanceResultsFromArtifact(parsed); | ||
| } | ||
|
|
||
| function requiredString(record: Record<string, unknown>, key: string) { | ||
| const value = record[key]; | ||
| if (typeof value !== "string" || !value.trim()) throw new Error(`source metadata debt ${key} is required.`); | ||
|
|
@@ -1256,12 +1289,16 @@ async function main() { | |
| const sourceMetadataDebtAcceptance = args.sourceMetadataDebt | ||
| ? await loadSourceMetadataDebtAcceptance(args.sourceMetadataDebt) | ||
| : undefined; | ||
| const sourceGovernanceResults = args.sourceGovernanceResults | ||
| ? await loadSourceGovernanceResults(args.sourceGovernanceResults) | ||
| : undefined; | ||
|
|
||
| const ownerId = await resolveEvalOwnerId(supabase, args); | ||
| const retrievalResults = args.ragOnly ? [] : await runRetrievalQualityCases({ ...args, ownerId, supabase }); | ||
| const ragResults = args.retrievalOnly ? [] : await runRagQualityCases({ ...args, ownerId, supabase }); | ||
| const report = buildEvalQualityReport({ | ||
| retrievalResults, | ||
| sourceGovernanceResults, | ||
| ragResults, | ||
| sourceMetadataDebtAcceptance, | ||
| providerMode: args.providerMode, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the actual resolution date.
This archives
#031as resolved on July 24, 2026, which is tomorrow relative to July 23, 2026. Use the actual merge/resolution date so the durable issue ledger remains auditable.As per coding guidelines,
docs/outstanding-issues.mdis durable memory and resolved rows retain an auditable outcome.🤖 Prompt for AI Agents
Source: Coding guidelines