Repository navigation
socket-patch architecture refactor: real problems only (living document) #2244
Replies: 123 comments
|
[agent] 2026-11-25: architecture refactor
Chosen
The evidence is PR#2246, ready, awaiting review. Three commits after the start commit:
Leads and issues
Areas examinedThe prune GC ( Lessons
|
|
[agent] 2026-11-25: architecture refactor
Chosen
I found it by running the built binary over five small broken projects and comparing the commands, not from a lead: The evidence is PR#2250, ready, awaiting review. Three commits after the start commit:
Production +143 −80, tests +308 −3, contract +7 −7. Exit codes are unchanged (1). CI passed on Leads and issues
Areas examined
Lessons
|
|
[agent] 2026-11-25: architecture refactor
ChosenNo PR this run. Three PRNone opened. #2246 and #2250 are ready and await review. #2241 is the old charter's test-helper PR and waits for a maintainer. Leads and issues
Areas examined
Lessons
|
|
[agent] 2026-11-25: architecture refactor
ChosenA reviewer's comment on #2250, which step 2 puts ahead of any new work. The PR had two approvals and auto-merge armed, and was not merging 45 minutes later: The comment was right. With the vendor ledger unreadable,
PR#2250, ready and in the merge queue since 21:22Z (approved twice; a maintainer had armed auto-merge). One commit ( No new PR: the review comment was the run. The rest of the time went to leads, each run on Leads and issues
Seen and left: after a revert of a removed or bumped requirement, the pip reinstall advisory says "the restored requirement pins the same version as the patched build". It doesn't there, but following the remedy still leaves a correct environment. Areas examined
Lessons
|
|
[agent] 2026-11-26: architecture refactor
Chosen
Two states, each run with the built binary on Six tests fail on PR#2261, ready and awaiting review, with one check red for a cause outside it (below). Seven commits after the start commit, production +163 −26, tests +481 −15, contract +3 −2:
Nothing new is deleted or reverted: every new branch only reports. Exit codes and Local verification: clippy clean, 1081 CLI unit tests, and the CI on Leads and issues
Seen and left, each with its reason in the PR: on an empty crawl with an unreadable ledger, human mode prints the new warning and then the existing " Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenAfter On The same state with real vlt 1.2.0 (a throwaway copy of the So the lock is back on the registry, the patched copy is still installed, a plain PR#2265, ready and awaiting review, with one check red for a cause outside it. CI on Two commits after the start commit, production +25 −11, tests +152 −1, coverage map +3 −1:
Local verification: clippy clean, 1077 CLI unit tests, and the Leads and issues
Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenThree Gradle tests named for Two one-line mutations of production code on // core crawlers/maven_crawler.rs: the prefix is ignored for JVM caches
- if let Some(ref custom) = options.global_prefix {
+ if let Some(ref custom) = options.global_prefix.as_ref().filter(|_| false) {
// CLI commands/scan/mod.rs: the user-home note is printed under --global-prefix too
- let mismatch = (!prefixed && (global || gradle_build))
+ let mismatch = ((global || gradle_build) || prefixed)With the first, PR#2267, ready and awaiting review. CI on Two commits after the start commit, test code only, +84 −11 in three files:
With this PR's tests each mutation fails its test, at the One trade-off is in the PR for the reviewer. The note is printed only when the Gradle user home comes from the passwd home, so a scan that prints it reads the account's real Leads and issues
Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took the issues the register listed to check first (#1926, #1917, #1899), one more whose title claims a drifted duplicate (#1860), and the oldest lead a probe could settle here (L17). Three are confirmed by running the built binary on PRNone opened. #2261, #2265 and #2267 still await review. Their Leads and issues#1917, confirmed. The NuGet crawler tests a project file's extension case-sensitively ( A project whose file is #1926, confirmed for the prune's copy. A crate So a cached blob that says nothing about the copy decides whether the record is kept, and the warning calls a file that was read, and is not the patched one, "still patched (or could not be read to tell)". The cause is #1860, confirmed for
#1899, out of charter. Its drift, the scan and the resolver classifying a store entry's children differently, was fixed by the issue's first slice (#1986): both now go through L17, rejected. A throwaway probe test, not committed, fed four Gemfiles (three shown) to the line scanner behind VEX's source-block reading ( They agree on every block socket-patch writes (an opener, Read, not run.
Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took the four issues the register listed to check first that a run here could settle (#647, #1064, #882, #1981) and the one lead a file-only fixture could reach (L22). Two are confirmed by running the built binary on PRNone opened. #2261, #2265 and #2267 still await review. Their Leads and issuesL22, confirmed (the last bullet of #1910). Four commands unwire the same vendored Go module in a project that commits its After each of the four, #647, confirmed on
Two rows contradict what is written down. #1064, out of charter. A project with no detectable product, a saved patch, then #882, out of charter. Its dangerous case no longer reaches the Maven rewriter. Since #2052 the hosted engine runs #1981, out of charter (read, not run). Read, not run.
Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took four issues no run had examined whose titles claim a drift a user could see (#1837, #1858, #1911, #1987) and the lead L27. All five ran against the binary built from PRNone opened. #2261, #2265 and #2267 still await review. Their Leads and issuesNew: L30, filed as #2277, a decision issue. After both, #1911, out of charter. The claim is that the project-patch gate is written five times and that scan's and vendor's copies drifted. Two projects, one with a patch-package file for
The gate held on all 15 runs without consent. What differs is that scan's skip event carries no #1858, out of charter. With #1837, out of charter. #1987, out of charter. Its three drifts concern the notes a successful apply or rollback carries. For the note the issue leads with they are fixed: L27, out of charter. Read, not run.
Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify leads or issues. All three are I took four issues no run had examined whose titles claim a drift a user could see (#1836, #705, #905, #594), a fifth beside them (#1835), and the three oldest leads still marked PRNone opened. #2261, #2265 and #2267 still await review. Their Leads and issues#1836, confirmed. Eight runs, eight documents. The lists are the advisory ids of the two options, in the order printed. The same object is built in two other places, and both sort by id: It is the fourth kind as well. The unit test Two things the issue does not say:
The harm is small: a consumer that compares two runs of the same command sees a difference where nothing changed. The fix is small too: one helper that returns the list sorted by id, used by the three sites, and a test that reads #705, out of charter. The issue counted five UUID grammars. Three are left on
What is left is the grant matcher's wider grammar, over a URL the patch service supplies. #905, out of charter. The one difference is a BOM on #594, out of charter. The private readers the issue lists are gone ( #1835, out of charter. L10, rejected. The warning sinks follow the contract's rule: a
With the 285 runs of 2026-11-25 and the reading of L18, rejected (read). L19, rejected (read). L31, new, out of charter. Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took five issues that no run under this charter had examined and whose text claims a drift or a defect a user could see: #717, #815, #780, #794 and #675. None passes the gate. Two describe defects that are gone from PRNone opened. #2261, #2265 and #2267 still await review. Their Leads and issues#717, already fixed; closed. The issue says the hosted Maven rewriter and its restore find
The restore tests over the same shapes pass ( #815, already fixed; closed. The issue counts three hand-written rules for the terminator of an inserted line. On #780, out of charter. Vendored mode still scans What is left is three copies that agree. The issue stays open. #794, out of charter. #675, out of charter. The issue says nothing caps
The last run is honest: L32, new, out of charter. That last run exits 0 with Areas examinedAll clean, run with the binary built from
Lessons
#!/usr/bin/env python3
"""mkagent.py <root>: an npm agent-mode fixture with a two-file patch."""
import hashlib, json, os, shutil, sys
root = sys.argv[1]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
shutil.rmtree(root, ignore_errors=True)
pk = os.path.join(root, "node_modules", "left-pad")
os.makedirs(os.path.join(pk, "lib")); os.makedirs(os.path.join(root, ".socket", "blobs"))
before = {"index.js": b"module.exports = 1\n", "lib/util.js": b"exports.u = 1\n"}
after = {"index.js": b"module.exports = 2\n", "lib/util.js": b"exports.u = 2\n"}
open(os.path.join(root, "package.json"), "w").write(
'{"name":"p","version":"1.0.0","dependencies":{"left-pad":"1.3.0"}}\n')
open(os.path.join(pk, "package.json"), "w").write('{"name":"left-pad","version":"1.3.0"}\n')
files = {}
for rel in before:
open(os.path.join(pk, rel), "wb").write(before[rel])
files["package/" + rel] = {"beforeHash": gh(before[rel]), "afterHash": gh(after[rel])}
for b in (before[rel], after[rel]):
open(os.path.join(root, ".socket", "blobs", gh(b)), "wb").write(b)
record = {"uuid": "11111111-2222-4333-8444-555555555555", "exportedAt": "2026-01-01T00:00:00Z",
"files": files, "description": "d", "license": "MIT", "tier": "free",
"vulnerabilities": {"GHSA-aaaa-bbbb-cccc": {"cves": ["CVE-2026-0001"], "summary": "s",
"severity": "high", "description": "d"}}}
json.dump({"patches": {"pkg:npm/left-pad@1.3.0": record}},
open(os.path.join(root, ".socket", "manifest.json"), "w"), indent=2)
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took five issues no run under this charter had examined (#676, #1968, #1925 with #1924, and #1067) and tried L14. None of the five passes the gate. Running #1067 turned up a defect that does, filed as #2286. PRNone opened. #2261, #2265 and #2267 still await review. Leads and issuesNew: L33, filed as #2286. A package manager's global-directory probe that fails is read as "this manager has no global install". For npm, pnpm and yarn the crawler drops a probe that gives no answer, whether the manager is missing, exits non-zero or is still running at the 10 s budget. Bun's probe was taught the difference in #1009 (for #443) and warns. Two results for npm, both run with the binary built from
#1067, out of charter. The issue lists hand-written child deadlines. On #1925 and #1924, out of charter. 28 production sites print an envelope with
#1968, out of charter. The suites now share #676, out of charter. The tracking issue's first child is done: #747, #1867, read. L14, still to verify. I downloaded scala-cli 1.17.1 to see which files it writes beside its Bloop projects. The sandbox's permission check refused to run a downloaded binary, so the lead is where it was; the download is deleted. Areas examined
Lessons
Needs a person
|
|
[agent] 2026-11-26: architecture refactor
ChosenNo PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify up to five leads or issues. All three are I took four issues no run under this charter had examined (#1114, #748, #595, #1112) and hunted one area none had: what the CLI prints when a project's own files hold a URL with a credential in it. The hunt found a defect that passes the gate, filed as #2287. None of the four issues passes. PRNone opened. #2261, #2265 and #2267 still await review. Leads and issuesNew: L34, filed as #2287. Refusals and hosted warnings print the credentials of a URL they quote from a lockfile. I ran the binary built from
The hosted warnings are in The npm backend shows both ways side by side. With the same git URL in a Clean in these runs: the token in a The fix changes message text only. The issue plans redaction where the text enters each type, as L35, new, out of charter. #748, out of charter. The issue counts purl builders that canonicalize differently. On
What is left of the issue is the builders themselves. #595, out of charter. The project-mode crawl is scoped for the four ecosystems I could run. With one locked package and one unrelated package in the machine cache, #1112, out of charter. #1114, fixed in part. Read, not run. The CI janitor commented today that #2229 fixed the router for a package-less tool lock beside a Areas examined
Lessons
Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 01:19Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL223, confirmed, filed #2519 ( Through the binary and the real SDK 8.0.428 (offline, a folder feed; The warning's remedy copies the unpatched file again, so the warning returns on every run. Two PackageReference projects, one with A test in It is the second and third kind (a false success, a false VEX statement), and the fifth: the class was fixed for npm (0433bcb), cargo (ea4cff5) and gems (ff4ced8) by patching every copy, and for NuGet (846bc75, #397 and #398) by putting the project's folders ahead of the default one. An order cannot serve two projects that read different folders. The contract's VEX row for an agent record says every installed copy must hash to the patched bytes, "as L222, true, a comment on #2355: the L221, rejected: the stale-copy remedy does not refresh the output. One PackageReference project, built (Debug) and published (Release, and L224, rejected: a package in a fallback folder is the wrong copy. L225, rejected: the signature advisory misreads real assemblies. A key pair made with Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixturesThe SDK. The package. The record. The projects. The signed assemblies. The library with Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 03:26Z: #2453, #2458 and #2461, each No lead was marked Both modes are clean on a script with one patched package. Three things came out of the neighbours:
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL229, confirmed, filed #2521 ( Without the L228, confirmed, filed #2522 ( uv accepts the lock, so nothing installs differently; a clean checkout is dirty after scan and rollback. L230, true and documented, filed #2523 ( The earlier fixes of the class are 54bc27f (Pipenv), 00df0c4 (uv) and 83969ec (Poetry); PDM is #2310. Scoping by the lock's package names is the change, and it contradicts a sentence of the docs, so it is a decision. A wet agent run was not made. L226, rejected: the Go and Composer arms of the first-copy merge drop a copy. L227, rejected: a hosted or vendored pin of a PEP 723 script does not install, or does not come back. Fourteen scripts (below), each locked by Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
#!/usr/bin/env python3
"""mkwheel2.py <artifact dir> <catalog.json> name==version:member ...
Each release's pure wheel from PyPI with a marker appended to <member>, its RECORD line fixed,
real git-sha256 hashes before and after, and sha256 + sha512 integrity (hosted and vendored)."""
import base64, csv, hashlib, io, json, os, re, sys, urllib.request, uuid, zipfile
art, cat_path, specs = sys.argv[1], sys.argv[2], sys.argv[3:]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
os.makedirs(art, exist_ok=True)
patches = []
for item in specs:
spec, member = item.split(":")
name, version = spec.split("==")
canon = re.sub(r"[-_.]+", "-", name).lower()
doc = json.load(urllib.request.urlopen(f"https://pypi.org/pypi/{canon}/{version}/json"))
w = sorted([u for u in doc["urls"] if u["packagetype"] == "bdist_wheel" and u["filename"].endswith("-none-any.whl")], key=lambda u: u["filename"])[-1]
raw = urllib.request.urlopen(w["url"]).read()
zin = zipfile.ZipFile(io.BytesIO(raw)); out = io.BytesIO(); zout = zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED)
before = zin.read(member); after = before + b"\n# SOCKET_PATCHED\n"
record = next(n for n in zin.namelist() if n.endswith(".dist-info/RECORD"))
for n in zin.namelist():
data = zin.read(n)
if n == member: data = after
if n == record:
rows = list(csv.reader(io.StringIO(data.decode())))
for r in rows:
if r and r[0] == member:
r[1] = "sha256=" + base64.urlsafe_b64encode(hashlib.sha256(after).digest()).decode().rstrip("="); r[2] = str(len(after))
s = io.StringIO(); csv.writer(s, lineterminator="\n").writerows(rows); data = s.getvalue().encode()
zout.writestr(zin.getinfo(n), data)
zout.close(); body = out.getvalue()
u = str(uuid.uuid5(uuid.NAMESPACE_URL, "patch:" + spec)); tok = str(uuid.uuid5(uuid.NAMESPACE_URL, "grant:" + spec))
local = os.path.join(art, w["filename"]); open(local, "wb").write(body)
patches.append({"purl": f"pkg:pypi/{canon}@{version}", "uuid": u, "file": member,
"files": {member: {"beforeHash": gh(before), "afterHash": gh(after)}},
"artifact": {"path": f"/patch/pypi/{canon}/{version}/{tok}/{u}/{w['filename']}", "local": local,
"integrity": {"sha256": hashlib.sha256(body).hexdigest(),
"sha512": "sha512-" + base64.b64encode(hashlib.sha512(body).digest()).decode()}}})
print(spec, "->", w["filename"], member)
json.dump({"patches": patches}, open(cat_path, "w"), indent=1)The scripts. Each is a block, then a body that prints
The loop, per directory: The four backends of L229: L230: a directory with Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at the end: #2453, #2458 and #2461, each No lead was marked The backend is clean for what its fixtures hold. One shape was not: a dependency declared by a range. That led to the rule behind it, to the same rule on current pnpm for a dist-tag, and to npm, where the result is a false
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL231, confirmed, filed #2525 ( The same on npm 8.19.4, 9.9.4 and 11.6.2, and for L232, confirmed, filed #2526 ( One level down on pnpm 7.33.7 and 8.5.1 ( L233, rejected: the pnpm 7 and 8 rewriter writes a lock its pnpm would write differently, or an undo that is not byte for byte. Sixteen shapes under 7.33.7 and 8.15.9, the dependency declared as an exact version: direct, transitive, dev, optional, dev-only transitive, deprecated, scoped, with a bin, two versions of one name, a user's own override, optional peers not installed, four packages at once, a direct and a transitive use of one release. In each: the frozen install passes and installs the marker, a plain install leaves the lock byte for byte, L234, rejected: hosted mode fails on the shapes vendored mode fails on. Hosted writes no override. pnpm 7.33.7 and 8.5.1 with the exact, the range and the transitive project, and npm 10.9.9 with the tag: patched bytes after the frozen and the plain install, the lock stable, the undo byte for byte. The same on the 6.1 lock that pnpm 8.6.0 writes. Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
#!/usr/bin/env python3
"""mknpm2.py <artifact dir> <catalog.json> name@version:member ...
Each release's real npm tarball with a marker appended to <member>, and a papi.py catalog
entry with the real git-sha256 hashes and sha512 integrity (hosted and vendored)."""
import base64, hashlib, io, json, os, sys, tarfile, urllib.request, uuid
art, cat_path, specs = sys.argv[1], sys.argv[2], sys.argv[3:]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
os.makedirs(art, exist_ok=True)
patches = []
for item in specs:
spec, member = item.rsplit(":", 1)
name, version = spec.rsplit("@", 1)
doc = json.load(urllib.request.urlopen(f"https://registry.npmjs.org/{name.replace('/', '%2f')}/{version}"))
raw = urllib.request.urlopen(doc["dist"]["tarball"]).read()
tin = tarfile.open(fileobj=io.BytesIO(raw), mode="r:gz"); out = io.BytesIO(); tout = tarfile.open(fileobj=out, mode="w:gz")
before = after = None
for ti in tin.getmembers():
data = tin.extractfile(ti).read() if ti.isfile() else None
if ti.name == member:
before = data; after = data + b"\n// SOCKET_PATCHED\n"; data = after; ti.size = len(data)
tout.addfile(ti, io.BytesIO(data) if data is not None else None)
tout.close(); body = out.getvalue()
assert before is not None, (spec, member)
leaf = f"{name.split('/')[-1]}-{version}.tgz"; local = os.path.join(art, leaf); open(local, "wb").write(body)
u = str(uuid.uuid5(uuid.NAMESPACE_URL, "patch:" + spec)); tok = str(uuid.uuid5(uuid.NAMESPACE_URL, "grant:" + spec))
patches.append({"purl": f"pkg:npm/{name}@{version}", "uuid": u, "file": member,
"files": {member: {"beforeHash": gh(before), "afterHash": gh(after)}},
"artifact": {"path": f"/patch/npm/{name}/{version}/{tok}/{u}/{leaf}", "local": local,
"integrity": {"sha512": "sha512-" + base64.b64encode(hashlib.sha512(body).digest()).decode()}}})
print(spec, u)
json.dump({"patches": patches}, open(cat_path, "w"), indent=1)Any pnpm beside the others: A project ( The loop ( cp $o/package.json $o/pnpm-lock.yaml . ; rm -rf .socket node_modules pnpm-workspace.yaml; $P install --frozen-lockfile --ignore-scripts
sp.sh 18110 -- scan --mode $mode --yes; cp pnpm-lock.yaml $out/lock.after-scan
rm -rf node_modules
$P install --frozen-lockfile --ignore-scripts; grep -rl SOCKET_PATCHED node_modules/.pnpm | wc -l
$P install --no-frozen-lockfile --ignore-scripts; cmp pnpm-lock.yaml $out/lock.after-scan
cp $out/lock.after-scan pnpm-lock.yaml
sp.sh 18110 -- vex --output $out/vex.json
sp.sh 18110 -- rollback --yes; cmp pnpm-lock.yaml $o/pnpm-lock.yaml; cmp package.json $o/package.jsonThe npm, Yarn 1 and Bun twin ( The shapes (each The suite's test: The three unit tests are in the issues. They went into the Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at the end: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL235, rejected: vendored Yarn classic leaves an install unpatched, or an undo that is not byte for byte. Each shape was locked by Yarn 1.22.22, then: a vendored scan, Ten follow-on commands over the vendored L236, rejected: the Composer version port ( L237, confirmed, a comment on #2525: the dist-tag edge in a workspace member and in a dependency. #2525 listed both as not run. On npm 10.9.9: The control ( L238, rejected: a pnpm L239, rejected: vendored vlt leaves an install unpatched, a dist-tag included. Real vlt 1.2.0 ( Seen and not filed:
No issue closed or filed. No lead is marked Areas examined
Lessons
The fixtures
Each tool with its own cache and the scratch
#!/usr/bin/env python3
"""shapes.py <shape> <dir>: write a Yarn classic project of that shape into <dir> (no install)."""
import json, os, sys
shape, d = sys.argv[1], sys.argv[2]
os.makedirs(d, exist_ok=True)
def w(p, doc):
p = os.path.join(d, p); os.makedirs(os.path.dirname(p), exist_ok=True)
open(p, "w").write(json.dumps(doc, indent=2) + "\n" if not isinstance(doc, str) else doc)
base = {"name": "app", "version": "1.0.0", "private": True}
S = {
"exact": {"dependencies": {"left-pad": "1.3.0"}},
"caret": {"dependencies": {"left-pad": "^1.3.0"}},
"tilde": {"dependencies": {"ms": "~2.0.0"}},
"trans": {"dependencies": {"debug": "2.6.9"}},
"dev": {"devDependencies": {"ms": "2.0.0"}},
"opt": {"optionalDependencies": {"ms": "2.0.0"}},
"scoped": {"dependencies": {"@babel/helper-validator-identifier": "7.22.20"}},
"bin": {"dependencies": {"semver": "5.7.2"}},
"twover": {"dependencies": {"ms": "2.1.3", "debug": "2.6.9"}},
"resol": {"dependencies": {"debug": "2.6.9"}, "resolutions": {"ms": "2.0.0"}},
"resol2": {"dependencies": {"debug": "2.6.9"}, "resolutions": {"debug/ms": "2.1.3"}},
"alias": {"dependencies": {"my-ms": "npm:ms@2.0.0"}},
"aliasboth": {"dependencies": {"my-ms": "npm:ms@2.0.0", "ms": "2.0.0"}},
"chalk": {"dependencies": {"chalk": "2.4.2"}},
"url": {"dependencies": {"left-pad": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz"}},
"star": {"dependencies": {"left-pad": "*"}},
"xrange": {"dependencies": {"left-pad": "1.x"}},
"gte": {"dependencies": {"left-pad": ">=1.0.0"}},
"tag": {"dependencies": {"left-pad": "latest"}},
"aliastag": {"dependencies": {"lp": "npm:left-pad@latest"}},
"four": {"dependencies": {"ms": "2.0.0", "semver": "5.7.2", "left-pad": "^1.3.0", "is-number": "^7.0.0"}},
}
if shape in S:
doc = dict(base); doc.update(S[shape]); w("package.json", doc)
elif shape == "ws":
doc = dict(base); doc["workspaces"] = ["packages/*"]; w("package.json", doc)
w("packages/a/package.json", {"name": "a", "version": "1.0.0", "dependencies": {"left-pad": "^1.3.0"}})
w("packages/b/package.json", {"name": "b", "version": "1.0.0", "dependencies": {"left-pad": "^1.1.0", "a": "1.0.0"}})
elif shape == "wsnohoist":
doc = dict(base); doc["workspaces"] = {"packages": ["packages/*"], "nohoist": ["**/left-pad"]}; w("package.json", doc)
w("packages/a/package.json", {"name": "a", "version": "1.0.0", "dependencies": {"left-pad": "^1.3.0"}})
w("packages/b/package.json", {"name": "b", "version": "1.0.0", "dependencies": {"left-pad": "1.3.0"}})
elif shape == "mirror":
doc = dict(base); doc["dependencies"] = {"left-pad": "^1.3.0", "ms": "2.0.0"}; w("package.json", doc)
w(".yarnrc", 'yarn-offline-mirror "./npm-packages-offline-cache"\n')
elif shape == "mirrorprune":
doc = dict(base); doc["dependencies"] = {"left-pad": "^1.3.0", "ms": "2.0.0"}; w("package.json", doc)
w(".yarnrc", 'yarn-offline-mirror "./npm-packages-offline-cache"\nyarn-offline-mirror-pruning true\n')
else:
sys.exit("unknown shape " + shape)
#!/bin/bash
# loop.sh <shape> [mode]: build the project, lock it with Yarn 1, then run the vendored loop.
shape=$1; mode=${2:-vendored}
S=<S>; F=$S/fx; p=$S/proj/$shape; o=$S/orig/$shape; out=$S/out/$shape-$mode
rm -rf $p $out; mkdir -p $p $o $out $S/ycache
python3 $F/shapes.py $shape $p
cd $p; mkdir -p .git; echo 'ref: refs/heads/main' > .git/HEAD
if [ ! -f $o/yarn.lock ]; then
$F/y.sh base install --ignore-scripts --non-interactive > $out/lockit.log 2>&1 || { echo "LOCK FAILED"; tail -5 $out/lockit.log; exit 1; }
cp yarn.lock $o/yarn.lock
(cd $p && find . -name package.json -not -path './node_modules/*' | while read f; do mkdir -p $o/$(dirname $f); cp $f $o/$f; done)
else
cp $o/yarn.lock .; $F/y.sh base install --frozen-lockfile --ignore-scripts --non-interactive > $out/lockit.log 2>&1
fi
echo "== scan ($mode)"; $F/sp.sh 18120 -- scan --mode $mode --yes > $out/scan.log 2>&1; echo "exit $?"; grep -v '^\s*$' $out/scan.log | tail -6
cp yarn.lock $out/lock.after-scan
if [ $mode = vendored ]; then echo "== vendor --check"; $F/sp.sh 18120 -- vendor --check > $out/check.log 2>&1; echo "exit $?"; tail -2 $out/check.log; fi
rm -rf node_modules packages/*/node_modules
echo "== frozen install (fresh cache)"; rm -rf $S/ycache/fresh-$shape; $F/y.sh fresh-$shape install --frozen-lockfile --ignore-scripts --non-interactive > $out/frozen.log 2>&1; echo "exit $?"; grep -i 'error\|warning' $out/frozen.log | head -5
echo "markers: $(grep -rl SOCKET_PATCHED node_modules packages/*/node_modules 2>/dev/null | grep -v '\.socket' | wc -l)"
echo "== plain install"; $F/y.sh fresh-$shape install --ignore-scripts --non-interactive > $out/plain.log 2>&1; echo "exit $?"; cmp yarn.lock $out/lock.after-scan && echo "lock stable"
echo "markers: $(grep -rl SOCKET_PATCHED node_modules packages/*/node_modules 2>/dev/null | grep -v '\.socket' | wc -l)"
cp $out/lock.after-scan yarn.lock
echo "== vex"; $F/sp.sh 18120 -- vex --output $out/vex.json > $out/vex.log 2>&1; echo "exit $?"; tail -3 $out/vex.log; python3 -c "
import json,sys
try:
d=json.load(open('$out/vex.json')); print([(s.get('status'), [p.get('@id') for p in s.get('products',[])][:3]) for s in d.get('statements',[])])
except Exception as e: print('no vex', e)"
echo "== rollback"; $F/sp.sh 18120 -- rollback --yes > $out/rollback.log 2>&1; echo "exit $?"; tail -2 $out/rollback.log
cmp yarn.lock $o/yarn.lock && echo "lock restored"; (cd $o && find . -name package.json | while read f; do cmp $f $p/$f || echo "DIFF $f"; done)
#!/bin/bash
# follow.sh <shape> <label> <yarn args...>: vendored state of <shape> (scan + frozen install), then one Yarn command,
# then what socket-patch says of the result.
shape=$1; label=$2; shift 2
S=<S>; F=$S/fx; p=$S/proj/$shape; o=$S/orig/$shape; out=$S/out/$shape-f-$label
rm -rf $p $out; mkdir -p $p $out
python3 $F/shapes.py $shape $p; cd $p; mkdir -p .git; echo 'ref: refs/heads/main' > .git/HEAD
cp $o/yarn.lock .; $F/y.sh base install --frozen-lockfile --ignore-scripts --non-interactive > $out/lockit.log 2>&1
$F/sp.sh 18120 -- scan --mode vendored --yes > $out/scan.log 2>&1 || echo "SCAN EXIT $?"
cp yarn.lock $out/lock.after-scan
$F/y.sh f-$shape install --frozen-lockfile --ignore-scripts --non-interactive > $out/frozen.log 2>&1 || echo "FROZEN EXIT $?"
if [ -n "$PRE" ]; then eval "$PRE"; fi
echo "== yarn $*"; $F/y.sh ${CACHE:-f-$shape} "$@" --non-interactive > $out/cmd.log 2>&1; echo "exit $?"; grep -i '^error\|^warning\|^success' $out/cmd.log | grep -v 'Ignored scripts' | head -6
diff <(grep -A4 'socket/vendor' $out/lock.after-scan) <(grep -A4 'socket/vendor' yarn.lock) > /dev/null && echo "vendored blocks: same" || { echo "vendored blocks: CHANGED"; diff $out/lock.after-scan yarn.lock | head -20; }
echo "markers: $(grep -rl SOCKET_PATCHED node_modules packages/*/node_modules 2>/dev/null | grep -v '\.socket' | wc -l)"
echo "-- vendor --check"; $F/sp.sh 18120 -- vendor --check > $out/check.log 2>&1; echo "exit $?"; tail -3 $out/check.log | cut -c1-400
echo "-- vex"; $F/sp.sh 18120 -- vex --output $out/vex.json > $out/vex.log 2>&1; echo "exit $?"; grep -v '^\s*$' $out/vex.log | tail -4 | cut -c1-500
python3 -c "
import json
try:
d=json.load(open('$out/vex.json')); print([(s.get('status'), [p.get('@id') for p in s.get('products',[])]) for s in d.get('statements',[])])
except Exception as e: print('no vex')"
#!/bin/bash
# vloop.sh <shape> [mode]: the Yarn shapes as vlt projects, through the vendored (or hosted) loop under real vlt 1.2.0.
shape=$1; mode=${2:-vendored}
S=<S>; F=$S/fx; p=$S/vp/$shape; o=$S/vorig/$shape; out=$S/vout/$shape-$mode
rm -rf $p $out; mkdir -p $p $o $out
python3 $F/shapes.py $shape $p; rm -f $p/.yarnrc
cd $p; mkdir -p .git; echo 'ref: refs/heads/main' > .git/HEAD
echo '{"config":{"registry":"https://registry.npmjs.org/","registries":{"npm":"https://registry.npmjs.org/"}}}' > vlt.json
if [ -n "$WS" ]; then python3 - <<PY
import json; d=json.load(open('vlt.json')); d['workspaces']=['packages/*']; json.dump(d, open('vlt.json','w'))
PY
fi
if [ ! -f $o/vlt-lock.json ]; then
$F/v.sh base install > $out/lockit.log 2>&1 || { echo "LOCK FAILED"; tail -5 $out/lockit.log; exit 1; }
cp vlt-lock.json package.json vlt.json $o/
else
cp $o/vlt-lock.json .; $F/v.sh base install --frozen-lockfile > $out/lockit.log 2>&1
fi
echo "== scan ($mode)"; $F/sp.sh 18120 -- scan --mode $mode --yes > $out/scan.log 2>&1; echo "exit $?"; grep -v '^\s*$' $out/scan.log | grep -v 'Saved about\|Commit \|Next steps\|Run `vlt\|Reinstall from' | cut -c1-600 | tail -5
cp vlt-lock.json $out/lock.after-scan; cp package.json $out/pkg.after-scan; cp vlt.json $out/vltjson.after-scan
if [ $mode = vendored ]; then echo "== vendor --check"; $F/sp.sh 18120 -- vendor --check > $out/check.log 2>&1; echo "exit $?"; tail -2 $out/check.log | cut -c1-300; fi
rm -rf node_modules packages/*/node_modules
echo "== frozen install (fresh cache)"; rm -rf $S/vcache/fresh-$shape; $F/v.sh fresh-$shape install --frozen-lockfile > $out/frozen.log 2>&1; echo "exit $?"; grep -i 'error\|out of sync\|missing' $out/frozen.log | head -4 | cut -c1-300
echo "markers: $(grep -Rl SOCKET_PATCHED node_modules packages/*/node_modules 2>/dev/null | wc -l)"
echo "== plain install"; $F/v.sh fresh-$shape install > $out/plain.log 2>&1; echo "exit $?"; cmp vlt-lock.json $out/lock.after-scan && echo "lock stable"; cmp package.json $out/pkg.after-scan || echo "package.json CHANGED by install"
echo "markers: $(grep -Rl SOCKET_PATCHED node_modules packages/*/node_modules 2>/dev/null | wc -l)"
cp $out/lock.after-scan vlt-lock.json; cp $out/pkg.after-scan package.json
echo "== vex"; $F/sp.sh 18120 -- vex --output $out/vex.json > $out/vex.log 2>&1; echo "exit $?"; grep -v '^\s*$' $out/vex.log | tail -2 | cut -c1-400; python3 -c "
import json
try:
d=json.load(open('$out/vex.json')); print([(s.get('status'), [p.get('@id') for p in s.get('products',[])][:4]) for s in d.get('statements',[])])
except Exception as e: print('no vex')"
echo "== rollback"; $F/sp.sh 18120 -- rollback --yes > $out/rollback.log 2>&1; echo "exit $?"; tail -1 $out/rollback.log | cut -c1-300
cmp vlt-lock.json $o/vlt-lock.json && echo "lock restored"; cmp package.json $o/package.json && echo "package.json restored"; cmp vlt.json $o/vlt.json && echo "vlt.json restored"The npm cells of L237: a workspace ( The pnpm cells of L238: The Composer comparison. <?php
// norm.php: stdin = one JSON string per line; stdout = one JSON value per line: Composer's normalize, or null where it throws.
Phar::loadPhar('/usr/local/bin/composer', 'composer.phar');
require 'phar://composer.phar/vendor/autoload.php';
$p = new Composer\Semver\VersionParser();
while (($line = fgets(STDIN)) !== false) {
$v = json_decode($line);
try { $out = $p->normalize($v); } catch (\Throwable $e) { $out = null; }
echo json_encode($out, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), "\n";
}
#!/usr/bin/env python3
"""gen.py <n> <seed>: version spellings, one JSON string per line: grammar-built, then mutated, plus the repository's vectors."""
import json, random, sys
n, seed = int(sys.argv[1]), int(sys.argv[2]); r = random.Random(seed)
vec = json.load(open('/home/user/socket-patch/crates/socket-patch-core/tests/fixtures/composer-version-vectors.json'))
seeds = set()
def walk(v):
if isinstance(v, str): seeds.add(v)
elif isinstance(v, list): [walk(x) for x in v]
elif isinstance(v, dict): [walk(x) for x in list(v.keys()) + list(v.values())]
walk(vec)
seeds = sorted(seeds)
stab = ['stable','beta','b','RC','rc','alpha','a','patch','pl','p','STABLE','Beta','B','Rc','ALPHA','A','PATCH','PL','P','dev','DEV','Dev']
sep = ['', '.', '-', '_', '+', ':', ' ', '@', '~', '^', '/', ',', '#', '\n', '\t', '\x0b', '\x0c', '\r', '\x00', 'x', 'X', '*', 'v', 'V']
def num():
k = r.random()
if k < .5: return str(r.randint(0, 20))
if k < .7: return r.choice(['0','00','01','007','1','10','99','100'])
if k < .85: return str(r.randint(0, 99999))
if k < .95: return str(r.randint(100000, 99999999))
return ''.join(r.choice('0123456789') for _ in range(r.randint(1, 14)))
def core():
return r.choice(['', 'v', 'V', 'vv', ' ']) + r.choice(['.', '', '.', '.', '-', ':']).join(num() for _ in range(r.randint(1, 6)))
def mod():
s = ''
if r.random() < .6:
s += r.choice(['', '.', '-', '_', '', '-']) + r.choice(stab)
for _ in range(r.randint(0, 3)): s += r.choice(['', '.', '-']) + num()
if r.random() < .3: s += r.choice(['', '.', '-']) + r.choice(['dev', 'DEV', 'Dev'])
return s
def tail():
k = r.random()
if k < .75: return ''
if k < .82: return '@' + r.choice(['stable','RC','beta','alpha','dev','DEV','rc','Stable','foo'])
if k < .90: return '+' + r.choice(['build', '1', 'a.b', 'x y', ''])
if k < .95: return ' as ' + core()
return r.choice(['\n', ' ', '\t', '\r\n', '\x0b', '\x00', '\x0c'])
def branch():
return r.choice(['', 'v', 'V']) + '.'.join(r.choice([num(), 'x', 'X', '*']) for _ in range(r.randint(1, 5))) + r.choice(['-dev', '.dev', 'dev', '-DEV', '', '.x-dev'])
def named():
return r.choice(['dev-', 'DEV-', 'Dev-', '']) + r.choice(['master', 'trunk', 'default', 'main', 'feature/x', '1.x', 'Master', '']) + r.choice(['', '-dev', '@dev', '#abc123'])
def mutate(s):
for _ in range(r.randint(1, 3)):
k = r.random(); i = r.randint(0, len(s))
if k < .35: s = s[:i] + r.choice(sep) + s[i:]
elif k < .55 and s: s = s[:i] + s[i+1:]
elif k < .7: s = s[:i] + r.choice(stab) + s[i:]
elif k < .85: s = s[:i] + num() + s[i:]
elif s: j = r.randint(0, len(s) - 1); s = s[:j] + s[j].swapcase() + s[j+1:]
return s
out = set(seeds)
while len(out) < n:
k = r.random()
if k < .45: s = core() + mod() + tail()
elif k < .55: s = branch() + tail()
elif k < .62: s = named()
elif k < .85: s = mutate(r.choice(seeds))
else: s = mutate(core() + mod() + tail())
out.add(s)
for s in sorted(out): print(json.dumps(s))The port alone: a scratch crate with #[path = "/home/user/socket-patch/crates/socket-patch-core/src/utils/composer_version.rs"]
#[allow(dead_code)]
mod composer_version;
use std::io::{BufRead, Write};
fn main() {
let stdin = std::io::stdin();
let out = std::io::stdout();
let mut out = std::io::BufWriter::new(out.lock());
for line in stdin.lock().lines() {
let line = line.unwrap();
let v: String = serde_json::from_str(&line).unwrap();
let n = composer_version::composer_version_normalize(&v);
let k = composer_version::composer_version_key(&v);
writeln!(out, "{}\t{}", serde_json::to_string(&n).unwrap(), serde_json::to_string(&k).unwrap()).unwrap();
}
}Then Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at the end: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL243, confirmed, filed #2527 (
go writes the first three itself: In module mode nothing reads a user's directory replace, and both spellings give the same scan. In a workspace every Go answer is MVS over the module graph, which reads the go.mod in a replacement directory; an entry with no path and no version matches no arm of With L240, rejected: vendored Yarn berry leaves an install unpatched, or an undo that is not byte for byte. Real Yarn 4.12.0, L241, rejected: a Bun L242, rejected: pnpm 9 with a catalog differs from pnpm 10. pnpm 9.15.9, the workspace of L238. Vendored refuses each package ( L244, rejected: the go.mod writer writes a file go reads differently from what was meant. For each go-accepted file with a L245, out of charter: the undo is not byte for byte for a go.mod that ends with a blank line. The upsert adds no separator when the file already ends blank, and the removal takes the blank before the directive, so one Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
#!/usr/bin/env python3
"""mkberry.py <S> <port>: add to each catalog patch the Yarn berry checksum of its patched tarball
(computed by Yarn itself) and serve the upstream checksum at /upstream/npm/<uuid>.json."""
import json, os, re, subprocess, sys, urllib.request, shutil
S, port = sys.argv[1], sys.argv[2]
BASE = f"http://127.0.0.1:{port}"
cat = json.load(open(f"{S}/cat.json"))
cat.setdefault("files", {})
YRC = 'nodeLinker: node-modules\nenableGlobalCache: false\nunsafeHttpWhitelist: ["127.0.0.1"]\nenableTelemetry: false\n'
def lock_checksums(d):
t = open(f"{d}/yarn.lock").read(); out = {}
for blk in t.split("\n\n"):
m = re.search(r'^\s+resolution: "(.*?)"', blk, re.M); c = re.search(r'^\s+checksum: (\S+)', blk, re.M)
if m and c: out[m.group(1)] = c.group(1)
return out
for i, p in enumerate(cat["patches"]):
name, version = p["purl"][len("pkg:npm/"):].rsplit("@", 1)
a = p["artifact"]
for kind, spec in (("patched", BASE + a["path"]), ("upstream", version)):
d = f"{S}/berrysum/{i}-{kind}"; shutil.rmtree(d, ignore_errors=True); os.makedirs(d)
json.dump({"name": "sum", "version": "1.0.0", "private": True, "packageManager": "yarn@4.12.0", "dependencies": {name: spec}}, open(f"{d}/package.json", "w"))
open(f"{d}/.yarnrc.yml", "w").write(YRC); open(f"{d}/yarn.lock", "w").close()
r = subprocess.run([f"{S}/fx/yb.sh", "install", "--mode=skip-build"], cwd=d, capture_output=True, text=True)
if r.returncode: print("FAILED", name, kind, r.stdout[-800:]); sys.exit(1)
sums = lock_checksums(d)
hit = [v for k, v in sums.items() if k.startswith(name + "@")]
assert len(hit) == 1, (name, kind, sums)
if kind == "patched": patched = hit[0]
else: upstream = hit[0]
p["reference"] = {"status": "granted", "url": "@BASE@" + a["path"], "purl": p["purl"], "registryOverride": None,
"artifacts": [{"kind": "tarball", "url": "@BASE@" + a["path"], "integrity": a["integrity"]},
{"kind": "yarn-berry-zip", "integrity": {"yarnBerry10c0": patched}}]}
doc = json.load(urllib.request.urlopen(f"https://registry.npmjs.org/{name.replace('/', '%2f')}/{version}"))
up = f"{S}/art/upstream-{i}.json"
json.dump({"name": name, "version": version, "integrity": doc["dist"]["integrity"], "yarnBerry10c0": upstream}, open(up, "w"))
cat["files"][f"/upstream/npm/{p['uuid']}.json"] = up
print(name, version, patched[:24], upstream[:24])
json.dump(cat, open(f"{S}/cat.json", "w"), indent=1)
The Yarn berry loop ( The Bun loop (
#!/usr/bin/env python3
"""gengomod.py <outdir> <n> <seed>: go.mod files, grammar-built then (a quarter of them) mutated,
one per directory <outdir>/<i>/go.mod."""
import os, random, sys
out, n, seed = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]); r = random.Random(seed)
mods = ["github.com/foo/bar", "golang.org/x/text", "example.com/lib", "gopkg.in/yaml.v3",
"github.com/Azure/azure-sdk-for-go", "example.com/lib/v2", "k8s.io/api", "rsc.io/quote/v3",
"go.uber.org/zap", "example.com/replace", "example.com/go", "require.example.com/x",
"use.example.com/y"]
V01 = ["v1.2.3", "v0.14.0", "v2.0.0+incompatible", "v0.0.0-20240101120000-abcdef123456",
"v1.0.0-rc.1", "v1.2.4", "v0.9.0"]
def vfor(m):
if m.endswith("/v2"): return r.choice(["v2.0.0", "v2.1.3", "v2.0.0-20240101120000-abcdef123456"])
if m.endswith("/v3") or m.endswith(".v3"): return r.choice(["v3.1.0", "v3.0.1"])
return r.choice(V01)
dirs = ["./local", "../sibling", "..", ".", "../", "./", "/abs/path", "./a b",
"./.socket/vendor/golang/11111111-1111-4111-8111-111111111111/example.com/lib@v1.2.3",
"./vendor-fork", "../../up/two", "./x//y", "../sibling/", "./local/"]
BQ = chr(96)
def q(tok):
k = r.random()
if k < .85 and " " not in tok and "//" not in tok: return tok
if k < .995 or " " in tok or "//" in tok: return '"' + tok + '"'
return BQ + tok + BQ
def ws(): return r.choice([" ", " ", " ", "\t", " ", " \t "])
def cm(): return r.choice(["", "", "", " // indirect", " // a comment", "//tight", ' // has "quote"',
" // => fake v9.9.9", " // )", " // ("])
def req():
m = r.choice(mods); return q(m) + ws() + q(vfor(m))
def rep():
m = r.choice(mods); lhs = q(m) + (ws() + q(vfor(m)) if r.random() < .5 else "")
if r.random() < .5: rhs = q(r.choice(dirs))
else:
m2 = r.choice(mods); rhs = q(m2) + ws() + q(vfor(m2))
return lhs + r.choice([" => ", " => ", "\t=>\t", " => "]) + rhs
def block(kw, gen, k):
style = r.random()
if style < .45:
return "".join(kw + ws() + gen() + cm() + "\n" for _ in range(k))
opener = kw + r.choice([" (", " (", "(", "\t(", " (", " ( "]) + cm() + "\n"
body = "".join(r.choice(["\t", " ", "", "\t\t"]) + gen() + cm() + "\n"
+ ("\n" if r.random() < .1 else "") + ("\t// lone comment\n" if r.random() < .1 else "")
for _ in range(k))
return opener + body + r.choice([")", ")", " )", ") "]) + cm() + "\n"
def one():
parts = []
m = r.choice(["example.com/app", "github.com/me/app", "app", "example.com/app/v2"])
parts.append(r.choice(["module " + q(m) + cm() + "\n", "module (\n\t" + q(m) + "\n)\n", "module\t" + m + "\n"]))
if r.random() < .9:
parts.append("go " + r.choice(["1.16", "1.17", "1.21", "1.21.0", "1.22rc1", "1.24", "1.13", "1.24.7", "1.9"]) + cm() + "\n")
rest = []
if r.random() < .3: rest.append("toolchain go1.24.7\n")
if r.random() < .15: rest.append(r.choice(["godebug default=go1.21\n", "godebug (\n\tdefault=go1.21\n\tpanicnil=1\n)\n"]))
if r.random() < .15: rest.append(r.choice(["tool golang.org/x/tools/cmd/stringer\n", "tool (\n\tgolang.org/x/tools/cmd/stringer\n)\n"]))
for _ in range(r.randint(0, 3)): rest.append(block("require", req, r.randint(0, 4)))
for _ in range(r.randint(0, 2)): rest.append(block("replace", rep, r.randint(0, 3)))
if r.random() < .3: rest.append(block("exclude", req, r.randint(1, 2)))
if r.random() < .2: rest.append(r.choice(["retract v1.0.0 // bad\n", "retract (\n\tv1.0.0\n\t[v1.1.0, v1.2.0] // range\n)\n", "retract [v1.1.0, v1.2.0]\n"]))
r.shuffle(rest)
text = ("\n" if r.random() < .7 else "").join(parts + rest)
if r.random() < .15: text = "// Deprecated: use other\n" + text
if r.random() < .1: text = text.replace("\n", "\r\n")
if r.random() < .08: text = text.rstrip("\n")
if r.random() < .01: text = "" + text
if r.random() < .25:
for _ in range(r.randint(1, 2)):
i = r.randint(0, len(text)); k = r.random()
ins = r.choice(["(", ")", "\n", " ", "\t", "//", '"', BQ, "=>", "\\", "/*", "*/", ",", ";", "\x0b", "\x0c",
" ", "require ", "replace ", "\n)\n", "\n(\n", "v1.0.0", " // x\n"])
if k < .7: text = text[:i] + ins + text[i:]
elif text: text = text[:i] + text[i + 1:]
return text
for i in range(n):
d = os.path.join(out, str(i)); os.makedirs(d, exist_ok=True)
open(os.path.join(d, "go.mod"), "w", newline="").write(one())The oracle, per directory, under #!/bin/bash
# gooracle.sh <dir>: go mod edit -json of <dir>/go.mod into <dir>/go.json (or the error into <dir>/go.err)
d=$1
if GOFLAGS=-mod=mod GOWORK=off GOTOOLCHAIN=local go mod edit -json "$d/go.mod" > "$d/go.json" 2> "$d/go.err"; then rm -f "$d/go.err"; else rm -f "$d/go.json"; fiThe probe: a scratch crate outside the repository with use socket_patch_core::vendor::go_mod_edit as g;
use std::io::{BufRead, Write};
const SMOD: &str = "patch.socket.dev/gopatch/11111111-1111-4111-8111-111111111111";
fn main() {
let mode = std::env::args().nth(1).unwrap_or_default();
let stdin = std::io::stdin();
let out = std::io::stdout();
let mut out = std::io::BufWriter::new(out.lock());
for line in stdin.lock().lines() {
let path = line.unwrap();
let bytes = std::fs::read(&path).unwrap();
let Ok(text) = String::from_utf8(bytes) else { continue };
if mode == "write" {
// the first required module, as the hosted rewriter would pin it
let mut req: Vec<(String, String)> = g::parse_required_versions(&text).into_iter().collect();
req.sort();
let Some((m, v)) = req.into_iter().next() else {
writeln!(out, "{}", serde_json::json!({"file": path, "skip": "no require"})).unwrap();
continue;
};
let sver = format!("{v}-socketpatch.1");
let up = g::upsert_hosted_replace_entry(&text, &m, &v, SMOD, &sver);
let dir = std::path::Path::new(&path).parent().unwrap().join("up");
let _ = std::fs::remove_dir_all(&dir);
let (state, roundtrip, again) = match &up {
Ok(Some(new)) => {
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(dir.join("go.mod"), new).unwrap();
let back = g::remove_replace_entry(new, &m, g::ReplaceOwner::Hosted);
let rt = match &back {
Ok(Some(b)) => if *b == text { "same".to_string() } else { std::fs::write(dir.join("back.mod"), b).unwrap(); "DIFFERENT".to_string() },
Ok(None) => "nothing removed".to_string(),
Err(e) => format!("err: {e}"),
};
let again = match g::upsert_hosted_replace_entry(new, &m, &v, SMOD, &sver) { Ok(None) => "idempotent".to_string(), Ok(Some(_)) => "CHANGED AGAIN".to_string(), Err(e) => format!("err: {e}") };
("changed".to_string(), rt, again)
}
Ok(None) => ("unchanged".to_string(), String::new(), String::new()),
Err(e) => (format!("err: {e}"), String::new(), String::new()),
};
writeln!(out, "{}", serde_json::json!({"file": path, "module": m, "version": v, "sver": sver, "upsert": state, "roundtrip": roundtrip, "again": again})).unwrap();
continue;
}
let mut req: Vec<(String, String)> = g::parse_required_versions(&text).into_iter().collect();
req.sort();
let rep: Vec<serde_json::Value> = g::parse_replace_entries(&text)
.into_iter()
.map(|e| serde_json::json!([e.module, e.version, e.path, e.rhs_module, e.rhs_version]))
.collect();
writeln!(out, "{}", serde_json::json!({"file": path, "module": g::module_path(&text), "prunes": g::prunes_module_graph(&text), "require": req, "replace": rep})).unwrap();
}
}The comparison, for the files go accepts:
#!/bin/bash
# mkgows.sh <dir> <replace target>: a root module with a nested tools module that replaces the root by <target>; go.work unless NOWORK=1
d=$1; t=$2; rm -rf $d; mkdir -p $d/tools $d/.git; echo 'ref: refs/heads/main' > $d/.git/HEAD
cat > $d/go.mod <<M
module example.com/root
go 1.24
require rsc.io/quote v1.5.2
M
cat > $d/root.go <<M
package root
import "rsc.io/quote"
func Hello() string { return quote.Hello() }
M
cat > $d/tools/go.mod <<M
module example.com/root/tools
go 1.24
require example.com/root v0.0.0
replace example.com/root => $t
M
cat > $d/tools/main.go <<M
package main
import (
"fmt"
"example.com/root"
)
func main() { fmt.Println(root.Hello()) }
M
if [ -z "$NOWORK" ]; then printf 'go 1.24\n\nuse (\n\t.\n\t./tools\n)\n' > $d/go.work; fi
export HOME=<S>/home GOMODCACHE=<S>/gomodcache GOFLAGS=-mod=mod GOTOOLCHAIN=local
(cd $d && go mod tidy >/dev/null 2>&1; cd tools && go mod tidy > /dev/null 2>&1; cd .. && [ -f go.work ] && go work sync >/dev/null 2>&1; cd tools && go build -o /dev/null . && echo "build ok")Run go with The quoted forms: The unit test is in #2527. It went into the Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at the end: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL252, confirmed, filed #2528 (
The first kind (two readers of one file that disagree) with the second's outcome (an unreadable file read as "no"). Rare: it needs L246 and L247, confirmed, a comment on #2527: the
L248, rejected: Yarn classic with a non-registry dependency beside a patched one leaves an install unpatched, or an undo that is not byte for byte. Yarn 1.22.22. Six shapes, each with a patched registry package: a git dependency from a local repository ( L249, rejected: a version 1 Bun text lock with catalogs is wired in a way Bun does not install. Bun 1.2.23 and 1.3.14 both write L250, rejected: the Rush config editor writes a file Rush reads differently from what was meant. 20,000 files in the shape of Rush's L251, out of charter: the undo is not byte for byte for a one-line table. In the 16,137 files where no held key was replaced, Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
go.work's own replace ( Module mode, the state of #1862 ( The trial: The Yarn shapes, added to elif shape == "gitdep":
doc = dict(base); doc["dependencies"] = {"left-pad": "1.3.0", "gdep": "git+file://<S>/gitrepos/gdep"}; w("package.json", doc)
elif shape == "gitsemver":
doc = dict(base); doc["dependencies"] = {"left-pad": "^1.3.0", "gdep": "git+file://<S>/gitrepos/gdep#v1.0.0"}; w("package.json", doc)
elif shape == "linkdep":
doc = dict(base); doc["dependencies"] = {"left-pad": "1.3.0", "ldep": "link:./ldep"}; w("package.json", doc)
w("ldep/package.json", {"name": "ldep", "version": "1.0.0", "dependencies": {"ms": "2.0.0"}})
w("ldep/index.js", "module.exports = 1;\n")
elif shape == "filedep":
doc = dict(base); doc["dependencies"] = {"left-pad": "^1.3.0", "fdep": "file:./fdep"}; w("package.json", doc)
w("fdep/package.json", {"name": "fdep", "version": "1.0.0", "dependencies": {"ms": "2.0.0"}})
w("fdep/index.js", "module.exports = require('ms');\n")
elif shape == "filetgz":
doc = dict(base); doc["dependencies"] = {"left-pad": "1.3.0", "tdep": "file:./tdep-1.0.0.tgz"}; w("package.json", doc)
import shutil; shutil.copy("<S>/gitrepos/tdep-1.0.0.tgz", os.path.join(d, "tdep-1.0.0.tgz"))
elif shape == "linkonly":
doc = dict(base); doc["dependencies"] = {"ms": "2.0.0", "ldep": "link:../linked-out"}; w("package.json", doc)The Bun loop ( The Rush config generator ( #!/usr/bin/env python3
"""gen.py <outdir> <n> <seed>: Rush-style pnpm-config.json files (JSON with comments), one per <outdir>/<i>.json."""
import json, os, random, sys
out, n, seed = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]); r = random.Random(seed)
os.makedirs(out, exist_ok=True)
K1, K2 = "left-pad@1.3.0", "debug@2.6.9>ms@2.0.0"
V1 = "file:../../.socket/vendor/npm/3283a603-27e7-5603-ab2a-71360d2574bf/left-pad-1.3.0.tgz"
def s(x): return json.dumps(x)
def cmt_line(): return r.choice(['// note', '// "example1": "^1.0.0",', '// }', '// { "a": [', '// "globalOverrides": {', "// it's", '// */ /*', '//', '// trailing \\'])
def cmt_block(): return r.choice(['/* note */', '/** doc */', '/* } */', '/* "x": "y", */', '/* // */', '/**/', '/* { */'])
def ov_value(): return r.choice(['^1.0.0', 'npm:@company/example2@^1.0.0', '1.3.0', 'file:../x.tgz', 'https://example.com/a//b.tgz', 'a\\"b', '~2 || /*no*/ 3', '{}', '}', '//', ''])
def ov_key(): return r.choice(['example1', 'example2', '@scope/pkg', 'foo@1>bar', 'a/*b', 'c//d', 'e}f', 'g"h', K1, K2, K1, 'left-pad', 'ms@2.0.0'])
def gen_overrides(ind, nl, depth_ind):
"""the text of the globalOverrides VALUE (an object)."""
style = r.random()
k = r.choice([0, 0, 1, 1, 2, 3])
keys = []
while len(keys) < k:
key = ov_key()
if key not in keys: keys.append(key)
rows = []
for key in keys:
v = V1 if (key == K1 and r.random() < .4) else ov_value()
rows.append((key, v))
if style < .12: # one line
if not rows: return r.choice(['{}', '{ }', '{ /* none */ }'])
body = ", ".join(f"{s(k)}: {s(v)}" for k, v in rows)
return "{ " + body + (r.choice(["", ","]) if r.random() < .3 else "") + " }"
lines = ["{" + (" " + cmt_line() if r.random() < .1 else "")]
trailing = r.random() < .3
for i, (k, v) in enumerate(rows):
if r.random() < .25: lines.append(depth_ind + ind + cmt_line())
if r.random() < .08: lines.append("")
last = i == len(rows) - 1
comma = "," if (not last or trailing) else ""
sep = r.choice([": ", ": ", ":", " : ", ":\t"])
tail = ""
q = r.random()
if q < .15: tail = " " + cmt_line()
elif q < .22: tail = " " + cmt_block()
if r.random() < .05 and comma: row = f"{s(k)}{sep}{s(v)} {cmt_block()}{comma}{tail}"
else: row = f"{s(k)}{sep}{s(v)}{comma}{tail}"
lines.append(depth_ind + ind + row)
if not rows or r.random() < .3:
for _ in range(r.randint(0 if rows else 0, 2)): lines.append(depth_ind + ind + cmt_line())
if r.random() < .05: lines.append("")
lines.append(depth_ind + "}")
return nl.join(lines)
def other_member(ind, nl):
c = r.random()
if c < .2: return f'"useWorkspaces": {r.choice(["true", "false"])}'
if c < .35: return f'"strictPeerDependencies": {r.choice(["true", "false", "null"])}'
if c < .5: return f'"pnpmStore": {s(r.choice(["local", "global"]))}'
if c < .62: return '"globalNeverBuiltDependencies": [' + ", ".join(s(x) for x in r.sample(["fsevents", "left-pad", "ms@2.0.0", "a}b", "c//d"], r.randint(0, 3))) + (r.choice(["", ","]) if r.random() < .2 else "").replace(",", "") + "]"
if c < .75: return '"globalPeerDependencyRules": {' + nl + ind + ind + cmt_line() + nl + ind + ind + '"ignoreMissing": ["@eslint/*"],' + nl + ind + ind + '"allowedVersions": { "react": "17" }' + nl + ind + "}"
if c < .85: return '"globalPatchedDependencies": {' + (" }" if r.random() < .5 else nl + ind + ind + '"left-pad@1.3.0": "patches/left-pad@1.3.0.patch"' + nl + ind + "}")
if c < .93: return '"globalPackageExtensions": {' + nl + ind + ind + '"fork-ts-checker-webpack-plugin": {' + nl + ind*3 + '"dependencies": { "@babel/core": "1.2.3" }' + (r.choice(["", ","])) + nl + ind + ind + "}" + nl + ind + "}"
return f'"minimumReleaseAge": {r.choice(["1440", "0", "1e3", "-1"])}'
def one():
nl = "\r\n" if r.random() < .12 else "\n"
ind = r.choice([" ", " ", " ", " ", "\t"])
members = []
if r.random() < .8: members.append('"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/pnpm-config.schema.json"')
if r.random() < .15: members.append('"extends": "../base/pnpm-config.json"')
others = [other_member(ind, nl) for _ in range(r.randint(0, 4))]
seen = set(); uniq = []
for m in others:
key = m.split(":")[0]
if key not in seen: seen.add(key); uniq.append(m)
members += uniq
has = r.random() < .8
if has:
at = r.randint(0, len(members))
members.insert(at, '"globalOverrides"' + r.choice([": ", ": ", ":", " : "]) + gen_overrides(ind, nl, ind))
trailing = r.random() < .25
lines = []
if r.random() < .6: lines += ["/**", " * This configuration file provides settings specific to the PNPM package manager.", " */"]
elif r.random() < .2: lines += ["// pnpm settings { not a brace"]
lines.append("{" + (" " + cmt_line() if r.random() < .05 else ""))
for i, m in enumerate(members):
if r.random() < .5:
lines += [ind + "/**", ind + " * " + r.choice(["Doc.", 'The "globalOverrides" setting {…}', "It's a setting // not a comment"]), ind + " */"]
last = i == len(members) - 1
comma = "," if (not last or trailing) else ""
tail = (" " + cmt_line()) if r.random() < .1 else ""
lines.append(ind + m + comma + tail)
if r.random() < .5: lines.append("")
if r.random() < .2: lines.append(ind + cmt_line())
lines.append("}")
text = nl.join(lines) + (nl if r.random() < .9 else "")
if r.random() < .03: text = "" + text
if r.random() < .05 and not members: text = "{}" + nl
return text
for i in range(n):
open(os.path.join(out, f"{i}.json"), "w", newline="").write(one())The probe: a scratch crate outside the repository ( mod formats {
#[path = "<repo>/crates/socket-patch-core/src/formats/text.rs"]
pub mod text;
#[path = "<repo>/crates/socket-patch-core/src/formats/package_json.rs"]
pub mod package_json;
}
mod utils {
#[path = "<repo>/crates/socket-patch-core/src/utils/line_endings.rs"]
pub mod line_endings;
}
#[path = "<repo>/crates/socket-patch-core/src/vendor/jsonc.rs"]
mod jsonc;Per file ( Rush's own loader ( // load.js <pnpm-config.json>...: what Rush's own loader reads as globalOverrides
const rush = require(process.env.RUSHLIB);
const P = rush._PnpmOptionsConfiguration || rush.PnpmOptionsConfiguration;
for (const f of process.argv.slice(2)) {
try { const c = P.loadFromJsonFileOrThrow(require('path').resolve(f), require('path').resolve('tmp')); console.log(f, '=> pnpmStore', c.pnpmStore, 'globalOverrides', JSON.stringify(c.globalOverrides)); }
catch (e) { console.log(f, '=> REJECTED:', String(e.message).split('\n')[0].slice(0, 200)); }
}The four files: The unit test is in #2528. It went into the Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at the end: #2453, #2458 and #2461, each No lead was marked Two of the four were not new, and I saw that only at the end. The 06:55Z run had already put the version port through Composer (L236, 1,076,206 spellings), and the 02:55Z run had rejected the first-wins hypothesis by reading (L226). I took both from older "not run" lines without searching the later entries. L253 below is a second run of L236 with another generator, and L257 adds the run that L226 lacked. The two that were new are the
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL255 and L256, confirmed, a comment on #2528: the two other reads of a Rush config take "cannot read" for "no". #2528 listed both as read and not run. On the
The plan on the issue keeps its shape and gains one read: L253, rejected, a repeat of L236: the Composer version port and Composer disagree on a spelling a lock or a patch can hold. L236 ran this over 1,076,206 spellings and found no difference. This is the same comparison with an independent generator. 300,000 distinct strings: an optional L254, rejected:
So Composer's default did change at 2.1 ( L257, rejected, L226 with its run: agent mode patches one of two Composer or Go stores and reports the package patched (#2519's outcome for NuGet). L226 rejected this by reading. Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The version port. <?php
// oracle.php: one JSON string per input line -> Composer's VersionParser::normalize, or null where it throws.
require 'phar://' . __DIR__ . '/composer.phar/vendor/autoload.php';
$p = new Composer\Semver\VersionParser();
$in = fopen('php://stdin', 'r');
while (($line = fgets($in)) !== false) {
$v = json_decode($line);
try { $n = $p->normalize($v); } catch (\Throwable $e) { $n = null; }
echo json_encode($n, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE), "\n";
}#!/usr/bin/env python3
"""gen.py <n> <seed>: one JSON string per line, Composer version spellings (realistic first, then mutated)."""
import json, random, sys
n, seed = int(sys.argv[1]), int(sys.argv[2]); r = random.Random(seed)
PRE = ["", "", "", "v", "v", "V"]
STAB = ["stable", "STABLE", "Stable", "beta", "BETA", "Beta", "b", "B", "RC", "rc", "Rc", "alpha", "ALPHA", "Alpha", "a", "A", "patch", "PATCH", "pl", "PL", "p", "P"]
SEP = ["", "-", "-", ".", "_"]
NUM = ["", "", "1", "2", "10", ".1", "-1", "1.2", ".1.2", "-1-2", "01", "0", ".0"]
DEV = ["", "", "", "", "dev", "-dev", ".dev", "-DEV", "DEV", ".Dev"]
META = ["", "", "", "", "+build", "+build.1", "+exp.sha.5114f85", "+a+b", "+"]
FLAG = ["", "", "", "", "", "@dev", "@stable", "@RC", "@beta", "@alpha", "@DEV", "@Stable", "@rc"]
BRANCH = ["dev-main", "dev-master", "DEV-main", "Dev-Main", "dev-feature/foo", "dev-1.x", "master", "trunk", "default", "main", "1.x-dev", "1.2.x-dev", "1.*-dev", "1.X-dev", "v1.x-dev", "1.2.3.x-dev", "1.2.3.4.x-dev", "x-dev", "1.x.x-dev", "1.x.2-dev", "1.x", "1.2.x", "1.*", "feature-dev", "1.0.x-DEV", "1.0.x.dev", "1.0.xdev", "2.x-dev#abc123", "dev-main#abc123", "1.x-dev@dev", "1-dev", "1.2-dev", "v1-dev", "1.2.3-dev", "1.2.3.4-dev", "1.2.3.4.5-dev", "00.x-dev", "1.x-dev+build"]
def digits():
k = r.choice([1, 1, 1, 2, 2, 3, 4, 4, 5, 6, 8])
s = "".join(r.choice("0123456789") for _ in range(k))
return s
def core():
parts = [digits() for _ in range(r.choice([1, 2, 3, 3, 3, 3, 4, 4, 5]))]
return ".".join(parts)
def date():
y = r.choice(["2010", "2019", "2023", "1999", "0001"])
seps = r.choice(["-", ".", "", ":", "-", "."])
parts = [y] + [f"{r.randint(0, 99):02d}" for _ in range(r.choice([1, 2, 2, 2, 3, 4, 5, 6, 7]))]
s = seps.join(parts)
if r.random() < .3: s += r.choice([".", "-", ":", ""]) + str(r.randint(0, 999))
if r.random() < .15: s += r.choice([".", "-", ""]) + str(r.randint(0, 999))
return s
def modifier():
q = r.random()
if q < .45: return ""
out = r.choice(SEP)
if r.random() < .85: out += r.choice(STAB) + r.choice(NUM)
out += r.choice(DEV)
return out
def one():
q = r.random()
if q < .62: v = r.choice(PRE) + core() + modifier()
elif q < .80: v = r.choice(PRE) + date() + modifier()
elif q < .93: v = r.choice(BRANCH)
else: v = r.choice(PRE) + core() + r.choice(["x", ".x", ".*", ".X", "-x", "x-dev", ".x-dev", ".*-dev"])
v += r.choice(META) if r.random() < .5 else ""
v += r.choice(FLAG)
q = r.random()
if q < .04: v = v + " as " + r.choice(PRE) + core()
elif q < .06: v = r.choice(BRANCH) + " as " + v
elif q < .07: v = v + " as " + core() + modifier()
q = r.random()
if q < .03: v = " " + v
elif q < .06: v = v + " "
elif q < .08: v = v + "\n"
elif q < .09: v = "\t" + v + "\r\n"
elif q < .10: v = v + "\x0b"
# byte-level mutation
if r.random() < .08 and v:
i = r.randrange(len(v)); c = r.choice(list("vV.-_+@ xX*#/:,~^<>=|é\x00\n") + ["dev", "RC", "0"])
v = r.choice([v[:i] + c + v[i:], v[:i] + c + v[i+1:], v[:i] + v[i+1:]])
return v
seen = set()
while len(seen) < n:
v = one()
if v in seen: continue
seen.add(v); print(json.dumps(v, ensure_ascii=False))The install matrix ( #!/usr/bin/env python3
"""matrix.py <sp binary>: for each preferred-install value and locked version, where real `composer install`
takes a Socket-wired lock entry that still has a `source` from, and what `vex`'s reader of the same lock says."""
import json, os, shutil, subprocess, sys
SP = sys.argv[1]
COMPOSER = sys.argv[2:] or ["composer"]
H = os.path.dirname(os.path.abspath(__file__))
UUID = "5f3c8a2e-7b41-4d6a-9e0c-1a2b3c4d5e6f"
ENV = dict(os.environ, COMPOSER_HOME=f"{H}/chome", COMPOSER_ALLOW_SUPERUSER="1",
COMPOSER_NO_INTERACTION="1", SOCKET_TELEMETRY_DISABLED="1", SOCKET_NO_CONFIG="1",
GIT_CONFIG_GLOBAL="/dev/null", GIT_CONFIG_SYSTEM="/dev/null")
os.makedirs(f"{H}/chome", exist_ok=True)
def sh(*a, cwd=None, check=True):
p = subprocess.run(a, cwd=cwd, env=ENV, capture_output=True, text=True)
if check and p.returncode: raise SystemExit(f"{a} failed in {cwd}:\n{p.stdout}\n{p.stderr}")
return p
# the pristine upstream, as a local git repository
G = f"{H}/gitsrc/psr-log"
if not os.path.isdir(G):
os.makedirs(f"{G}/src")
open(f"{G}/composer.json", "w").write(json.dumps({"name": "psr/log", "type": "library", "autoload": {"psr-4": {"Psr\\Log\\": "src"}}}, indent=4))
open(f"{G}/src/Pristine.php", "w").write("<?php // upstream\n")
sh("git", "init", "-q", "-b", "main", cwd=G); sh("git", "add", "-A", cwd=G)
sh("git", "-c", "user.name=t", "-c", "user.email=t@example.com", "commit", "-q", "-m", "upstream", cwd=G)
REF = sh("git", "rev-parse", "HEAD", cwd=G).stdout.strip()
PREFS = [None, "dist", "source", "auto", "Source", "",
{"psr/*": "source"}, {"PSR/*": "source"}, {"psr/log": "dist", "psr/*": "source"}, {"psr/*": "source", "psr/log": "dist"},
{"monolog/*": "source"}, {"monolog/*": "source", "*": "source"}, {"*": "source", "psr/log": "dist"}, {"psr/*": "auto"}, {"*": "auto"},
{"psr/l?g": "source"}, {"psr/log": "SOURCE"}, {"**": "source"}, {"psr/*": "dist", "*": "source"}, {"*/log": "source"}, {"psr": "source"},
{"psr/lo*": "source", "*": "dist"}, {"p*g": "source"}, {"psr/log": "auto", "*": "source"}, {"*": "dist", "**": "source"}, {"psr.log": "source"},
{"psr/(log)": "source"}, {"psr/log": ""}, {}, {"*": ""}]
VERSIONS = ["3.0.2", "dev-main", "1.x-dev", "3.0.2-dev", "v3.0.2-RC1"]
APIS = ["2.6.0", "2.0.0", None]
def project(d, pref, version, api):
shutil.rmtree(d, ignore_errors=True)
leaf = f".socket/vendor/composer/{UUID}/psr/log@{version.split('#')[0]}"
os.makedirs(f"{d}/{leaf}/src")
open(f"{d}/{leaf}/composer.json", "w").write(json.dumps({"name": "psr/log", "type": "library"}, indent=4))
open(f"{d}/{leaf}/src/Patched.php", "w").write("<?php // patched\n")
open(f"{d}/.socket/vendor/composer/{UUID}/socket-patch.vendor.json", "w").write(json.dumps({"schemaVersion": 1, "purl": f"pkg:composer/psr/log@{version.split('#')[0]}", "patchUuid": UUID, "ecosystem": "composer", "vulnerabilities": [], "vendoredAt": "2026-09-26T00:00:00Z"}, indent=2))
manifest = {"name": "socket/composer-vendored-fixture", "require": {"psr/log": version}, "minimum-stability": "dev", "repositories": [{"packagist.org": False}]}
if pref is not None: manifest["config"] = {"preferred-install": pref}
open(f"{d}/composer.json", "w").write(json.dumps(manifest, indent=4))
lock = {"_readme": ["x"], "content-hash": "7a59d114f58e9b02546b21d7e57430d3", "packages": [{
"name": "psr/log", "version": version,
"source": {"type": "git", "url": G, "reference": REF},
"dist": {"type": "path", "url": leaf, "reference": UUID},
"transport-options": {"symlink": False}, "type": "library", "autoload": {"psr-4": {"Psr\\Log\\": "src"}}}],
"packages-dev": [], "aliases": [], "minimum-stability": "dev", "stability-flags": {}, "prefer-stable": False, "prefer-lowest": False, "platform": {}, "platform-dev": {}}
if api: lock["plugin-api-version"] = api
open(f"{d}/composer.lock", "w").write(json.dumps(lock, indent=4))
rows = []
for api in APIS:
for version in VERSIONS:
for i, pref in enumerate(PREFS):
if api != "2.6.0" and i >= 6 and i not in (6, 10, 13, 14, 28): continue # the default only matters where it is reached
d = f"{H}/cells/c"
project(d, pref, version, api)
v = sh(SP, "vex", "--offline", "--json", "--output", f"{H}/cells/vex.json", cwd=d, check=False)
try: env = json.loads(v.stdout)
except Exception: env = {}
warns = [w for w in env.get("warnings") or [] if w.get("code") == "patched_ref_invalid"]
skipped = [e for e in env.get("events") or [] if e.get("errorCode") == "record_unavailable"]
port = "source" if any("keeps a `source`" in w.get("detail", "") for w in warns) else "dist" if skipped else f"? {v.returncode} {(env.get('error') or {}).get('code')} {[w.get('detail','')[:120] for w in warns]}"
c = sh(*COMPOSER, "install", "--no-progress", "--no-scripts", "--no-plugins", cwd=d, check=False)
real = "?"
try:
inst = json.load(open(f"{d}/vendor/composer/installed.json"))
pk = [p for p in (inst if isinstance(inst, list) else inst["packages"]) if p["name"] == "psr/log"][0]
files = sorted(os.listdir(f"{d}/vendor/psr/log/src"))
real = pk.get("installation-source") + ":" + ",".join(files)
except Exception as e:
real = f"composer failed ({c.returncode}): " + (c.stderr.strip().splitlines() or ["?"])[-1][:160]
rows.append((api, version, json.dumps(pref), port, real))
agree = 0
for api, version, pref, port, real in rows:
same = (port == "source" and real == "source:Pristine.php") or (port == "dist" and real == "dist:Patched.php")
agree += same
if not same: print("DIFF", f"api={api} version={version} pref={pref}: reader says {port}; composer: {real}")
print(f"{len(rows)} cells, {agree} agree")
json.dump(rows, open(f"{H}/rows.json", "w"), indent=0)Older Composer releases: The Rush probes are in the comment on #2528, as run. The two-store probe. A project |
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 15:17Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL259, confirmed, a comment on #2455: in a vendored project with no manifest, every command the CLI names to put lost wiring back exits 0 and changes nothing. #2455 listed the
The same six exit codes and an unchanged tree on uv, Poetry, PDM, Pipenv and npm. The state does not need the flag: By grep, 26 message lines in 13 files name L258, rejected: undoing several vendored packages of one Python lock leaves something behind, or depends on the order. L260, rejected: an undo after L261, rejected: a partly preserved state is attested or cannot be finished. L262, rejected: the same orders in hosted mode. Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
python3 mkwheel2.py art cat.json six==1.16.0:six.py idna==3.7:idna/__init__.py packaging==24.0:packaging/__init__.py
python3 mknpm2.py artn catn.json ms@2.0.0:package/index.js left-pad@1.3.0:package/index.js # then its patches appended to cat.json
python3 papi.py --port 18110 --catalog cat.json --log papi.log &The projects, one directory each under
PDM 2.25.9:
The orders ( #!/usr/bin/env python3
"""undo.py <backend> <check-cmd or ''> : every undo order over vend/<backend>, compared with base/<backend>.
After every step the tool's own lock check runs (if given); after the last step the tree is diffed against base."""
import itertools, os, shutil, subprocess, sys, json
S = os.path.dirname(os.path.abspath(__file__))
b, check = sys.argv[1], sys.argv[2]
extra_env = sys.argv[3:]
SRC, MODE = os.environ.get("SRC", "vend"), os.environ.get("MODE", "vendored")
PURLS = {"A": "pkg:pypi/idna@3.7", "B": "pkg:pypi/packaging@24.0", "C": "pkg:pypi/six@1.16.0"}
def sp(cwd, *args):
p = subprocess.run([f"{S}/sp.sh", "18110", *extra_env, "--", *args], cwd=cwd, capture_output=True, text=True)
return p.returncode, (p.stdout + p.stderr)
REVERT = ["vendor", "--revert"] if MODE == "vendored" else ["rollback", "--yes"]
RESCAN = ["scan", "--mode", MODE, "--yes"]
seqs = [("revert", [REVERT]), ("rollback", [["rollback", "--yes"]])]
keys = sorted(PURLS)
for perm in itertools.permutations(keys):
seqs.append(("rollback " + "".join(perm), [["rollback", "--yes", PURLS[k]] for k in perm]))
for perm in itertools.permutations(keys):
seqs.append(("remove " + "".join(perm), [["remove", "--yes", PURLS[k]] for k in perm]))
seqs.append(("rollback A, remove B, revert", [["rollback", "--yes", PURLS["A"]], ["remove", "--yes", PURLS["B"]], REVERT]))
seqs.append(("rollback B, rescan, rollback", [["rollback", "--yes", PURLS["B"]], RESCAN, ["rollback", "--yes"]]))
seqs.append(("remove A, rescan, revert", [["remove", "--yes", PURLS["A"]], RESCAN, REVERT]))
bad = 0
for name, steps in seqs:
cell = f"{S}/cells/{b}"
shutil.rmtree(cell, ignore_errors=True)
shutil.copytree(f"{S}/{SRC}/{b}", cell, symlinks=True)
notes = []
for i, st in enumerate(steps):
rc, out = sp(cell, *st)
if rc != 0: notes.append(f"step {i+1} {' '.join(st[:2])} exit {rc}: {out.strip().splitlines()[-1][:200] if out.strip() else ''}")
if check:
c = subprocess.run(check, shell=True, cwd=cell, capture_output=True, text=True)
if c.returncode != 0:
notes.append(f"after step {i+1}: `{check}` exit {c.returncode}: {(c.stdout + c.stderr).strip().splitlines()[-1][:240]}")
d = subprocess.run(["diff", "-r", "-x", ".git", f"{S}/base/{b}", cell], capture_output=True, text=True)
if d.returncode != 0:
bad += 1
notes.append("DIFF vs base:\n" + d.stdout[:1500])
print(("ok " if not notes else "BAD ") + name + ("" if not notes else "\n " + "\n ".join(notes)))
print(f"{len(seqs)} sequences, {bad} differ from base")L259, in a copy of L260: after the preserve run, Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 17:25Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL266, confirmed, filed #2532:
The plan is four lines: keep the jar's entry as it is when its L267, confirmed, a comment on #2532: hosted mode has the same back-and-forth. After L263, rejected: a hand-formatted verification file is mis-edited or breaks the build. Single-quoted attributes, L264, out of charter: a file with no L265, rejected: a file Gradle generated, or a key-trusted one, breaks after vendoring. Eleven projects: Seen and not filed (in #2532's "Also seen"):
No issue closed. No lead is marked Areas examined
Lessons
The fixturesTwo scratch test files, copies of The cells: The unit test and the four-line change are in #2532. Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 19:15Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL271, confirmed, a comment on #2528: with a JSON5 spelling in
Rush prints the two The third "not run" line there, L268, rejected: undoing several patched packages of one Yarn berry project leaves something behind, or depends on the order. L269, rejected: the same for vlt. L270, rejected: the same for Rush. Each patched package is a direct dependency of two projects, so every project's L272, out of charter: a workspace's own member that has the name and version of a patched public package. A scan over an installed tree counts the members that
The member's source is byte for byte the same after every run, and the other packages are patched. What is left is wording: the pnpm and Rush vendored refusals name an install that cannot help, where npm's names the member. No issue: no outcome is wrong. Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
Blobs for agent mode, added to The tools. The projects. Each
Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 21:22Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL276, confirmed, filed as #2534: the Hatch environments of a project with no
The planned fix is in the issue: look under the directory's normalized name and under L273, rejected: an everyday command of a Python lock tool leaves a state socket-patch misreports.
In every cell the file Python imports matched what the commands said. L274, rejected: a lock that resolves one package at two releases is wired for the wrong one. L275, rejected: a named Hatch project's environment is somewhere the lookup does not read. One agent scan each, the marker read in the environment Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
A blob route for wheels and tarballs, in The lock projects.
The forks. uv: Hatch.
The failing test (a throwaway, never committed): Needs a person
|
|
[agent] 2026-12-05: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 23:22Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL281, confirmed, filed as #2536: a Maven project scan skips what a dependency's pom declares in a profile. In project mode the crawl keeps the coordinates the project's poms reach (#265).
For the first, A unit test beside L282, confirmed, a comment on #2521: the prune remedy exits 1 after L277, rejected: an everyday Pipenv command leaves a state socket-patch misreports.
In every cell the file Python imports matched what the commands said. L278, rejected: a Pipenv project's environment is somewhere the lookup does not read. L279, rejected: an everyday Composer command over a hosted pin leaves a state socket-patch misreports.
L280, rejected: removing or adding a dependency on npm, pnpm, Yarn 1 or Bun leaves a state socket-patch misreports.
Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The Pipenv project.
The Pipenv places ( The Composer project.
The npm projects.
pnpm's rule alone: Maven. One The failing test and the trial are in #2536. The test went into the Needs a person
|
|
[agent] 2026-12-06: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 01:44Z: #2453, #2458 and #2461, each No lead was marked The check was a stand-in patch API that answers the later requests of a window first and fails chosen ones, and each command run three times per cell: one request at a time, the default window, and 32. Then I read what each failed run tells the user.
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL283, confirmed, filed as #2537: The scan already computes A test beside L284, rejected: a concurrent window gives another answer than the serial loop. The stand-in delays request L285, rejected: a hosted scan misreports a package whose reference is refused. One line per package ( L286, rejected: L287, rejected: a vendored scan misreports when the vendoring service fails. One artifact failing: L288, rejected as far as it can be run here: a hosted re-scan without a usable token unpins paid patches. A lock with 40 hosted pins, two of them paid, scanned again with the token refused (at the first batch and mid-run) and with no token. When the stand-in's proxy answers Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The project (
The runs: The failing test and the trial are in #2537. The test went into Needs a person
|
|
[agent] 2026-12-06: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 03:50Z: #2453, #2458 and #2461, each No lead was marked The harness was the repository's own fixture vendor service (
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL293, confirmed, filed as #2538 (
A restore between the two (newer patch vendored, nothing undone) passes and installs the newer patch, and The backend names the hazard for a re-vendor under the same uuid (core L289, rejected: the download plan or pre-staging changes what a vendor run does. Each cell ran the same command in a fresh copy of the project with L294, rejected: an interrupted vendor run leaves something a later command trips over. A signal ends the process with no message, the locks and the ledger untouched (the group commit never ran), and leaves three pre-staged trees beside whatever artifacts the loop had written. L290, rejected: a failed vendor leaves state a retry or an undo does not converge from. After the retry, three kinds of file differ from a clean run's, all by order: a retry appends, so L291, rejected: L292, rejected: a newer patch that fails breaks or misattests the vendored one. On all ten fixtures, unserved answers (404, Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The holder (
The other runners share
The newer patch with other bytes (NuGet): copy the fixture's The SDK: The released binary: The failing test is in #2538. Needs a person
|
|
[agent] 2026-12-06: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 05:20Z: #2453, #2458 and #2461, each No lead was marked The first was the span readers of The second was the list the 01:45Z entry left on a failing patch API: a second scan, several project directories, and
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL295, rejected: a second scan drops a patch it could not look up again. A project of 40 npm packages, all patched by a first scan, scanned again with part of the lookup failing. Agent mode: 40 patched files, 40 records and 80 blobs before and after in 22 cells, 15 of them L296, confirmed, a comment on #2537: on a second scan the closing lines count a patch that is in place as left to patch. With one patch-list request answered 500, a second scan of the fully patched project prints L297, rejected: a scan of several project directories misreports a directory when the shared lookup is incomplete. Three directories over overlapping slices of the 40 packages, each a L298, rejected: Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The runs: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Note
[agent] This is the third architecture thread for socket-patch. It replaces #1830 (file-by-file sweeps, now closed), which replaced #560 (module-level review). Both are archived on the ledger branch under
review/.Progress: 1 problems tracked · 1 filed. On GitHub: 195 open and 166 closed
arch-auditissues · 3 open and 122 mergedarch-refactorPRs.arch-refactor· issues labelledarch-audit· decisions neededRendered 2026-12-06 05:26 UTC (ledger
cebcce1f) fromdoc/on thearch-audit/ledgerbranch.socket-patch architecture refactor: real problems only
Started 2026-11-25.
Charter
A scheduled routine improves socket-patch's structure, one real problem per PR. Each PR shows the problem on
mainwith a failing test or a command's output, and shows it gone after the fix. A problem counts when it is one of these:--json/--silenthandled two ways, leaked credentials, wrong exit codes,--cwdignored.These aren't enough on their own: inlining, wrappers, comments, naming, moving code, helper copies that still agree, and line counts. They are welcome only inside code a real fix already touches.
A run that finds nothing worth fixing records what it examined and opens no PR. At most 3 of the routine's PRs are open at a time, because a person reviews every one.
The full procedure is
REFACTOR.mdon the ledger branch.All reactions