Skip to content

feat: prove corpus labels from anchored marks - #46

Merged
webern merged 2 commits into
mainfrom
m/deslag-labels
Sep 27, 2026
Merged

webern merged 2 commits into
mainfrom
m/deslag-labels

Conversation

@webern

@webern webern commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

deslag's corpus is Markdown quoted from public repositories. Each file, a fixture, is labeled human, llm or mixed from its git history: which commits touched it, when, and whether an AI agent made them. The lints are measured against those labels, so a wrong label is a wrong measurement.

The rule behind the labels was too loose. It looked for tool names anywhere in a commit, so a mention, a suggestion a person accepted, or a squash of many commits could make a file llm or mixed. This PR replaces it with a table of the marks each agent writes itself, matched only where the agent writes them. A GitHub squash-merge proves its marks only when GitHub shows that every commit of its pull request carries one. Then it rechecks every fixture of the big tier against the new rule, from full-depth clones: 384 of the 1200 no longer hold (204 llm, 180 mixed, no human).

The 384 exclusions ship with the next harvest, in one batch with the fixtures that replace them, and the tree drops and refills in that same change. Dropping them now would take llm to 196 fixtures and mixed to 220, under the 350 per label that tests/corpus.rs requires. So this PR publishes nothing: no new image, and no change to blobs.lock, tests/corpus/ or the golden files.

What ships:

  • The new rule, in scripts/llm-detection/collect.py (MARKS, label_history) and docs/design/corpus.md section 3, with the table of marks and a real commit for each.
  • PullRequests in collect.py, which asks GitHub what a squash-merge's pull request held.
  • collect.py recheck, which clones each repository the big tier quotes, derives every live label again, and writes the ones that fail to exclude.jsonl in its work directory.
  • collect.py pack --exclude, which writes those exclusions into a new batch.
  • A test that a batch may hold exclusions alone, and docs/design/corpus.asbuilt.md brought up to date.

What was wrong

The old rule searched the author, the committer and the whole message for tool names. So:

  • A mention counted. lima-vm/lima a4ab936 is a person's commit whose message links to google-gemini/gemini-cli. The file it added was labeled llm, written by "gemini". In reisxd/TizenTubeCobalt 8a45a90 a person writes "Fix the build error manually or by Gemini-CLI", and that made the file mixed.
  • A suggestion counted. stellar/rs-stellar-xdr e0d289a squashes a person's pull request of 77 commits and 553 files. One of its Co-authored-by: lines is Copilot Autofix, a fix a person accepted in review. Its file was labeled llm.
  • A squash counted. A squash carries the marks of all its commits but cannot say which of them wrote a given file.
  • A squash-merge hid its commits. GitHub ends a squash-merge's subject in "(#N)", and its message may look like a single commit's. Kometa-Team/Kometa 94d7c16 carries the Copilot agent's mark, and its file was labeled llm, but pull request #3497 held five commits, and a person's commit in it touched the file. In nrwl/nx 8cec6ce, pull request #31380 held two commits, and neither carries an agent's mark.
  • A shallow clone hid when a file began. The harvest cloned with --shallow-since=2018-01-01, so an older file seemed to begin at that boundary. 69 of the 400 mixed sidecars say the file was "begun by a person, unmarked" on a day in January 2018, and 47 human sidecars record a first commit then. For llm, a cut history could hide a person's older commits.
  • "Before 2022" went by the author date alone, though a commit can be authored long before it is committed.

The new rule

  • human: every commit that touched the file is a person's from before 2022-01-01, by both its author date and its committer date, and none carries any mark.
  • llm: every commit is an agent's, and the file's text is no older than that history.
  • mixed: at least one commit is a person's from before 2022-01-01 with no mark, and at least one is an agent's.
  • A commit by a bot rules out every label.

A commit is an agent's when it carries a mark that counts and is not a squash. A mark is a regular expression matched in one place: identity (the author, the committer, or the value of a Co-authored-by: trailer), trailer (another line of the trailer block that ends the message), or footer (a line a tool writes into that block, such as "Generated with Claude Code" after a robot emoji). Its kind is agent-identity or agent-session, which count, or assist, which never does. An assist is a tool's suggestion that a person committed.

In short, the 32 marks are:

Tool Counts Assist, never counts
claude-code [email protected], claude[bot], the Claude-Session: trailer, the session link and "Generated with Claude Code" footers
copilot the coding agent's and the CLI's accounts, the Copilot-Session: and Agent-Logs-Url: trailers, the Copilot Workspace footer a review's suggestion, Copilot Autofix, VS Code's [email protected] co-author
cursor [email protected], the Made-with: Cursor trailer, the "Made with Cursor" footer
codex Codex <[email protected]>, [email protected], the codex account
jules, devin, kiro, openhands each tool's own account or address
aider Name (aider), [email protected]
amp [email protected], the Amp-Thread-ID: trailer
opencode [email protected], the "Generated with OpenCode" footer
gemini gemini-code-assist[bot], a review's suggestion
any the Assisted-by: trailer

The full table, with the exact patterns and an example commit for each, is in docs/design/corpus.md section 3.

Three shapes make a commit a squash: two or more paragraphs that open with * , as GitHub lists squashed commits; the header git merge --squash writes; or a last line of nine dashes followed only by trailers, which is how GitHub gathers the squashed commits' co-authors.

A marked commit whose subject ends in "(#N)" is taken for a GitHub squash-merge. It proves its marks only when every commit of the pull request merged as it carries a mark that counts. collect.py asks GitHub with gh api, one request at a time and at most two a second, and keeps the answers in its work directory. When GitHub cannot show the pull request, because none was merged as the commit or GitHub refuses, the commit proves nothing, and a label that needs it fails with its own reason, unverified.

llm also needs the text to be the agents'. When the commit that added the file deleted a Markdown file of the same name, or one that git's rename detection pairs with it, or when a merge added the file, the text may be older than its history, so the file gets no label. A history that ends at a shallow boundary says so in its basis and rules out llm. The cutoff stays at 2022-01-01, as #5 set it.

What the recheck found

collect.py recheck made full-depth blobless clones of all 1072 repositories the big tier quotes and derived each of the 1200 labels again. No repository was gone. The clones took about five minutes with 12 jobs, and the questions to GitHub about 13 minutes.

human llm mixed
holds 400 196 220
a commit that is a squash 153 126
a squash-merge with a commit that carries no agent's mark 25 28
a squash-merge GitHub could not show (unverified) 4 3
a commit marked only by an assist 6 17
a commit that is not an agent's, made after 2022 12
the text moved from another file 3
no agent's commit at all 5
a bot's commit 1 1
excluded 0 204 180

Each fixture is counted once, under one reason. The mention cases above land in "a commit that is not an agent's" and "no agent's commit at all".

The squash-merge rule adds 61 of the 384 exclusions: 26 llm and 35 mixed. 4 of those mixed are counted under "a squash", since they also hold one. 3 llm fixtures that the first pass excluded because their text moved now fail on a squash-merge first.

292 marked squash-merges were asked about. 185 were proven, 119 of them pull requests of one commit. 88 had a commit with no agent's mark. For 18, GitHub shows no pull request merged as the commit: pytorch/pytorch #196869 and facebook/metro #1632, for example, were closed, not merged, and their commits landed another way. 1 request was refused: DataDog/datadog-agent requires SAML access that the token used did not have. The 7 unverified fixtures come from those.

Of the squashes, the first pass found 112 llm and 96 mixed that list the squashed commits and 41 and 25 with only the nine-dashes shape. A pull request of one commit gives that shape too, so I looked up the pull request of each of those 66: none had one commit, and in 36 of them a person's commit in the pull request touched the file.

The floors the exclusions would break

With the 384 fixtures dropped from a local copy of the tree, three tests of tests/corpus.rs fail:

  • every_category_is_well_stocked: llm would hold 196 and mixed 220, fewer than MIN_PER_CATEGORY, 350.
  • the_default_groups_flag_llm_text_far_more_than_human_text: banned_chars would flag 57 human fixtures and 133 llm, and the test needs llm to be at least 4 times human, 228. As a rate it still holds: 68% of llm fixtures against 14% of human.
  • the_corpus_layouts_read_from_the_text_alone: 6 layouts, where it needs 10.

The floors stay as they are. The next harvest has to bring at least 154 llm and 130 mixed fixtures that hold under these rules, and, for the layout test, files with real layouts. The tree was restored after the dry run.

How far the labels that hold can be trusted

Before the squash-merge rule, I took a stratified sample of 123 fixtures that held under an earlier draft of these rules (seed 20260927), and checked each by hand against its commits and pull requests on GitHub:

  • human: 30 of 30 right.
  • llm: 56 sampled, 2 wrong, 5 could not be checked.
  • mixed: 37 sampled, 3 wrong, 1 could not be checked.

Every wrong label in the sample rested on a GitHub squash-merge, and all five are now excluded. No fixture that rests on direct commits was wrong: 0 of 32 llm checked and 0 of 15 mixed.

I also checked every squash-merge a label rested on against a looser test: did a commit of the pull request that is not an agent's touch the file? That found 16 llm and 17 mixed labels wrong, and all 33 are excluded now. The rule in this PR is stricter, since it does not ask which files a commit touched. It also excludes 5 llm and 15 mixed fixtures that the looser test found right.

Deviations and doubts

  • A merge commit inside a pull request, such as a person merging the base branch in, carries no mark, so it makes the squash-merge fail. 13 squash-merges fail only on such commits. They decide at most 2 llm and 3 mixed fixtures.
  • The one unverified fixture from DataDog/datadog-agent fails only because the token used lacks SAML access to that organization. A run with such access would ask again.
  • harvest does not ask GitHub yet. With the rule as it is, it leaves out any file whose label rests on a squash-merge, which costs the next harvest fixtures unless it asks.
  • A Co-authored-by: value is matched as an identity, like the author and committer, not as a trailer.
  • The nine-dashes shape counts as a squash with or without blank lines around the dashes.
  • git's (cherry picked from commit ...) line is read as a footer, so it does not hide the trailers above it.
  • [email protected] is typed as an assist. It comes from VS Code's git.addAICoAuthor setting, which I read as a sign of help, not of an agent's commit.
  • The codex account (267193182) is a User account, not a Bot. It is listed because its profile names it "OpenAI's coding agent", with company OpenAI and a link to openai.com/codex.
  • Some tools have no mark listed, because I could not confirm one the tool writes itself: Windsurf ([email protected] was seen as a co-author), Antigravity ([email protected]), a [email protected] co-author, and Pi. Leaving a mark out can only cost fixtures. It never makes a label wrong, since an unlisted mark makes the commit a person's commit after the cutoff.
  • Copilot's completions were in a technical preview from mid 2021, before the cutoff, and leave no mark. The cutoff stays where Grow the corpus #5 put it.
  • Sidecars are never rewritten once published, so the v1 sidecars that hold keep their old basis, including those that say a file began in January 2018 only because of a shallow clone.
  • A copy of older text into a new file is not caught.

Left for later

  • The next harvest: new llm and mixed fixtures under these rules, then one batch with them and the 384 exclusions, the tree dropped and refilled, and the golden files regenerated, in one change.
  • harvest asking GitHub about squash-merges, as recheck does.
  • New sidecars for v1 fixtures whose basis is wrong about when the file began.

Testing

  • make ci: exit 0
  • Each of the 32 marks' example commits fetched from GitHub. Each carries its mark in the listed place and is not a squash, and a script checked that corpus.md's table matches MARKS row for row.
  • collect.py recheck over all 1200 fixtures of v1 at full depth, then again with the squash-merge rule. A run on the kept evidence and answers takes about 5 seconds and writes the same exclude.jsonl.
  • The squash-merge lookup checked by hand on known cases: two proven pull requests, Kometa #3497 and nx #31380 failing, and the refused DataDog request.
  • A dry run dropping the 384 fixtures from the tree: the three corpus tests failed as listed, and the tree was restored.
  • The precision checks above, against GitHub pull requests.

References

A label came from AI tool names found anywhere in a commit, so a
person's commit that only mentioned a tool counted as the tool's. A
suggestion that a person committed, or a squash of many commits,
counted as an agent's too. And a shallow clone made old files look as
if they began in 2018.

Marks are now a table of the strings each agent writes itself, each
with a kind and a real commit that carries it. A mark is matched only
where the tool writes it: the author, the committer, a co-author, a
trailer or a known footer. An assist never counts and a squash never
proves. A history that a shallow clone cut says so, and a commit is
before the cutoff only by both its author and its committer date.

collect.py gains recheck, which clones each repository of the big
tier and derives every live label again under these rules, and pack
--exclude, which writes the labels that fail into a new batch. A
batch may hold only exclusions, and a test covers that.
GitHub ends a squash-merge's subject in "(#N)", and its message may
look like one commit's. So an agent's mark on it hid the person's
commits of the pull request, and git could not tell.

A marked commit with such a subject now proves its marks only when
every commit of pull request N carries a mark that counts. recheck
and describe ask GitHub with gh api, one request at a time, and keep
the answers in the work directory, so a run again asks nothing twice.
When GitHub cannot show the pull request, the commit proves nothing,
and the label fails as unverified. harvest does not ask yet, so it
leaves such files out.

The design doc now says that exclusions which would take a label
under the tree's floors wait for their replacements and ship with
them.
@webern webern added enhancement New feature or request ai Primarily authored by AI (whether PR, Issue, Whatever) area/build Deals with deslag build, scripts, ci, cd. labels Sep 27, 2026
@webern
webern marked this pull request as ready for review September 27, 2026 03:48
@webern
webern merged commit f245c17 into main Sep 27, 2026
2 checks passed
@webern
webern deleted the m/deslag-labels branch September 27, 2026 03:48
@webern webern mentioned this pull request Sep 27, 2026
6 tasks done
webern added a commit that referenced this pull request Sep 27, 2026
## 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,473 `human`, 9,003 `llm` and 599 `mixed`. The same
batch excludes the 384 fixtures of the first batch that `recheck` (#46)
no longer proves. The tree is resampled so each label still holds 400.

To get there, `collect.py` changed in five places:

- `discover` is now a list of named samplers. Each says whether it needs
a `gh` login 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.
- `harvest` asks 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 nearer
`LICENSE` than the root one, logs failures and retries them on the next
run, and asks GitHub about squash-merges as `recheck` does. It keeps up
to 50 files of each label from a repository, at random, and always keeps
a `mixed` file's `human` twin. `--limit` and `--deadline` bound a run.
- `stage` is new, and it is the one writer of sidecars. It writes
version 3 sidecars and the batch's `repos.jsonl`, the ledger of every
repository the harvest tried.
- `pack` checks that every `before` names a live `human` twin.
- `select` samples 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. A `mixed` sidecar may add `before`, which names
its `human` twin (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 every
`before` names a live `human` fixture.

The big tier now holds files of 128KB at most; the tree stays at 64KB.

`docs/design/corpus.md` has a new Register section (there is no
`baseline` label; register is a facet of `human`, tagged
`sg-register:`), the twin rule, and the per-repository cap.
`docs/design/corpus.asbuilt.md` and `scripts/blobstore/blobs.md`
describe the new batch, the ledger and the discovery samplers.
`blobs.md` now gives the image a budget of 250MB unpacked.

## Discovery

`discover` found 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.

| Sampler | Token | Repositories | Seconds | Notes |
| --- | --- | --- | --- | --- |
| `sourcegraph-agent-files` | no | 31,390 | about 900 | 8 patterns:
`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`,
`.github/copilot-instructions.md`, `.claude/` commands, agents and
skills, `.cursor/rules/`, `.kiro/`, `.windsurfrules` |
| `sourcegraph-topics` | no | 21,510 software, 4,510 register | 11,320 |
about a minute per query |
| `github-commit-marks` | yes | 11,695 | 2,215 | 18 searches, each on 20
random days |
| `crates.io` | no | 2,645 | 113 | by downloads |
| `gitlab-stars` | no | 1,000 | 16 | |
| `huggingface` | no | 1,000 | 3 | |
| `codeberg-stars` | no | 497 | 59 | |
| `npm` | no | 244 | 33 | |

Limits:

- Sourcegraph searches only the repositories it indexes, a slice of
public GitHub, and each query asks only for repositories with a
permissive licence file at the root. A topic query takes the first 300
or 500 results. It needs no token, which is why it leads.
- GitHub commit search returns at most 1,000 results per query, so each
search is cut into single days. Its secondary rate limit fired at 3
seconds between searches, so the pace is now 6 seconds. It interleaves
the searches by day, in random order, so a run cut short still covers
every tool.
- The topic search is slow and coarse. The register topics (books,
courses, essays, law, recipes, wikis, curated lists and the like) gave
337 repositories that the harvest tried.
- GitLab, Codeberg and Hugging Face gave almost nothing: under one
`human` file per repository, and no `llm`.
- crates.io failed at page 215 with HTTP 400, so it now reads pages
under 200.

## Pilot

200 repositories in `sources` order took 127 seconds. 39 more were
skipped on GitHub's metadata before any clone. They gave 724 `human`,
116 `llm` and 13 `mixed` files, 11 of the `mixed` with their twin.

- Repositories with agent files took 8.6 seconds each and gave 6.0
`human`, 2.9 `llm` and 0.38 `mixed` each.
- 24 of 30 commit-search repositories were skipped for having no licence
GitHub recognises.
- Topic repositories gave 8.6 `human` files each; Hugging Face nearly
none.
- A fixture came to about 6.2KB of Markdown and 2.5KB of sidecar.

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:

| Leg | Order and filter | Limit | Seconds | human | llm | mixed |
| --- | --- | --- | --- | --- | --- | --- |
| pilot | sources | 200 | 127 | 724 | 116 | 13 |
| 1 | priority | 500 | 1,019 | 5,726 | 1,234 | 343 |
| 2 | priority | 250 | 441 | 2,720 | 518 | 79 |
| 3 | priority, commit search for every tool but Claude Code | 1,000 |
621 | 905 | 3,586 | 74 |
| 3b | the same, the 309 that failed in leg 3 | 309 | 5,072 | 673 |
3,418 | 108 |
| 4 | priority, register topics | 150 | 1,056 | 432 | 619 | 14 |
| 5 | sources, register topics | 150 | 165 | 631 | 284 | 7 |
| all | | | 8,501 | 11,811 | 9,775 | 638 |

`priority` order takes first the repositories an agent was found in that
began before 2022, since only they can give `mixed` files; 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:

- 2,238 harvested, 989 skipped on GitHub's metadata (801 with no licence
GitHub recognises, 67 GPL-3.0, 27 AGPL-3.0, and so on), 4 gone, and 1
with 60,361 commits, past the limit.
- 4 more failed on network errors and are left for the next run.
- 1,388 gave a fixture to the batch.
- Files that qualified: 59,724 `human`, 64,039 `llm` and 739 `mixed`.
Kept: 11,473, 9,003 and 599. Past the cap of 50, 3,938 `llm` files were
not asked about.
- Dropped while reading: 12,692 whose text may be older than their
history (8,565 of those from one repository, `tmorin/plantuml-libs`),
2,879 under a nearer licence that is not allowed, and 1,792 whose bytes
a merge commit changed.

`stage` then left out 1,022 files whose bytes another fixture already
has, 68 whose origin the first batch holds, and 59 over 128KB.

### The batch

| | human | llm | mixed |
| --- | --- | --- | --- |
| Fixtures | 11,473 | 9,003 | 599 |
| Repositories | 873 | 677 | 238 |

- 474 `mixed` fixtures have their `human` twin. 6 lost it in `stage`,
where the twin was left out, and 119 never had one: no `human` revision
of the file qualified at the cutoff. For most of those, the repository
had no licence GitHub recognises at the cutoff.
- `llm` by 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.
- `mixed` by tool: Claude Code 412, Copilot 116, Cursor 73, Codex 20,
and 4 each for Jules, Amp and Devin.
- By first source: agent files 13,592, commit search 6,165, software
topics 680, register topics 263, crates.io 210, npm 127, GitLab 22,
Codeberg 16. Counted by any source in the ledger, register repositories
gave 1,545 `human`, 967 `llm` and 81 `mixed`.
- 17,834 in English, 3,108 in another language, 133 with no prose to
tell.
- 21,037 from GitHub, 22 from GitLab, 16 from Codeberg.

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.

| Cap | Files over it | Their share of bytes |
| --- | --- | --- |
| 64KB | 1.31% | 27.1% |
| 128KB | 0.43% | 17.6% |
| 256KB | 0.17% | 11.9% |

By label at 128KB: `human` 0.57% of files and 24.7% of bytes, `llm`
0.15% and 7.4%, `mixed` 2.18% and 37.4%. At 64KB, `mixed` would lose
5.3% of its files. So the cap is 128KB: it costs few files, and `mixed`
files, 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 `recheck` found in #46: 204 `llm`
and 180 `mixed`, none `human`. 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 of
`exclude.jsonl` gives the reason.

## The tree

| | human | llm | mixed |
| --- | --- | --- | --- |
| Before | 400 | 400 | 400 |
| Dropped | 0 | 204 | 180 |
| Added | 0 | 204 | 180 |
| After | 400 | 400 | 400 |

`select` kept every fixture still live and filled from the big tier.
`select --check` passes. The floors hold: 400 in each label (the floor
is 350), 18 layouts (the floor is 10), and the character test's `llm >=
4 * human` at 248 against 4 * 57 = 228 (it was 241 before). The tree now
holds 204 `llm` and 180 `mixed` sidecars at version 3, and 147 of those
`mixed` name a twin.

## Golden files

`make fix-golden` moved only `llm` and `mixed` lines. Every changed line
is a fixture dropped or added; no fixture that stayed changed its
measurement, and `core` and `human` did not move.

| Lint | Fails before | Fails after |
| --- | --- | --- |
| `banned_chars` | 469 (llm 241, mixed 165) | 494 (llm 248, mixed 183) |
| `banned_phrases` | 221 (llm 29, mixed 121) | 207 (llm 32, mixed 104) |
| `density` | 279 (llm 92, mixed 126) | 294 (llm 104, mixed 129) |
| `max_emphasis` | 491 (llm 230, mixed 173) | 499 (llm 244, mixed 167) |
| `max_size_bytes` | 166 (llm 25, mixed 106) | 173 (llm 31, mixed 107) |
| `repo_layout` | 2 (mixed 1) | 3 (mixed 2) |

## The `deslag fix` tally

`tests/corpus.rs` pins what `deslag fix` does to the tree (#51), so the
numbers are pinned again:

| | Before | After |
| --- | --- | --- |
| Banned characters | 6,399 in 469 fixtures | 7,423 in 494 fixtures |
| Fixed | 5,400 | 6,443 |
| Fixtures fixed whole | 350 | 358 |
| Left: replacement holds letters or digits | 737 | 732 |
| Left: the edit changes how the file reads | 153 | 143 |
| Left: in HTML | 71 | 56 |
| Left: in frontmatter | 23 | 40 |
| Left: default for a range of characters | 14 | 6 |
| Left: in a URL | 1 | 1 |
| Left: drawn as one with the character beside it | 0 | 2 |

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 for `llm`, 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. `human` is split by register, and `llm` and `mixed` by the
kind of evidence: an agent's identity, a session trailer only, or a
squash-merge GitHub proved.

| Stratum | Checked | Label wrong | Precision, 95% Wilson | Commit list
differs |
| --- | --- | --- | --- | --- |
| human, register | 30 | 0 | 1.000 [0.886, 1.000] | 0 |
| human, software | 30 | 0 | 1.000 [0.886, 1.000] | 0 |
| llm, identity | 30 | 0 | 1.000 [0.886, 1.000] | 0 |
| llm, session | 30 | 0 | 1.000 [0.886, 1.000] | 1 |
| llm, squash-merge | 30 | 0 | 1.000 [0.886, 1.000] | 0 |
| mixed, identity | 30 | 0 | 1.000 [0.886, 1.000] | 5 |
| mixed, session | 9 | 0 | 1.000 [0.701, 1.000] | 2 |
| mixed, squash-merge | 30 | 0 | 1.000 [0.886, 1.000] | 3 |

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:

- In 9, GitHub lists fewer commits than the sidecar counts (for example
129 against 784 for `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.
- In 2, a marked commit of the sidecar is not in GitHub's list. In
`valve-tech/reth`, GitHub lists a copy of it instead, with the same
change, author date and message under another hash; in
`tui-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 its `manifest.jsonl`,
`exclude.jsonl` and `repos.jsonl`.

From a cold cache (`.blobs/` moved aside), `make fetch-blobs` unpacked
v2 in 26 seconds, the unpacked tree was identical to the one published,
and `make test-blobs` passed.

## Other changes

- The corpus tests place fixtures at their real paths, and the walk
honours the global git excludes file. A new fixture sits under
`.vscode/`, which some machines' global excludes ignore, so those
machines walked a different corpus. `place_real` now writes a `.ignore`
of `!*`, which takes precedence over the global file, so every machine
walks the same files.
- `tests/blobs.rs` builds its small batches from fixtures with no
`before`, since the tree now holds some, and turns a sidecar into
version 2 where a test needs one.
- The pace file that the harvest's processes share for GitHub questions
could be left holding two times run together, since a write was flushed
after its lock was let go. It is now flushed first, and a bad value is
read as "now".
- In `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

- The run was 7 legs, not one command, and it stopped at 8,501 seconds
of harvest, not 4 to 6 hours. Bytes bound it, not time.
- 474 `mixed` fixtures have a twin, a little under the 500 hoped for.
The last `priority` leg gave 79 `mixed` files along with about 3,200
others, some 30MB, so more would have spent the budget's headroom.
- 309 repositories of leg 3 failed on the pace-file bug above. They were
retried in leg 3b, and 3 of them failed again on the network.
- `qualified` in the ledger counts, for `llm` and `mixed`, the files
whose commits prove the label. The check for text older than its history
runs only on files that are read, so `qualified` overstates `llm` by
what that check would drop.
- A sidecar's `found_by` is the repository's first source only; the
ledger lists all of them. So a register analysis should read the ledger:
263 fixtures carry `sg-register:` in their sidecar, while register
repositories gave 2,593.
- The full-history reading above means a `mixed` label 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 69 `mixed` fixtures checked,
but a later change could read the history as the file's own line of
descent instead.

## Left for later

- A byte budget for a harvest run, in place of `--deadline`, and maybe a
lower cap for `human`: it has 11,473 fixtures, well past the 3,000 to
5,000 hoped for, and the image has 35MB of budget left.
- The 4 repositories that failed on the network are retried on the next
run.
- 3,938 `llm` files past the cap were not asked about. A later run can
take them if a repository is worth more than 50.

## Testing

- [x] `make ci`: exit 0
- [x] From a cold cache: `make fetch-blobs` unpacks v2 byte for byte as
published, then `make test-blobs` passes
- [x] `make test-blobs`: every fetched batch keeps the rules, every tree
fixture is in the big tier with the same sidecar
- [x] `collect.py select --check`: the tree is the sample it would take
- [x] `scripts/blobstore/blobs.sh plan`: the first batch is the same
layer, the second is new; it took 10 seconds over both batches
- [x] Precision against GitHub's own record, per stratum (above)

## References

- Related: #16, #18, #33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Primarily authored by AI (whether PR, Issue, Whatever) area/build Deals with deslag build, scripts, ci, cd. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant