Gate every merge on a replay sweep over the corpus - #22
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 runscorpusin --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.jsonwrites 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.