Skip to content

Commit 4ceae9a

Browse files
committed
refactor: L161 on #2477 (four more lock readers)
Assisted-by: Claude Code
1 parent 6a1e885 commit 4ceae9a

2 files changed

Lines changed: 155 additions & 7 deletions

File tree

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
[agent] 2026-12-03: architecture refactor
2+
3+
**`main`:** d987721 (unchanged since the last entry). The run started at 14:56Z.
4+
5+
### Chosen
6+
No PR this run. Three routine PRs were open at the start and at 15:24Z: #2453, #2458 and #2461, each `ready`, none updated since the last entry. No maintainer has commented on the discussion. With three open, step 3 applied: open none, verify leads.
7+
8+
No lead was marked `to verify`. The one `arch-audit` issue changed since the last sweep is #2480, which gained its triage labels and no comment. So the run took the "not run" lines the last entries carried: the lock formats #2477 lists, PDM and Pipenv for #2474, and a patched root above a nested project under `vex`. Between them it read the areas the entries mention least, and found each handled.
9+
10+
One finding, **on #2477 as a comment**: four more lock readers take a lock they cannot parse for no lock, so the prune drops the record there too. Run with real PDM and a real `git merge`. The other cells are clean.
11+
12+
### PR
13+
None opened. #2453, #2458 and #2461 await review. No code was pushed anywhere.
14+
15+
### Leads and issues
16+
17+
**L161, confirmed, on #2477 (a comment): `pdm.lock`, `Pipfile.lock`, `pylock.toml` and `vlt-lock.json` are read as "no lock" when they do not parse, and the prune drops the records of what they list.** The issue's plan names Composer, Cargo, uv, Poetry and pnpm as the readers that need a diagnosis for its rule to reach them. These four are the same shape (`inventory_pdm_lock`, `inventory_pipfile_lock` and `python_lock_inventory` drop the parse error with `.ok()?`, core `vendor/lock_inventory/pypi.rs`; the vlt reader has the reason and the inventory takes the half without it, `lock_inventory/vlt.rs`).
18+
19+
Real PDM 2.29.8 and git 2.43.0, the binary of d987721, a stand-in patch API that offers nothing. A colleague's branch adds `itsdangerous==2.2.0` with its record and re-locks; my branch re-locks to a newer click; the merge conflicts in `pdm.lock` alone:
20+
21+
| Step | Result |
22+
|---|---|
23+
| `scan --sync --yes`, mid-merge | "Found 1 package (1 python)", "GC: pruned 1 manifest entry and removed 2 orphan files (69 B).", exit 0; no line names the record or `pdm.lock` |
24+
| the same with `--dry-run --json`, then `--json` | `status: success`, `warnings: null`; a `verified` event with `details.manifest: true`, then a `removed` one |
25+
| `git checkout --theirs pdm.lock && pdm install`, `apply`, `apply --check` | `itsdangerous` installed from the registry; "No patches to apply.", "No patches to check." |
26+
| the merge commit against the colleague's branch | `.socket/`: 3 files changed, 25 deletions |
27+
| control: the lock resolved before the scan | "3 packages from project lockfiles are not yet installed (lockfile-only)", record and blobs kept |
28+
29+
The other locks, each beside an npm project with two applied records and one record for a package the lock lists and nothing installs:
30+
31+
| Lock | Readable | A conflict | Cut short | The run says |
32+
|---|---|---|---|---|
33+
| `Pipfile.lock` (Pipenv 2026.12.4 wrote it) | kept | pruned | pruned | nothing |
34+
| `pylock.toml` (`uv export`, uv 0.11.32) | kept | pruned | pruned | nothing |
35+
| `pdm.lock`, `vlt-lock.json` (by hand) | kept | pruned | pruned | nothing |
36+
| `npm-shrinkwrap.json` | kept | pruned | pruned | `npm_lock_invalid` |
37+
| `yarn.lock` (berry, by hand) | kept | kept | pruned | nothing |
38+
| `requirements.txt`, a conflict between two whole lines | kept | kept | — | — |
39+
40+
`npm-shrinkwrap.json` rides the npm reader's diagnosis, so the plan's first point closes it. Still not run there: `bun.lockb`, `go.work.sum`, the Plug'n'Play layouts, real vlt and real Yarn berry.
41+
42+
**L162, true, out of charter (the contract allows): `vex` at a patched root attests a PyPI release that a nested project below it installs unpatched.** By hand, agent mode: the root's `.venv` holds `six` 1.16.0 patched, `services/api/.venv` holds the same release unpatched.
43+
44+
| | npm (`services/api/node_modules`) | PyPI (`services/api/.venv`) |
45+
|---|---|---|
46+
| `apply --check` at the root | "OUT OF SYNC … an installed copy is still unpatched", exit 1 | "Patches are in sync (1 patch checked)." |
47+
| `vex` at the root | "omitting pkg:npm/left-pad@1.3.0 from VEX … (not_applied)" | `not_affected`, with `pkg:pypi/six@1.16.0` as a product of its own |
48+
| a bare `scan` at the root | — | "1 project directory below this one was not scanned (services/api) … Run one scan per directory" |
49+
50+
The contract says the model "is not uniform today": npm-family copies below `--cwd` are crawled, and gem, PyPI and Composer are "cwd-only", "handled by invoking the tool once per subproject". It also says of the package products that "the document is only for the project it was made for", and docs/usage.md repeats it. The scan names the directory; `vex` does not. A scanner run over the root with that document matches the nested copy, which is the case the sentence warns of. Not filed: both sentences are there.
51+
52+
**Clean: PDM and Pipenv with a local wheel, in both modes** (the line three entries left as "not run"; #2474 stays as it is, uv's `pylock.toml` and Composer). Real PDM 2.29.2 (lock 4.5.1) and Pipenv 2026.12.4, a stand-in patch service that offers a patch for `six` 1.16.0 and serves its wheel. No file changed in any cell:
53+
54+
| The wheel in `wheels/` | `scan --mode vendored` | `scan --mode hosted` |
55+
|---|---|---|
56+
| PDM, the project's own build under that name and version | exit 1, "no installed package found on disk" | not switched, "Refusing existing PDM path source", exit 0 |
57+
| PDM, a byte copy of the registry's wheel | exit 1, "pdm.lock already declares a local path for six; refusing to overwrite a user-authored source" | as the row above |
58+
| Pipenv, the project's own build | exit 1, "no installed package found on disk" | not switched, "Pipenv source for six already exists", exit 0 |
59+
| Pipenv, a byte copy | exit 1, "Pipfile.lock default.six is a user-declared file reference; refusing to overwrite it" | as the row above |
60+
| uv, `[tool.uv.sources]`, a byte copy | exit 1, "[tool.uv.sources] already declares a source for six; refusing to overwrite a user-authored source" | #2474's first row again: `pylock.toml` rewritten |
61+
| `pylock.toml` alone, a byte copy | exit 1, "six already uses wheels/six-1.16.0-py2.py3-none-any.whl; run vendor --revert before changing its source" | — |
62+
63+
PDM 2.29.8 writes lock version 4.6.0, which hosted mode refuses before any of this ("Unsupported PDM lock_version", #2398, another agent's).
64+
65+
**Seen and not filed:**
66+
- The last row's remedy does not apply: nothing was vendored, so `vendor --revert` has nothing to undo. A true refusal with a wrong sentence, like the three of the 07:18Z entry. A fix of #2474 touches that planner.
67+
- When the patch service offers nothing for the installed packages, the human output gives a prune as a count ("GC: pruned 1 manifest entry") and does not name the record. `--json` names it. The 09:20Z run saw the name because its stand-in offered patches.
68+
- `in_process_alternate_installers` (22 tests of `apply` over trees real yarn, pnpm, Bun and Bundler install) returns early with a `println!("SKIP …")` when a tool is missing or its install fails, and has no `_REQUIRED` switch. Here, with yarn 1.22.22, pnpm 10.28.0, Bun 1.4.4 and Bundler 4.0.18, 21 run and pass in 16 seconds and one skips (corepack cannot fetch Yarn 4.12.0). In CI the output is captured and no leg installs Bun or pnpm for this suite; the checked-in samples give the binary 0.19 s on Windows and 4.58 s under coverage. The gates behind its Bun and pnpm tests also have tests over hand-made trees (`tests/apply/bun_global_store.rs`, core's crawler tests), and I showed no mutant that only this suite catches. Below the gate; #1940 is the open issue for the switches.
69+
70+
**Read and already handled, while choosing:**
71+
- `--ecosystems`: `NPM`, ` npm` and `npm, pypi` are read; `bogus` exits 2 with the supported list.
72+
- An installed `package.json` with a BOM or CRLF endings is found and patched.
73+
- Patch timestamps are ordered in one place (`api/ranking.rs` over `api/date.rs`); no other code compares `publishedAt` or `exportedAt`.
74+
- One comment stripper (`strip_jsonc`) behind every JSONC reader; `vendor/jsonc.rs` is Rush's editor.
75+
- The other consumers of the lock inventory that take the entries without the diagnoses (`reaching_backend`, the offline wording of `vendor`, the liveness of a pre-v5 hosted record) delete nothing on it.
76+
- Production child processes start through `utils/process.rs`.
77+
- A gem with a `path:` source in vendored mode: the Gemfile rewrite refuses a declaration that carries a source option, with unit tests. Read, not run.
78+
- `utils/pep440.rs` and `utils/composer_version.rs` are ports of the reference grammars with vector tests. Not fuzzed.
79+
80+
No issue closed or filed. No lead is marked `to verify`.
81+
82+
### Areas examined
83+
- **The prune over the lock formats #2477 had not run**: seven formats, readable, conflicted and cut short; real PDM with a real merge, real Pipenv and uv for two readable controls. L161.
84+
- **A local wheel under PDM, Pipenv, uv and `pylock.toml`, vendored and hosted**, as the project's own build and as a byte copy of the registry's. Clean but for #2474's known row.
85+
- **A patched root above a nested project that holds the release unpatched**, npm and PyPI, under `apply --check`, `vex`, `scan` and `list`. L162.
86+
- **`in_process_alternate_installers` with the real tools.** Passes; its skips are not shown to hide anything.
87+
- Not run: gems and Composer for L162 (the contract gives them PyPI's model); real vlt and Yarn berry for L161; a gem with a `path:` source through the binary; the real build tools for #2480; `bun.lockb`; Windows and macOS.
88+
89+
### Lessons
90+
- **The layer that refuses depends on the bytes.** The project's own wheel stops at the vendor loop's check of the installed copy ("no installed package found on disk"). A byte copy of the registry's wheel passes that check and reaches the writer's own rule, which is the one the cell was about. Run both wheels before calling a writer safe or unsafe.
91+
- **A tool's newest release can stop a cell before the rule under test.** PDM 2.29.8's lock version is refused at the door (#2398). PDM 2.29.2 writes 4.5.1 and installs with the pins of `scripts/backtest-pdm.py`: `uv tool install 'pdm==2.29.2' --with 'hishel<2' --with 'unearth<0.19'`.
92+
- **A copy of a PDM project is judged by the first copy's environment.** `.pdm-python` holds the interpreter's absolute path and the crawl follows it. My control read "Found 2 packages" from the other directory's `.venv` and kept a record it should have judged alone. Delete the file in a copy, or write the copy's own path into it.
93+
- **Pipenv locks the registry's hashes for a `file` entry**: the `hashes` of a local wheel named `six-1.16.0` are PyPI's sdist and wheel digests, whatever bytes the file holds, and `pipenv sync` installs the file.
94+
- **A real merge for a Python lock**: lock one branch with `pdm lock --exclude-newer <date>` and the other without. Both change the same package block, the manifest and `pyproject.toml` merge cleanly, and the conflict is in the lock alone.
95+
- **The words-per-file count sends you to code that is already careful.** `pep440.rs`, `composer_version.rs`, `jsonc.rs`, `shared_store.rs` and `api/date.rs` have few mentions because each is one implementation with its callers on it. The finding came from an issue's own "not run" line again.
96+
- The register was at 11,996 characters and is at 11,992: L161 and L162 joined their rows, the areas gained two phrases, the PDM note one clause; a sentence of the mutant note and three words of the areas row went.
97+
- The run, roughly: loading state 4 minutes (beside the build); choosing and reading 8; the alternate-installer suite 3; the lock cells and the PDM merge 6; the comment 2; the nested projects 2; PDM, Pipenv and uv with wheels 5; the ledger the rest.
98+
99+
<details><summary>The fixtures</summary>
100+
101+
`papi.py` and `mkwheel.py` of the 11-29 entries (14:55Z, 22:55Z), unchanged; the catalog entry gets `"integrity": {"sha256": …, "sha512": "sha512-<base64>"}` for vendored mode. The binary runs as in the 11-29 14:55Z entry (`env -i`, the stand-in on a port, `HOME` an empty directory).
102+
103+
The base project, by hand: `package.json` and a v3 `package-lock.json` with two dependencies, `node_modules/<name>/{package.json,index.js}` for each, and a manifest record per package with `files: {"package/index.js": {beforeHash, afterHash}}` (git-sha256 of the file and of the file plus a line) and both blobs; `apply` then patches it offline. `addrec.py` of the 11:16Z entry adds the record of the package nothing installs.
104+
105+
The locks by hand:
106+
107+
```
108+
# pdm.lock
109+
[metadata]
110+
groups = ["default"]
111+
strategy = ["inherit_metadata"]
112+
lock_version = "4.5.0"
113+
content_hash = "sha256:<64 hex>"
114+
115+
[[package]]
116+
name = "itsdangerous"
117+
version = "2.2.0"
118+
requires_python = ">=3.8"
119+
summary = "…"
120+
groups = ["default"]
121+
files = [
122+
{file = "itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:<64 hex>"},
123+
]
124+
125+
# vlt-lock.json (· is U+00B7)
126+
{"lockfileVersion": 0, "options": {}, "nodes": {"··ms@2.1.3": [0, "ms", "sha512-…"]}, "edges": {"file·. ms": "prod 2.1.3 ··ms@2.1.3"}}
127+
128+
# yarn.lock (berry), after the __metadata block with version: 8
129+
"ms@npm:2.1.3":
130+
version: 2.1.3
131+
resolution: "ms@npm:2.1.3"
132+
checksum: 10c0/<128 hex>
133+
languageName: node
134+
linkType: hard
135+
```
136+
137+
A conflict: one line of the lock wrapped in `<<<<<<< HEAD`, `=======`, `>>>>>>> feature`. Cut short: the first two thirds of the file's bytes. The PDM merge is in the #2477 comment.
138+
139+
The wheels: the project's own is a zip of `six.py` (one line), `six-1.16.0.dist-info/{METADATA,WHEEL,RECORD}`; the byte copy is the wheel PyPI serves. PDM: `dependencies = ["six @ file:///${PROJECT_ROOT}/wheels/six-1.16.0-py2.py3-none-any.whl"]`, `pdm lock`, `pdm install`. Pipenv: `six = {file = "wheels/six-1.16.0-py2.py3-none-any.whl"}` under `[packages]`, `PIPENV_VENV_IN_PROJECT=1 pipenv lock`, `pipenv sync`. uv: `[tool.uv.sources] six = { path = "wheels/…" }`, `uv lock --offline`, `uv sync --offline`, `uv export --offline --format pylock.toml -o pylock.toml`. `pylock.toml` alone: that export, `uv venv`, `uv pip install --offline wheels/*.whl`.
140+
141+
The nested project: `services/api/` with its own `package.json`, lock and `node_modules/left-pad` (the unpatched file), or its own `requirements.txt` and a `uv venv` with `six==1.16.0`; the root's record is made from the root's installed file.
142+
143+
</details>
144+
145+
### Needs a person
146+
- **Review #2461** (a printed credential, p1), **#2458** (Go workspaces under a named `GOWORK`) and **#2453** (vendored NuGet). Nothing else of this routine's can open until one merges.
147+
- **#2477 covers four more lock formats** (PDM, Pipenv, `pylock.toml`, vlt): a `scan --sync` or `scan --prune` run while one of them is mid-merge deletes the patch records of what it lists, exits 0 and says nothing about the lock. The comment has a real PDM merge and the lines to change. Its one question is unchanged: whether the kept entries ride the lock's warning or get a code.
148+
- From earlier runs, unchanged: #2480 and #2475 ask for a decision; #2474 covers hosted and vendored mode; #2472 asks whether one warning code should cover every ecosystem; #2467 and #2469 each ask for a word; #2465 is not reachable until the patch service sends `mode` entries; #2348 is unclaimed for Cargo, Go and Composer; the contract sentences for #2453 and #2458 wait for #2459; #2450 and #2413's second point want a word; #2455 wants a word on the warning code; #2366, #2347, #2340, #2309, #2277 and #2297 wait for an answer.

0 commit comments

Comments
 (0)