Repository navigation
feat: harvest a big corpus with sidecar v3 - #52
Merged
Merged
Conversation
harvest now keeps up to 50 files of each label from a repository, picked at random, and asks GitHub about squash-merges as recheck does. It asks GitHub's GraphQL API about every candidate first, so forks, bad licences and huge histories are not cloned. It clones in parallel, reads each history in one pass, checks nearer LICENSE files, and logs failures to retry on the next run. --limit and --deadline bound a run. The big tier holds files up to 128KB, the tree still 64KB. discover is a list of named samplers. Each says if it needs a gh login. New ones search GitHub commits for the marks agents write, and Sourcegraph topics outside software. stage is the one writer of sidecars. Version 3 adds the raw marks, each marked edit with its blob ids, truncation and committer dates. A mixed file names its human twin in before. Each batch may carry repos.jsonl, the ledger of every repository tried. select now samples the tree from the big tier and keeps what is there. pack checks every before. The loaders read versions 2 and 3, check the ledger, and check each before names a live human fixture.
The second batch of the big tier holds 21,075 fixtures from the harvest: 11,473 human, 9,003 llm and 599 mixed. It also excludes the 384 fixtures of the first batch whose label recheck no longer proves, 204 llm and 180 mixed. select drops those from the tree and fills each label back to 400 from the big tier. human does not change. The golden files move by the fixtures dropped and added, and by nothing else. The tally of deslag fix over the corpus is pinned again: 6,443 of 7,423 banned characters fixed, 358 fixtures fixed whole. Two are now left because the character is drawn as one with the one beside it. A new llm fixture sits under .vscode/, which a global git excludes file may ignore. The corpus tests now write a .ignore that ignores nothing, so every machine walks the same files.
v2 adds the layer for batch 2026-09-27-02 and reuses the layer of the first batch as it is.
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.
Summary
This grows the corpus's big tier from 1,200 fixtures to 21,891 live ones. It adds a second batch,
2026-09-27-02, with 21,075 fixtures from a new harvest: 11,473human, 9,003llmand 599mixed. The same batch excludes the 384 fixtures of the first batch thatrecheck(#46) no longer proves. The tree is resampled so each label still holds 400.To get there,
collect.pychanged in five places:discoveris now a list of named samplers. Each says whether it needs aghlogin and skips itself without one. The new ones search Sourcegraph for agent files and for topics, some outside software, and search GitHub commits for the marks agents write.harvestasks GitHub's GraphQL API about every candidate first, 100 at a time, so forks, bad licences and huge histories are never cloned. It clones in parallel, reads each history in one pass, checks a nearerLICENSEthan the root one, logs failures and retries them on the next run, and asks GitHub about squash-merges asrecheckdoes. It keeps up to 50 files of each label from a repository, at random, and always keeps amixedfile'shumantwin.--limitand--deadlinebound a run.stageis new, and it is the one writer of sidecars. It writes version 3 sidecars and the batch'srepos.jsonl, the ledger of every repository the harvest tried.packchecks that everybeforenames a livehumantwin.selectsamples the tree from the big tier, keeps what is still live, and refills each label.Sidecar version 3 adds the raw evidence behind a label: each mark as written (
text,tool,kind,place,commits), each marked commit's change to the file with its blob ids (edits),truncated, and the committer dates. Amixedsidecar may addbefore, which names itshumantwin (the same file at the last commit before 2022) and the commits between that are not an agent's. The loaders accept versions 2 and 3, check the ledger against the manifest, and check that everybeforenames a livehumanfixture.The big tier now holds files of 128KB at most; the tree stays at 64KB.
docs/design/corpus.mdhas a new Register section (there is nobaselinelabel; register is a facet ofhuman, taggedsg-register:), the twin rule, and the per-repository cap.docs/design/corpus.asbuilt.mdandscripts/blobstore/blobs.mddescribe the new batch, the ledger and the discovery samplers.blobs.mdnow gives the image a budget of 250MB unpacked.Discovery
discoverfound 70,418 distinct repositories, 67,878 of them on GitHub. A repository found by several samplers counts once in the total and once for each sampler below.sourcegraph-agent-filesCLAUDE.md,AGENTS.md,GEMINI.md,.github/copilot-instructions.md,.claude/commands, agents and skills,.cursor/rules/,.kiro/,.windsurfrulessourcegraph-topicsgithub-commit-markscrates.iogitlab-starshuggingfacecodeberg-starsnpmLimits:
humanfile per repository, and nollm.Pilot
200 repositories in
sourcesorder took 127 seconds. 39 more were skipped on GitHub's metadata before any clone. They gave 724human, 116llmand 13mixedfiles, 11 of themixedwith their twin.human, 2.9llmand 0.38mixedeach.humanfiles each; Hugging Face nearly none.The pilot showed that time would not bind the run; bytes would. At the rate the whole run went, 4 to 6 hours of harvest would have come to 350 to 500MB, well past the 250MB budget.
The run
The harvest ran in legs, to steer toward the rarer sources, and one leg was a retry:
priorityorder takes first the repositories an agent was found in that began before 2022, since only they can givemixedfiles; then the other agent repositories; then the rest. Within each, the sources take turns, a repository standing for the rarest source that found it. Discovery ran for about 4 hours alongside the legs.Leg 3b was slow because its repositories lean on squash-merges, and the harvest asks GitHub about those at most 4,800 times an hour, under its limit.
What the ledger says about the 3,232 repositories tried:
human, 64,039llmand 739mixed. Kept: 11,473, 9,003 and 599. Past the cap of 50, 3,938llmfiles were not asked about.tmorin/plantuml-libs), 2,879 under a nearer licence that is not allowed, and 1,792 whose bytes a merge commit changed.stagethen left out 1,022 files whose bytes another fixture already has, 68 whose origin the first batch holds, and 59 over 128KB.The batch
mixedfixtures have theirhumantwin. 6 lost it instage, where the twin was left out, and 119 never had one: nohumanrevision of the file qualified at the cutoff. For most of those, the repository had no licence GitHub recognises at the cutoff.llmby tool: Claude Code 5,254, Copilot 1,516, Cursor 752, Codex 620, Amp 352, Devin 331, Jules 205, OpenHands 190, opencode 136, Kiro 77, Aider 48. Six tools have 300 or more.mixedby tool: Claude Code 412, Copilot 116, Cursor 73, Codex 20, and 4 each for Jules, Amp and Devin.human, 967llmand 81mixed.Bytes: 142,677,577 of Markdown and 203,442,958 in all (sidecars about 50MB, the manifest 9.3MB, the ledger 1.2MB). With the first batch the image is 215MB of its 250MB budget.
Sizes and the cap
Every file the harvest read has its size recorded, 22,261 in all: median 3,305 bytes, p90 15,551, p99 77,728, p99.9 367,767, largest 2,574,278.
By label at 128KB:
human0.57% of files and 24.7% of bytes,llm0.15% and 7.4%,mixed2.18% and 37.4%. At 64KB,mixedwould lose 5.3% of its files. So the cap is 128KB: it costs few files, andmixedfiles, which tend to be long, keep most of theirs. Many of the files over it are changelogs and link lists.Exclusions
The batch excludes the 384 fixtures
recheckfound in #46: 204llmand 180mixed, nonehuman. 339 of them rest on a squash of several commits, which cannot say who wrote one file. Most of the other 45 rest on a commit whose mark the rules of section 3 no longer accept, 2 on a bot's commit and 3 on text older than its history. Each line ofexclude.jsonlgives the reason.The tree
selectkept every fixture still live and filled from the big tier.select --checkpasses. The floors hold: 400 in each label (the floor is 350), 18 layouts (the floor is 10), and the character test'sllm >= 4 * humanat 248 against 4 * 57 = 228 (it was 241 before). The tree now holds 204llmand 180mixedsidecars at version 3, and 147 of thosemixedname a twin.Golden files
make fix-goldenmoved onlyllmandmixedlines. Every changed line is a fixture dropped or added; no fixture that stayed changed its measurement, andcoreandhumandid not move.banned_charsbanned_phrasesdensitymax_emphasismax_size_bytesrepo_layoutThe
deslag fixtallytests/corpus.rspins whatdeslag fixdoes to the tree (#51), so the numbers are pinned again:The last row is new: a corpus edit now reaches the grapheme check and is refused there.
Precision
A sample of the batch was checked against GitHub's own record, not the clone the harvest read. For each fixture: GitHub's list of the commits that touched the file up to the quoted commit, labelled again from their authors, committers and messages with the same rules and the same squash-merge questions; the bytes GitHub serves at that commit; for
human, that no commit is late or marked; and forllm, that GitHub says the oldest commit added the file rather than renamed it. One fixture per repository in each stratum, 30 where there were 30 repositories.humanis split by register, andllmandmixedby the kind of evidence: an agent's identity, a session trailer only, or a squash-merge GitHub proved.All 239 labels hold, and GitHub serves the same bytes for every one. In 11 the commits differ, though the label GitHub's list gives is the same:
cksystemsteaching/selfie/README.md). The harvest reads the whole history in one pass, so a file's history holds every commit that changed it on any branch. GitHub's list for a path leaves out a side branch whose changes a merge did not take.valve-tech/reth, GitHub lists a copy of it instead, with the same change, author date and message under another hash; intui-cs/Terminal.Gui, it is an ancestor of the quoted commit that changed the file, on a branch GitHub's list leaves out.The image
v2 is published and pinned:
ghcr.io/webern/deslag-blobs:v2@sha256:33d0d99e2d588f31d7d69563d62599486bcd1e89fe8efcfed6fcdf047d6fca00. It reuses the first batch's layer as it is, and adds one layer,corpus/batches/2026-09-27-02, which holds only the batch's 21,075 fixtures, their 21,075 sidecars, and itsmanifest.jsonl,exclude.jsonlandrepos.jsonl.From a cold cache (
.blobs/moved aside),make fetch-blobsunpacked v2 in 26 seconds, the unpacked tree was identical to the one published, andmake test-blobspassed.Other changes
.vscode/, which some machines' global excludes ignore, so those machines walked a different corpus.place_realnow writes a.ignoreof!*, which takes precedence over the global file, so every machine walks the same files.tests/blobs.rsbuilds its small batches from fixtures with nobefore, since the tree now holds some, and turns a sidecar into version 2 where a test needs one.corpus.md, the example commit links in the marks table are cut to 10 hex characters, to keep the doc in its 16384-byte budget.Deviations
mixedfixtures have a twin, a little under the 500 hoped for. The lastpriorityleg gave 79mixedfiles along with about 3,200 others, some 30MB, so more would have spent the budget's headroom.qualifiedin the ledger counts, forllmandmixed, the files whose commits prove the label. The check for text older than its history runs only on files that are read, soqualifiedoverstatesllmby what that check would drop.found_byis the repository's first source only; the ledger lists all of them. So a register analysis should read the ledger: 263 fixtures carrysg-register:in their sidecar, while register repositories gave 2,593.mixedlabel may rest on an agent's commit on a side branch whose change a merge did not take. GitHub's list agreed on the label for all 69mixedfixtures checked, but a later change could read the history as the file's own line of descent instead.Left for later
--deadline, and maybe a lower cap forhuman: it has 11,473 fixtures, well past the 3,000 to 5,000 hoped for, and the image has 35MB of budget left.llmfiles past the cap were not asked about. A later run can take them if a repository is worth more than 50.Testing
make ci: exit 0make fetch-blobsunpacks v2 byte for byte as published, thenmake test-blobspassesmake test-blobs: every fetched batch keeps the rules, every tree fixture is in the big tier with the same sidecarcollect.py select --check: the tree is the sample it would takescripts/blobstore/blobs.sh plan: the first batch is the same layer, the second is new; it took 10 seconds over both batchesReferences