Repository navigation
Conversation
|
Hi @Copilot! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
…deprecation Co-authored-by: robhogan <[email protected]>
| ### TypeScript Example (`metro.config.ts`) | ||
|
|
||
| ```typescript | ||
| import type {ConfigT} from 'metro-config'; |
There was a problem hiding this comment.
Types for input config should be InputConfig - it's not necessary to supply a hydrated ConfigT
There was a problem hiding this comment.
Fixed in 9ac5390. Changed both TypeScript examples to use InputConfigT for user config objects and ConfigT for the hydrated config passed to config functions.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Co-authored-by: robhogan <[email protected]>
9ac5390 to
5141e0f
Compare
…ation (#1632) Summary: Update docs to reflect recent additions to config file support Pull Request resolved: #1632 Test Plan: Ran new TypeScript merging example through `tsc` to check it Reviewed By: vzaidman Differential Revision: D89770691 Pulled By: robhogan fbshipit-source-id: 4d3f7d7771cc35b0d26c8703a6e3645ae5da68ae
## 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](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](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](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](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](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](pytorch/pytorch#196869) and [facebook/metro #1632](react/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 #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 - [x] `make ci`: exit 0 - [x] 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. - [x] `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`. - [x] 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. - [x] A dry run dropping the 384 fixtures from the tree: the three corpus tests failed as listed, and the tree was restored. - [x] The precision checks above, against GitHub pull requests. ## References - Related: #5 (closed), which set the 2022-01-01 cutoff that this keeps. - Related: #33, which will measure on these labels.
Co-authored-by: robhogan [email protected]
Stack created with Sapling. Best reviewed with ReviewStack.