Skip to content

feat(essay): add governed validation evidence reports - #523

Merged
seonghobae merged 21 commits into
mainfrom
feat/essay-validation-evidence-report
Aug 4, 2026
Merged

feat(essay): add governed validation evidence reports#523
seonghobae merged 21 commits into
mainfrom
feat/essay-validation-evidence-report

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add criterion-specific, source-text-free essay validation evidence reports bound to exact shared assessment, rubric, validation-policy, dataset, automated-engine, and human-reference identities
  • delegate all metric arithmetic to the existing Rust agreement kernel while discarding legacy hard-coded threshold and pass fields
  • require human interpretation, retain descriptive-only correlation boundaries, and route missing human-human or subgroup evidence for review
  • add complete tests, public docstrings, APA 7th equation-to-source documentation, and authoritative changelog material

Scientific boundary

This slice does not establish construct validity, fairness, reliability, scorer interchangeability, model preference, causal utility, or authorization for consequential deployment. Correlation is descriptive only and no universal metric threshold is asserted.

Closes part of #397.

Summary by CodeRabbit

  • New Features

    • Added governed essay-validation evidence reports with traceable provenance, deterministic outputs, supported statistical metrics, and mandatory review indicators.
    • Reports clearly distinguish evidence from validity verdicts, fairness certifications, model-selection decisions, and deployment authorization.
    • Added public exports for report types, report generation, and review-trigger limits.
  • Documentation

    • Added usage guidance, interpretation boundaries, audit considerations, and source-to-equation traceability.
  • Tests

    • Added comprehensive coverage for report generation, validation rules, malformed inputs, metric handling, and review routing.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e2da40dd-960c-4560-b9a9-5ab666437909

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added a governed essay-validation evidence report API. The API validates provenance and engine scope, delegates metrics to Rust, emits immutable deterministic reports, routes mandatory review triggers, and excludes pass/fail decisions. Documentation, tests, exports, and a one-time workflow were added.

Changes

Essay validation reporting

Layer / File(s) Summary
Validation contracts and metric adaptation
python/fast_mlsirm/scoring/essay/validation_reporting.py
Defines sealed metric objects, validates scope and engine authorization, and adapts Rust validation outputs into descriptive metrics.
Evidence report construction
python/fast_mlsirm/scoring/essay/validation_reporting.py, python/fast_mlsirm/scoring/essay/__init__.py, docs/automated_essay_validation_evidence_reports.md, CHANGELOG.md, docs/changelog.d/essay-validation-evidence-report.md
Builds immutable reports with provenance, deterministic fingerprints, observation counts, review triggers, interpretation boundaries, and public exports.
Reporting behavior validation
tests/test_scoring_essay_validation_reporting.py, tests/test_scoring_essay_contracts.py
Tests valid reports, failure cases, Rust delegation, comparator routing, factory sealing, immutability, exports, and documentation.
One-time validation test correction
.github/workflows/one-time-essay-validation-test-fix.yml
Rewrites legacy assertions, runs focused tests, commits the correction, removes the workflow, and pushes the branch update.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant build_essay_validation_evidence_report
  participant validate_judge
  participant EssayValidationEvidenceReport
  Caller->>build_essay_validation_evidence_report: provide validation inputs
  build_essay_validation_evidence_report->>validate_judge: compute Rust-backed metrics
  validate_judge-->>build_essay_validation_evidence_report: return validation outputs
  build_essay_validation_evidence_report->>EssayValidationEvidenceReport: create sealed report
  EssayValidationEvidenceReport-->>Caller: return deterministic evidence
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the addition of governed essay validation evidence reports.
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 feat/essay-validation-evidence-report

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

@seonghobae
seonghobae marked this pull request as ready for review August 4, 2026 17:43

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 3

🧹 Nitpick comments (1)
tests/test_scoring_essay_validation_reporting.py (1)

167-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the expected metric map from gate names, not gate positions.

Lines 168-172 bind each metric to a fixed index in expected.gates. This test is the only guard that the adapter maps Rust values to the correct metric identity. If the Rust kernel reorders gates, the expected map pairs the wrong values, and the assertion can still pass when two reordered values are numerically close.

Build the expected map from gate["name"] through the production name map so the test fails on any reordering.

♻️ Proposed refactor
-    expected_values = {
-        "quadratic_weighted_kappa": expected.gates[0]["value"],
-        "pearson_correlation": expected.gates[1]["value"],
-        "standardized_mean_difference": expected.gates[2]["value"],
-        "human_machine_degradation": expected.gates[3]["value"],
-        "worst_subgroup_standardized_mean_difference": expected.gates[4]["value"],
-        "exact_agreement": expected.exact_agreement,
-        "adjacent_agreement": expected.adjacent_agreement,
-    }
+    expected_values = {
+        validation_reporting._METRIC_NAME_MAP[gate["name"]]: gate["value"]
+        for gate in expected.gates
+    }
+    expected_values["exact_agreement"] = expected.exact_agreement
+    expected_values["adjacent_agreement"] = expected.adjacent_agreement
+    assert set(expected_values) == set(_ALL_METRIC_IDS)
🤖 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 `@tests/test_scoring_essay_validation_reporting.py` around lines 167 - 179,
Update the expected_values construction in the scoring report test to derive
gate values by each gate’s "name", using the production name-to-metric-ID map
rather than fixed expected.gates indices. Keep the direct exact_agreement and
adjacent_agreement expectations, and ensure the resulting keys align with
_ALL_METRIC_IDS so gate reordering causes the assertion to fail.
🤖 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 @.github/workflows/one-time-essay-validation-test-fix.yml:
- Around line 45-49: Update the workflow-repair logic around the old/new
assertion block checks to count both patterns before modifying or deleting the
workflow. Proceed only when exactly one legacy block exists and replace it, or
exactly one corrected block exists with no legacy block; otherwise raise an
error. Ensure the later workflow deletion path runs only after the target file
is confirmed to be in the corrected state.

In `@python/fast_mlsirm/scoring/essay/validation_reporting.py`:
- Around line 470-483: Update the category_count validation immediately before
the validate_judge call to reject values outside the inclusive 2–1000 range,
while preserving the existing exact-integer check and
invalid_essay_validation_category_count error. Ensure validate_judge receives
category_count as k only after both validations pass.

In `@tests/test_scoring_essay_validation_reporting.py`:
- Line 195: Strengthen the privacy assertion in the relevant scoring validation
test by checking the full serialized payload rather than only top-level payload
values. Ensure `_AUTOMATED.tolist()` is absent from the serialized
representation, covering nested structures such as metadata and metrics while
preserving the existing no-label-vector requirement.

---

Nitpick comments:
In `@tests/test_scoring_essay_validation_reporting.py`:
- Around line 167-179: Update the expected_values construction in the scoring
report test to derive gate values by each gate’s "name", using the production
name-to-metric-ID map rather than fixed expected.gates indices. Keep the direct
exact_agreement and adjacent_agreement expectations, and ensure the resulting
keys align with _ALL_METRIC_IDS so gate reordering causes the assertion to fail.
🪄 Autofix

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: 93700b66-8ebc-4a90-af5d-20c1c2b90cb4

📥 Commits

Reviewing files that changed from the base of the PR and between f0d9059 and 22bb21a.

📒 Files selected for processing (8)
  • .github/workflows/one-time-essay-validation-test-fix.yml
  • CHANGELOG.md
  • docs/automated_essay_validation_evidence_reports.md
  • docs/changelog.d/essay-validation-evidence-report.md
  • python/fast_mlsirm/scoring/essay/__init__.py
  • python/fast_mlsirm/scoring/essay/validation_reporting.py
  • tests/test_scoring_essay_contracts.py
  • tests/test_scoring_essay_validation_reporting.py

Comment thread .github/workflows/one-time-essay-validation-test-fix.yml Outdated
Comment thread python/fast_mlsirm/scoring/essay/validation_reporting.py Outdated
Comment thread tests/test_scoring_essay_validation_reporting.py Outdated
@seonghobae
seonghobae merged commit bf15162 into main Aug 4, 2026
32 checks passed
@seonghobae
seonghobae deleted the feat/essay-validation-evidence-report branch August 4, 2026 18:14
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