Repository navigation
feat(corpus): check the bench repositories with their dependencies installed, weekly, and draw a holdout to label blind - #181
Merged
Conversation
…stalled, weekly, and draw a holdout to label blind The corpus installs nothing but MUI for the two MUI apps, so it never sees what types decide. On the same five repositories, with each installed from its own lockfile, dub-web reports 4 no-unknown-prop errors that the plain run does not, and prefer-design-system-component offers 968 fixes in dub-web instead of 589, 9 instead of 7 in shadcn-website and 15 instead of 8 in openstatus-dashboard. None of that was in corpus/snapshot.json. `pnpm corpus --installed` (with fetch, sample, --only and --update) checks the repositories bench/v2 installs, at the commits corpus/repos.json pins, in checkouts of their own under .installed, installed with bench/v2's command (pnpm --frozen-lockfile --ignore-scripts) plus --ignore-pnpmfile. It compares the counts with corpus/snapshot-installed.json and prints what installing changes against the same runs in corpus/snapshot.json. A new `installed` job in the corpus workflow runs it on Mondays and on demand. `pnpm corpus draw --installed` drew corpus/installed-holdout-20261016: 109 of the 12,945 distinct findings, up to 30 per rule, seed 20261016, for a false-positive rate per rule. BRIEF.md is the labelling brief for a reviewer who did not draw it; the labels come in a follow-up, and the installed check prints each rule's rate once they are there.
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.
What was wrong
The corpus installs nothing but MUI for the two MUI apps (
installin corpus/repos.json), so it never sees what types decide: which props and variants a component takes, and whether a native element's attributes fit a design-system component. Users and the hook run onsystem withnode_modulesinstalled. On the five repositories bench/v2 installs, installing each one from its own lockfile changes these counts (node scripts/corpus.mjs --installed, src as on main at 7ca0f69):Colour, spacing, radius and icon-button counts are the same either way. None of these rows was in corpus/snapshot.json, and its blind sample was drawn without types.
What changed
pnpm corpus --installed(also withfetch,sample,--onlyand--update). It takes the repositories inbench/v2/config/repos.jsonat the commits and folders corpus/repos.json pins, checks them out again under$CORPUS_DIR/.installed(the plain runs never see thatnode_modules), and installs each with bench/v2's own command,pnpm install --frozen-lockfile --ignore-scripts, plus--ignore-pnpmfile. The install gets no environment variable that looks like a secret. It runs every corpus run of those repositories except dub-web-package, whoseinitcopies the checkout and would copy the install with it: 11 runs, named<run>-installedso their fingerprints and labels stay apart from the plain runs. It compares the counts with the new corpus/snapshot-installed.json and fails on a change without--update, as the plain corpus does, and prints the table above against corpus/snapshot.json.Weekly CI. A new
installedjob in.github/workflows/corpus.ymlruns on Mondays at 04:41 UTC and onworkflow_dispatch, and writes its report to the job summary. The daily job does not run on the weekly schedule. The concurrency group now includes the schedule, so the two scheduled runs cannot cancel each other. It does not run on pull requests.A frozen holdout,
corpus/installed-holdout-20261016/, drawn withpnpm corpus draw --installed --seed 20261016 --per-rule 30: 109 of the 12,945 distinct installed findings, up to 30 per rule, so each rule gets a rate of its own:The folder has the labeller's input (
sample-unlabelled.json: no fix, severity or label), the key, the allocation with the onsystem commit and a population hash, a README with the method and the commands that rebuild it, and BRIEF.md, the labelling brief: what the labeller may read, must not open (the key, the allocation, corpus/labels.json, both snapshots, the earlier sample) and writes. It is not labelled yet. Oncesample-labelled.jsonis there,pnpm corpus --installedprints each rule's false-positive rate with a 95% Wilson interval, and whether every drawn finding is still reported. Its labels stay in that folder: test/readme.test.ts and site/scripts/generate.mjs expect one blind draw in corpus/labels.json.scripts/corpus-lib.ts:
installedRepos(refuses an install without--frozen-lockfileand--ignore-scripts, or anything but pnpm),typeDrivenandtypeDrivenTable,distinctFindings(the README's definition: no re-check with a config, only what a root run adds),drawHoldout,wilsonandruleRates.outsideis now generic over the finding type.The finding proposed pinning
@types/reactand the primitives per repository. Reusing bench/v2's lockfile installs instead covers every type the apps use, at the versions they use, with nothing new to pin. The finding's figures (66 vs 56 prefer-design-system-component fixes in shadcn) came from an older main; the table above is today's.CI time
Measured on this Mac, which other jobs share (1-minute load between 4 and 29 during the runs):
That is about 3.4 minutes once a week. Nothing is cached, since the installs take gigabytes. The first Monday run, or a manual one, will show the runner's figure.
How it was tested
test/corpus-installed.test.ts, 15 tests: the installed repositories and runs from the real configs; the install command checks; that the installed snapshot covers every bench repository and shows ano-unknown-propcount and aprefer-design-system-componentfix count that only types give;typeDriven; the workflow's weekly job;distinctFindings,drawHoldout(same seed, same draw, whatever the order) and the Wilson interval, which matches the earlier sample's stats.py (9 of 80: 6.0-20.0%); and the holdout's own files: allocation, fingerprints, no fix, severity or label for the labeller, and the brief's list of files not to open. Run against main's scripts and corpus files, all 11 of its tests that exist there fail (the four per-holdout tests need the folder):installedReposdoes not exist and neither does corpus/snapshot-installed.json.node scripts/corpus.mjs --installed: "Counts match corpus/snapshot-installed.json.", the root runs report what their project runs do, file for file, and "Holdout installed-holdout-20261016: 109 of its 109 findings still reported."node scripts/corpus.mjs --only saas-starter --only chatbot --only shadcn-ui --only openstatus --only dub(plain): "Counts match corpus/snapshot.json." The corpus job on this pull request runs every plain run.drawinto another folder wrote byte-identicalsample-unlabelled.json,sample-key.jsonandallocation.json.pnpm install --frozen-lockfile --prefer-offline,pnpm format:check,pnpm lint,pnpm typecheck,pnpm test(74 files and 972 tests passed, 3 skipped) andpnpm build.No changeset: scripts, CI and corpus data only, nothing in the published package.
Follow-ups
pnpm corpus --installed, the weekly job and the holdout. It is outside this change's files.pnpm corpus --installed --update. If a change takes out a holdout finding, draw a fresh holdout with a new seed.no-unknown-variantreports nothing in these five repositories even with types, so the Radixtype="multiple"false positive is not in this corpus. Its unit test with real Radix types stays with OS2-02.Roadmap item: OS2-39.