Skip to content

Gate every merge on a replay sweep over the corpus - #22

Merged
peterbjohnson merged 3 commits into
mainfrom
wb/t21
Sep 21, 2026
Merged

peterbjohnson merged 3 commits into
mainfrom
wb/t21

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member

Every ticket so far was tested on synthetic fixtures and, at most, one tex folder; the first run over a folder of PDFs failed on four basic things (a list-valued selector, a solutions-only file, an image path, line wrapping). Nothing merges again without an end-to-end run over real documents.

Add in2lambda-agent gate BASELINE.json: it runs corpus in --replay mode (no model calls) over the folders the baseline names - to start, UCL_MechEng (pdf), PHYS40002-Mechanics/problem_sheets_and_figures (tex) and MECH60014_Stress_analysis_3 (docx) under the ExampleContents path the baseline gives - with the specs kept in the repository under corpus-specs/ (small YAML files; the corpus itself stays outside the repository and is read at its absolute path), a shared OCR cache at ~/.cache/in2lambda-agent so a worktree reuses the Mathpix output already fetched (add --cache to corpus for this), and a work directory under the system temp directory so the check writes nothing into the worktree. It prints one line per folder - built / faulted / refused / skipped - and exits non-zero when any folder builds fewer documents than the baseline records or any document's outcome is worse than recorded. in2lambda-agent gate --record BASELINE.json writes the current counts; the baseline is committed and changed only in a PR that says why.

Then set the workbench check for this repository to run the gate after the tests: poetry install -q --with dev && poetry run pytest -q && poetry run in2lambda-agent gate gate-baseline.json. Done when the gate passes on main today (record the honest baseline, however low), a change that breaks Worksheet_2's build fails the gate, and the check is in .workbench/workbench.config.json.

Addition from the maintainer: CI is the better gate, because it runs on every push and nobody can merge past it. Keep the local gate over the private corpus as described, and add the same gate to GitHub Actions over a corpus that can be committed: a synthetic set of three tex sheets (questions with lettered parts, a separate solutions file, a figure), one docx, and one PDF produced in the workflow from the tex by xelatex; Mathpix runs on that PDF with MATHPIX_APP_ID and MATHPIX_API_KEY taken from repository secrets, and the OCR output is stored in the Actions cache keyed by the PDF's hash so the call happens once. The workflow installs pandoc, Node, xelatex and poetry, runs pytest, then the gate against a committed baseline, and fails the job on any regression. Document in README which secrets the workflow needs. Then require that job on main with branch protection (gh api repos/{owner}/{repo}/branches/main/protection, required status check = the job's name) so gh pr merge, and so the workbench, cannot merge a red branch. Done when a PR that breaks a build is refused by GitHub, and the local gate still runs over ExampleContents.


Workbench ticket t21.

@peterbjohnson
peterbjohnson merged commit f54e469 into main Sep 21, 2026
1 check failed
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