← Back to Pull requests

feat: disclose the work order and the trained adapter, and gate review status #98

Closed
unknown closed this pull request without merging on Oct 15, 2026 10:12 UTC
View on GitHub
unknown unknown commented on Oct 15, 2026 09:49 UTC
Author

Follow-up to #97. Three gaps remained, all the same shape: a statement that is true about the repository and false about the file you are holding.

1. The human annotation work order had no provenance at all

audit_annotations.py writes HUMAN_ANNOTATION_BACKLOG.md, which quotes up to 60 golden-set question values truncated to 60 characters. That file is the one most likely to be forwarded on its own — to an annotator, into a ticket, to a reviewer — and the sender forwards the Markdown, not the sidecar next to it. It carried no provenance line, and 60 rows of fabricated concentration limits read as regulation.

build_backlog() now resolves --source-dataset through the same dataset_data_provenance() lookup the benchmark and RAGAS writers use, and writes the class, claim status, source path + SHA-256 and the synthetic notice between the title and the question table.

Additive: sample_id, the 60-char summary, row order, the counts and the review-status arithmetic are unchanged. Nothing is labelled. No draft is promoted.

An unregistered source resolves to UNCLASSIFIED and receives UNCLASSIFIED_DATA_NOTICE, which asserts nothing in either direction — not even the reassuring "this is not real regulation". Silence is the dangerous state here: an unlabelled work order gets used as if it were checked. The benchmark/RAGAS writers still emit no notice for unknown datasets; unchanged and pinned by test.

2. The training output was undisclosed

The training input was disclosed in offline/DATA_PROVENANCE.md. The output was not. The adapter is copied into models/, loaded by vLLM and attached to a serving stack, while the fixture it was trained on stays behind. Its README.md listed hyper-parameters and a data path with no statement of what that path contains — which reads as "the regulatory content was checked", and no step in this repository checks it.

New offline/training_provenance.py (no torch/peft imports → testable without a GPU) writes DATA_PROVENANCE.json beside the adapter and renders the same block into the model card. It keeps apart three things routinely conflated:

| block | meaning |
|---|---|
| training_input | what the data is: class, SHA-256, record count, how it resolved |
| training_run | what the script did — self-reported, not independently reproduced |
| capability_evidence | what anyone has demonstrated: regulatory_correctness_evaluated: false, benchmark: null, reviewed_by: null, permanently |

Class is derived, so an unregistered --data_path yields UNCLASSIFIED and no compliance claim. Synthetic input additionally bans use for real formulation compliance / ingredient-restriction / consumer-facing regulatory answers. The training text is untouched.

3. Review status was a checkbox, not a state machine

DATA_REVIEW_BACKLOG.md listed the regulatory claims needing a qualified reviewer as prose rows — no per-assertion state, no reviewer, no date, no source, no version, and nothing stopping anything from being marked reviewed. Every field was editable and no rule said which edit was legitimate, so VERIFIED could be typed by a process that had never read a regulation.

New scripts/validation/regulatory_review.py + REGULATORY_REVIEW_CHECKLIST.json give each of the 15 claim families a state out of PENDING_REVIEW, VERIFIED_WITH_SOURCE, SYNTHETIC_ONLY, REJECTED, BLOCKED_BY_LICENSE — ordered by what they permit, not by how good they sound.

VERIFIED_WITH_SOURCE is reachable only through promote_to_verified(), which demands a named reviewer, a date, a conclusion, a citable source and its version, and refuses:

  • an entry declared a synthetic placeholder — verifying deliberately fabricated text would restate fiction as regulatory truth and produce exactly the half-real corpus the boundaries forbid;

  • LICENSE_UNKNOWN and NO_REDISTRIBUTION — "correct" and "free to quote" are different questions. A test for this caught the implementation letting UNKNOWN through; fixed.

  • any terminal state.
  • Each entry carries: file + record locator, regulatory-shaped field, assertion type, whether it is an explicit synthetic placeholder, standalone-misreading risk, pending authoritative source + version, reviewer/date/conclusion, redistribution licence, final status.

    All 15 ship SYNTHETIC_ONLY; none claims verification. That is the accurate state, not progress: these are fabricated fixtures, so the correct end state is "synthetic only", not "awaiting review".

    Fact correction while measuring locators: the GB 4806 packaging claim occurs only in offline/finetune_data.json record 36, and zero times in the retrieval fixtures. The old table listed it beside the golden set.

    Boundaries held

  • No fixture byte changed — all nine verified SHA-256-identical to 51d3340, including the pinned golden_set.jsonl digest 36cdaf44…c7df.

  • Difficulty distribution unchanged: easy 102 / medium 135 / hard 64.

  • No metric definition, retrieval, rerank, gating or inference path touched; no historical result altered; no Git history rewrite.

  • Raw JSONL rows still carry no inline marker — that is the dataset version change analysed in DATA_REVIEW_BACKLOG.md §1.4, left for a decision. This PR does not make it.
  • Verification boundary (stated, not hidden)

    No GPU training was run, no adapter weights exist in this repository, no model was retrained. The Task 2 checks are code-level: the builder, the renderer, and the real model-card writer driven with mocked arguments. capability_evidence is currently a declaration, not a measurement — converting it to one requires an evaluation of regulatory correctness, which was not performed.

    Verification

    pytest tests/ -q: 3088 passed, 17 skipped · ruff check + format clean · compileall clean · git diff --check clean · check_repo_consistency.py passed · check_public_repository_boundary.py passed · regulatory_review.py --check passed · validate_golden_set 301/301.

    CI gains two steps: the backlog is regenerated and diffed against the committed file (so the disclosure cannot drift from what readers receive), and the review checklist is validated.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Xander-Xai Review duration: 23m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #98"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%