Skip to content

test: grow the corpus to 400 fixtures per authorship category - #14

Merged
webern merged 6 commits into
mainfrom
claude/funny-edison-xprjfp
Sep 24, 2026
Merged

webern merged 6 commits into
mainfrom
claude/funny-edison-xprjfp

Conversation

@webern

@webern webern commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

The test corpus goes from 30 hand-picked files to 1,230. The 30 originals move to tests/corpus/core/ untouched, and three new directories hold 400 fixtures each, sorted by who wrote the file:

  • human/: not edited since 2021. Every commit that touched the file predates 2022-01-01.
  • llm/: every commit that touched the file carries an AI agent's mark: a co-author trailer, an agent's bot account, or the text an agent writes into its commit messages. 359 of the 400 were begun in 2026.
  • mixed/: begun by a person before 2022, and later edited by an agent.

The label comes from the file's own git history, not from reading its text. Issue #5 suggested a detector with a confidence level. Text detectors are unreliable on short technical Markdown and would need a service to run, so this uses commit provenance instead: it is direct evidence, though it gives no percentage. Each sidecar records the evidence behind its label (commit counts, dates, how many commits are marked, and which agents), so anyone can apply a stricter rule later.

Variety was the main goal. Within a category every fixture comes from a different repository, 962 owners in all. They come from GitHub (1,045), GitLab (81), Codeberg (60) and Hugging Face (14). Repos were found through Sourcegraph, GitHub topic pages (knitting, conlangs, genealogy, the demoscene and so on), the forges' own listings, and the crates.io and npm registries. The selection takes repos from each source in turn, so no one source crowds out the rest. The agents represented include Claude Code, Copilot, Cursor, Codex, Gemini, Jules, Devin and Aider. About 5% of fixtures are not English (Chinese, Korean, Japanese, Cyrillic), so the lints meet other scripts. Only permissive licences are accepted, read from the licence file at the quoted commit.

Sidecars move to version 2: the source and its permalink, the licence and the files it was read from, the history, the label and the reason for it, and facts about the bytes (sha256, kind of document, encoding, line endings, frontmatter, rough natural language). The loader checks everything it can against the bytes, and checks that no file is quoted twice.

The matrix of configs and layouts still runs on core/. Two new tests run the whole corpus in its real layout, once under a byte budget and once under an emphasis limit. A third test requires each collected category to hold at least 350 fixtures.

scripts/llm-detection/collect.py finds, clones, labels and selects the fixtures, and can rebuild or grow the corpus. It is Python using only the standard library, and it is run by hand, never by make or CI. The build doctrine now allows both it and the corpus as exceptions: the corpus is capped at about 400 fixtures of at most 64KB per category. The fixtures are 9.9MB and the sidecars 1.9MB.

Two other changes came out of this:

  • The corpus found a bug. The emphasis report rounded the percentage to nearest, so a SKILL.md at 1.004% against a 1% limit failed while saying "covering 1.00%". The shown figure now rounds up, and there is a test for it.
  • Cargo.toml now uses an include list instead of exclude. _typos.toml and .gitignore were being published, and a list of what to keep means the corpus can never slip into the crate.

Testing

  • make ci: exit 0, 55 tests
  • make check-publish: the packaged crate builds from the new include list
  • collect.py describe rebuilt the core sidecars from each file's upstream history and checked the bytes match upstream

References

Move the hand-picked fixtures into tests/corpus/core/ and make room
for three collected categories: human/, llm/ and mixed/. A file is
labelled from its own git history: human if quoted before 2022-11-30,
llm if every commit carries an AI agent's mark, mixed if it has both
early unmarked commits and later marked ones.

Sidecars move to version 2. They record the source and its licence,
the file's history, the label and why, and facts about the bytes,
including a sha256 the loader checks. The core sidecars are
regenerated from the history of each file.

scripts/corpus/collect.py finds, clones, labels and selects fixtures.
The build doctrine now allows it, and the corpus itself, as
exceptions.

The collected fixtures are not in this commit, so the test that
each category is well stocked fails until they land.
Replace the exclude list in Cargo.toml with an include list: src/,
the manifest, the lockfile, LICENSE and README.md. _typos.toml and
.gitignore were shipping before, and a new file, the test corpus
above all, can no longer slip into the crate by default.

Also follow issue #5 for the corpus collector: move it to
scripts/llm-detection/, and take a file as a person's when it has not
been edited since 2021, so the cutoff is now 2022-01-01. The select
step rechecks harvested files against the cutoff and words the basis
of each label from the file's history.
Read git log output as a stream rather than whole, trim long commit
messages, and skip repositories with more than 40000 commits. A run
over large repositories was running out of memory.
A commit that touched thousands of Markdown files made the collector
copy every other change for each path, and the harvest ran out of
memory. Keep one list of deletions per commit and share it.
The report printed the share of emphasis to two places, rounded to
nearest, so a file at 1.004% against a 1% limit read as "covering
1.00%" while failing. Round the shown figure up instead. The larger
corpus found this in a real SKILL.md.
Add 1200 fixtures quoted from 962 owners: 400 human, 400 llm and 400
mixed, each from a different repository. They come from GitHub (1045),
GitLab (81), Codeberg (60) and Hugging Face (14), found through
Sourcegraph, GitHub topic pages, the forges and the crates.io and npm
registries, and chosen in turn from each source. All are under
permissive licences. About 5% are not English.

- human: not edited since 2021; last edits run from 2018 to 2021.
- llm: every commit carries an AI agent's mark; 359 were begun in
  2026. Claude Code, Copilot, Cursor, Codex, Gemini, Jules, Devin and
  others are represented.
- mixed: begun by a person before 2022, later edited by an agent.

The fixtures are 9.9MB and the sidecars 1.9MB. The collector writes
both from its work directory, so the corpus can be rebuilt or grown
with scripts/llm-detection/collect.py.

Closes #5.
@webern webern added the enhancement New feature or request label Sep 24, 2026 — with Claude
@webern
webern merged commit 2fb7802 into main Sep 24, 2026
2 checks passed
@webern
webern deleted the claude/funny-edison-xprjfp branch September 24, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grow the corpus

1 participant