Skip to content

eval: populate canary source governance report#1099

Merged
BigSimmo merged 1 commit into
mainfrom
codex/canary-governance-report
Jul 23, 2026
Merged

eval: populate canary source governance report#1099
BigSimmo merged 1 commit into
mainfrom
codex/canary-governance-report

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Why

eval:quality --rag-only intentionally has no retrieval results, so its Source Governance table was all zero even though golden-retrieval.json already contained the metadata. This reuses that artifact only for reporting; retrieval metrics and threshold behavior remain unchanged.

Offline artifact proof

Replayed canary run 30018289898:

  • retrieval case count in the answer report: 0
  • source-governance top results: 338
  • review_due: 68
  • unknown status: 3
  • unverified: 156
  • review-required union: 202
  • additional threshold failures: 0

Verification

  • npm run test -- tests/eval-quality.test.ts tests/eval-canary-workflow.test.ts — 2 files, 36 tests passed
  • npm run check:github-actions — passed
  • npm run check:rag:fixtures — passed, 36 golden cases / 21 suites
  • npm run eval:rag:offline — 21 suites, 307 tests passed
  • npm run verify:cheap — 365 files, 3240 passed / 1 skipped
  • npm run verify:pr-local -- --files ... — passed; build correctly skipped as non-build-affecting

Checks not run

  • No live Supabase/OpenAI/RAG evaluation was run; the existing downloaded artifact was replayed locally.
  • No production build or browser suite was run because the PR-local selector classified the change as non-build/UI affecting.

Risk and rollback

The remaining risk is workflow-level artifact availability; the preceding golden-retrieval step owns that file and the loader fails closed if it is missing or malformed. Rollback is the single commit in this PR.

RAG impact: no retrieval behaviour change — evaluation artifact reporting and tests only.


Note

Low Risk
Eval reporting and CI wiring only; retrieval ranking and answer threshold logic are unchanged aside from governance display sourcing.

Overview
Fixes the weekly canary answer-quality report showing all zeros in the Source Governance table while answer metrics still reflected high review-required rates.

eval:quality gains --source-governance-results, which loads the preceding golden-retrieval.json and feeds topResultGovernanceCounts for reporting only. With --rag-only, retrieval case counts stay at zero and retrieval / top-result threshold gates are not applied from that path—only the governance table is filled.

The eval-canary workflow passes .local/eval-canary/golden-retrieval.json into the answer-quality step so retrieval is not run twice. Docs describe the contract; #31 is closed in outstanding-issues.md.

Reviewed by Cursor Bugbot for commit 6adf2c3. Configure here.

Summary by CodeRabbit

  • New Features

    • Source Governance reporting can now use precomputed retrieval results, including during RAG-only quality evaluations.
    • Quality reports retain accurate governance metrics without rerunning retrieval.
  • Documentation

    • Updated evaluation canary documentation with the revised reporting flow and artifact details.
    • Archived the resolved Source Governance reporting issue.
  • Tests

    • Added coverage for precomputed governance results, input validation, and canary workflow configuration.

@supabase

supabase Bot commented Jul 23, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The quality evaluator now accepts precomputed golden retrieval results for Source Governance reporting. The canary workflow supplies that artifact, while RAG-only answer gating remains based on existing RAG results. Documentation and tests reflect the new data flow and validation.

Changes

Source governance reporting

Layer / File(s) Summary
Quality report artifact support
scripts/eval-quality.ts
Adds the --source-governance-results argument, validates and loads retrieval artifacts, and derives governance metrics from supplied results independently of RAG results.
Canary workflow wiring
.github/workflows/eval-canary.yml, docs/observability-slos.md, docs/outstanding-issues.md
Passes golden-retrieval.json into the quality evaluation and documents the resulting Source Governance reporting flow.
Artifact and workflow validation
tests/eval-quality.test.ts, tests/eval-canary-workflow.test.ts
Tests standalone governance metrics, malformed topResults rejection, and workflow argument wiring.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EvalCanary
  participant EvalQuality
  participant GoldenRetrievalJSON
  participant QualityReport
  EvalCanary->>GoldenRetrievalJSON: produce golden retrieval results
  EvalCanary->>EvalQuality: run quality evaluation with artifact path
  EvalQuality->>GoldenRetrievalJSON: load and validate results
  EvalQuality->>QualityReport: compute governance metrics from supplied results
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, rationale, verification, and rollback, but it omits the required Clinical Governance Preflight section for this source-governance update. Add the Clinical Governance Preflight checklist and align the Verification and Risk/Rollback sections more closely with the repository template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: populating the canary source-governance report from the golden retrieval artifact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/canary-governance-report

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo merged commit 9c7d9ed into main Jul 23, 2026
19 of 21 checks passed
@BigSimmo
BigSimmo deleted the codex/canary-governance-report branch July 23, 2026 22:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6adf2c333e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/eval-quality.ts
// 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not let external governance artifacts override live retrieval

When --source-governance-results is supplied during a full eval:quality run, this line computes the Source Governance table and the top-result threshold checks from the supplied artifact instead of the retrieval results produced by the same run. That means a stale or empty artifact can make --fail-on-threshold pass despite current retrieved top results being outdated/review-required, or fail a clean run based on unrelated data; use the external artifact only when retrievalResults is empty (the --rag-only case) or reject this flag outside --rag-only.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/outstanding-issues.md`:
- Line 81: Update the resolution date in issue `#031`’s row to the actual
merge/resolution date rather than the future date currently recorded, while
preserving the existing auditable outcome and all other row content.

In `@scripts/eval-quality.ts`:
- Around line 602-614: Update the report flow around
summarizeGoldenRetrievalResults and topResultGovernanceCounts so
--source-governance-results is accepted only for --rag-only runs; non-rag-only
runs must always use live retrieval results, preserving existing retrieval
gates. In the governance normalization/validation logic near
topResultGovernanceCounts, reject malformed or unknown document_status,
clinical_validation_status, and extraction_quality values or classify them as
review-required rather than zero-risk. Add coverage for both artifact-scope
rejection and invalid governance values failing closed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a3277cd9-6ff9-420e-9a62-b7bc0c424415

📥 Commits

Reviewing files that changed from the base of the PR and between 9378493 and 6adf2c3.

📒 Files selected for processing (6)
  • .github/workflows/eval-canary.yml
  • docs/observability-slos.md
  • docs/outstanding-issues.md
  • scripts/eval-quality.ts
  • tests/eval-canary-workflow.test.ts
  • tests/eval-quality.test.ts


| ID | Type | Summary | Outcome | Resolved |
| ---- | ----- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| #031 | issue | Populate canary Source Governance table | The answer-quality step now consumes the preceding `golden-retrieval.json` only for source-governance reporting. Offline replay of run `30018289898` populated 338 top results, including 202 review-required entries, while retaining zero retrieval cases and no additional threshold failures. Retrieval and ranking behavior are unchanged. | 2026-07-24 |

Copy link
Copy Markdown
Contributor

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 #031 as 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.md is durable memory and resolved rows retain an auditable outcome.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/outstanding-issues.md` at line 81, Update the resolution date in issue
`#031`’s row to the actual merge/resolution date rather than the future date
currently recorded, while preserving the existing auditable outcome and all
other row content.

Source: Coding guidelines

Comment thread scripts/eval-quality.ts
Comment on lines +602 to +614
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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---rag-only runs, changing existing retrieval gate behavior. Also, { document_status: {}, clinical_validation_status: {}, extraction_quality: {} } passes Lines 1219-1221 and is counted as zero-risk because all values are non-null but unrecognized.

Reject --source-governance-results unless --rag-only, and validate/normalize governance fields so invalid or unknown values are rejected or treated as review-required. Add coverage for both cases. The PR contract states retrieval threshold behavior remains unchanged and malformed artifacts fail closed.

Also applies to: 1205-1223

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/eval-quality.ts` around lines 602 - 614, Update the report flow
around summarizeGoldenRetrievalResults and topResultGovernanceCounts so
--source-governance-results is accepted only for --rag-only runs; non-rag-only
runs must always use live retrieval results, preserving existing retrieval
gates. In the governance normalization/validation logic near
topResultGovernanceCounts, reject malformed or unknown document_status,
clinical_validation_status, and extraction_quality values or classify them as
review-required rather than zero-risk. Add coverage for both artifact-scope
rejection and invalid governance values failing closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant