Repository navigation
socket-patch architecture refactor: real problems only (living document) #2244
Replies: 99 comments
Register[agent] Rendered from Last updated 2026-12-04 · 98 runs under this charter · In flight
Next PR: #2450 and #2413's second point (want a word), #2348 (Cargo, Go, Composer), #2490 with #2489, #2494, #2498, #2501, #2474, #2380, #2387, #2359, #2362, #2360, #2375, #2305, #2308, #2310, #2312, #2314, #2355, #2364, #2367, #2377, #2330, #2332, #2290, #2299, #2327 with #2334, #2318, #2351, #2321, #2286 with #2466 to #2469, #2472, #2477, #2315, #2336, #2337, #2345, #2339, #2349 and #2361. Then #2259, #2294, #2296, #2271, L22, #647, #1917, #1926 with #2465, #1860, #1836, #2306, #2322, #2324, #2328, #2344, #2346, #2356, #2368, #2370, #2371, #2383, #2385, #2401, #2412, #2462, #2486, #2487 and #594 (low), #2319, #2333, #1970, #2363, #2365, #2419, #2421 and #2429 (test only). #2455 after #2453. #2277, #2297, #2309, #2340, #2347, #2366, #2475, #2480 and #2496 wait for an answer. Contract sentences for #2393, #2396, #2427, #2453, #2458: after #2459. Merged
Leads
Issues: #1910 fixed in part (#2246, #2261; L22 open); #1014, #1963, #717, #815 closed as false; seven confirmed (in Next PR); 41 more out of charter. All open at 12-04 04:58Z were seen. Areas examined
Notes
|
|
[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 - "vulnerabilities": vulns,
+ "vulnerabilities": vulns.into_iter().take(0).collect::<Vec<_>>(),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-02: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 23:21Z: #2453, #2458 and #2461, each No lead was marked Two defects on PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL148, confirmed, filed #2465 ( The binary of a95f10c, files only, a global npm install at a temp prefix holding
Every run exits 0. The fix was tried and not pushed: skipping an entry with unchanged content in L149, confirmed, filed #2466 (
Afterwards #2348, confirmed again on No issue closed. No lead is marked Areas examined
Lessons
#!/usr/bin/env python3
"""mk2.py <npm|gem|pypi> <dir> <spec.json>: one installed package and .socket/manifest.json.
spec: {"files": {rel: {"before": str|null, "after": str, "mode": str|null,
"installed": "before"|"after"|"absent"|<text>, "fsmode": "666"}}, "noblobs": bool}"""
import base64, hashlib, json, os, sys, shutil
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
eco, d, spec = sys.argv[1], sys.argv[2], json.load(open(sys.argv[3]))
shutil.rmtree(d, ignore_errors=True)
os.makedirs(os.path.join(d, ".socket", "blobs"))
if eco == "npm":
pkg = os.path.join(d, "node_modules", "left-pad"); prefix = "package/"; purl = "pkg:npm/left-pad@1.3.0"
os.makedirs(pkg)
json.dump({"name": "app", "version": "1.0.0", "dependencies": {"left-pad": "1.3.0"}}, open(os.path.join(d, "package.json"), "w"))
json.dump({"name": "left-pad", "version": "1.3.0"}, open(os.path.join(pkg, "package.json"), "w"))
elif eco == "gem":
home = os.path.join(d, "vendor/bundle/ruby/3.2.0"); pkg = os.path.join(home, "gems", "octopoller-0.2.0"); prefix = ""; purl = "pkg:gem/octopoller@0.2.0"
os.makedirs(os.path.join(pkg, "lib")); os.makedirs(os.path.join(home, "specifications"))
open(os.path.join(home, "specifications", "octopoller-0.2.0.gemspec"), "w").write("# installed spec\n")
elif eco == "pypi":
sp = os.path.join(d, ".venv/lib/python3.12/site-packages"); pkg = sp; prefix = ""; purl = "pkg:pypi/six@1.16.0"
os.makedirs(os.path.join(sp, "six-1.16.0.dist-info"))
open(os.path.join(d, ".venv", "pyvenv.cfg"), "w").write("home = /usr/bin\nversion = 3.12.3\n")
open(os.path.join(sp, "six-1.16.0.dist-info", "METADATA"), "w").write("Metadata-Version: 2.1\nName: six\nVersion: 1.16.0\n")
files = {}
for rel, f in spec["files"].items():
b = None if f["before"] is None else f["before"].encode(); a = f["after"].encode()
e = {"beforeHash": "" if b is None else gh(b), "afterHash": gh(a)}
if f.get("mode") is not None: e["mode"] = f["mode"]
files[prefix + rel] = e
if not spec.get("noblobs"):
for blob in (b, a):
if blob is not None: open(os.path.join(d, ".socket", "blobs", gh(blob)), "wb").write(blob)
inst = f.get("installed", "before")
content = b if inst == "before" else a if inst == "after" else inst.encode()
p = os.path.join(pkg, rel); os.makedirs(os.path.dirname(p), exist_ok=True)
if inst != "absent":
open(p, "wb").write(content); os.chmod(p, int(f.get("fsmode", "644"), 8))
m = {"patches": {purl: {"uuid": "11111111-1111-4111-8111-111111111111", "exportedAt": "2026-01-01T00:00:00Z", "files": files,
"vulnerabilities": {"GHSA-aaaa-bbbb-cccc": {"cves": ["CVE-2026-0001"], "summary": "s", "severity": "high", "description": "d"}},
"description": "fix", "license": "MIT", "tier": "free"}}}
json.dump(m, open(os.path.join(d, ".socket", "manifest.json"), "w"), indent=2)For a real install, build the manifest from the installed file instead ( Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 01:21Z: #2453, #2458 and #2461, each No lead was marked Three defects on PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL150, confirmed, filed #2467 ( The fixtures of
Between the L151, confirmed, filed #2468 ( The binary of d987721, a stand-in patch API, a project with
Afterwards L152, confirmed, filed #2469 (
A failing test in The NuGet advisories of #2416, through the binary: clean. A hand-built restored project ( No issue closed. No lead is marked Areas examined
Lessons
#!/usr/bin/env python3
"""mkscopes.py <w>: a project (ms 2.0.0) and a global npm prefix (left-pad 1.3.0), plus catalog.json for api.py.
Run: env -i PATH HOME=<w>/home npm_config_prefix=<w>/gprefix SOCKET_PROXY_URL=http://127.0.0.1:<port>
SOCKET_TELEMETRY_DISABLED=1 SOCKET_NO_CONFIG=1 GIT_CEILING_DIRECTORIES=<w> socket-patch ... in <w>/proj."""
import hashlib, json, os, shutil, sys, base64
w = os.path.abspath(sys.argv[1])
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
shutil.rmtree(w, ignore_errors=True)
proj = os.path.join(w, "proj"); g = os.path.join(w, "gprefix", "lib", "node_modules")
os.makedirs(os.path.join(proj, ".git")); os.makedirs(os.path.join(w, "home"))
open(os.path.join(proj, ".git", "HEAD"), "w").write("ref: refs/heads/main\n")
catalog = {}
def pkg(root, n, v, last):
pk = os.path.join(root, n); os.makedirs(pk)
open(os.path.join(pk, "package.json"), "w").write(json.dumps({"name": n, "version": v}) + "\n")
before = f"module.exports = '{n}@{v} before'\n".encode(); after = f"module.exports = '{n}@{v} after'\n".encode()
open(os.path.join(pk, "index.js"), "wb").write(before)
catalog[f"pkg:npm/{n}@{v}"] = [{"uuid": "aaaaaaaa-0000-4000-8000-00000000000" + last, "purl": f"pkg:npm/{n}@{v}", "tier": "free", "severity": "high",
"ghsa": "GHSA-aaaa-aaaa-000" + last, "cve": "CVE-2026-000" + last, "publishedAt": "2026-01-01T00:00:00Z",
"files": {"package/index.js": {"before": base64.b64encode(before).decode(), "after": base64.b64encode(after).decode(), "beforeHash": gh(before), "afterHash": gh(after)}}}]
pkg(os.path.join(proj, "node_modules"), "ms", "2.0.0", "1")
pkg(g, "left-pad", "1.3.0", "2")
deps = {"ms": "2.0.0"}
open(os.path.join(proj, "package.json"), "w").write(json.dumps({"name": "app", "version": "1.0.0", "dependencies": deps}, indent=2) + "\n")
lock = {"name": "app", "version": "1.0.0", "lockfileVersion": 3, "requires": True, "packages": {"": {"name": "app", "version": "1.0.0", "dependencies": deps},
"node_modules/ms": {"version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-" + base64.b64encode(hashlib.sha512(b"ms2.0.0").digest()).decode()}}}
open(os.path.join(proj, "package-lock.json"), "w").write(json.dumps(lock, indent=2) + "\n")
json.dump(catalog, open(os.path.join(w, "catalog.json"), "w"), indent=1)For #2469, the same layout with #!/usr/bin/env python3
"""mknuget.py <dir>: a restored .NET project with one agent-mode patch record and two build outputs (no SDK).
Run with NUGET_PACKAGES=<dir>/pkgs and --offline."""
import hashlib, json, os, sys, shutil
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
d = os.path.abspath(sys.argv[1])
shutil.rmtree(d, ignore_errors=True)
pk = os.path.join(d, "pkgs"); pdir = os.path.join(pk, "newtonsoft.json", "13.0.3")
os.makedirs(os.path.join(pdir, "lib", "net6.0")); os.makedirs(os.path.join(d, "obj")); os.makedirs(os.path.join(d, ".socket", "blobs"))
open(os.path.join(d, "app.csproj"), "w").write('<Project Sdk="Microsoft.NET.Sdk" />')
json.dump({"version": 3, "targets": {}, "libraries": {"Newtonsoft.Json/13.0.3": {"type": "package", "path": "newtonsoft.json/13.0.3"}}, "packageFolders": {pk: {}}}, open(os.path.join(d, "obj", "project.assets.json"), "w"), indent=2)
open(os.path.join(pdir, "newtonsoft.json.nuspec"), "w").write("<package/>")
open(os.path.join(pdir, ".nupkg.metadata"), "w").write('{"contentHash":"deadbeef"}')
orig, patched = b"the vulnerable code\n", b"the patched code!!!\n"
open(os.path.join(pdir, "lib", "net6.0", "Newtonsoft.Json.dll"), "wb").write(orig)
for b in (orig, patched): open(os.path.join(d, ".socket", "blobs", gh(b)), "wb").write(b)
m = {"patches": {"pkg:nuget/Newtonsoft.Json@13.0.3": {"uuid": "20000008-0000-4008-8008-000000000008", "exportedAt": "2026-01-01T00:00:00Z",
"files": {"package/lib/net6.0/Newtonsoft.Json.dll": {"beforeHash": gh(orig), "afterHash": gh(patched)}},
"vulnerabilities": {"GHSA-aaaa-bbbb-cccc": {"cves": ["CVE-2026-0001"], "summary": "s", "severity": "high", "description": "d"}},
"description": "fix", "license": "MIT", "tier": "free"}}}
json.dump(m, open(os.path.join(d, ".socket", "manifest.json"), "w"), indent=2)
for cfg, b in (("Debug", patched), ("Release", orig)):
o = os.path.join(d, "bin", cfg, "net8.0"); os.makedirs(o); open(os.path.join(o, "Newtonsoft.Json.dll"), "wb").write(b)Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 03:14Z: #2453, #2458 and #2461, each No lead was marked It is false for Maven and NuGet. One issue, #2472, with two parts and three failing tests. Four neighbouring cells ran clean. PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL153, confirmed, filed #2472 ( Files only (the binary of d987721, a stand-in patch API that knows no patch,
Afterwards With the real tools:
Two CLI tests, twins of L154, confirmed, in #2472: after
The note's "next package-manager install" does not come for a local repository (the Both parts are one issue because they are the two call sites of one helper ( Clean, files only:
No issue closed. No lead is marked Areas examined
Lessons
#!/usr/bin/env python3
"""mkcache.py <go|nuget|cargo> <w> [bumped]: a project whose one dependency lives in a machine-wide cache,
with an agent-mode patch record for it and the cache copy patched. With `bumped`, the project has moved to
the next version (the old, patched copy stays in the cache, as the real tool leaves it).
Run: env -i PATH HOME=<w>/home GOMODCACHE=<w>/gomodcache NUGET_PACKAGES=<w>/pkgs CARGO_HOME=<w>/cargo ... in <w>/proj."""
import hashlib, json, os, shutil, sys
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
eco, w = sys.argv[1], os.path.abspath(sys.argv[2]); bumped = len(sys.argv) > 3
shutil.rmtree(w, ignore_errors=True)
proj = os.path.join(w, "proj"); os.makedirs(os.path.join(proj, ".git")); os.makedirs(os.path.join(w, "home"))
open(os.path.join(proj, ".git", "HEAD"), "w").write("ref: refs/heads/main\n")
os.makedirs(os.path.join(proj, ".socket", "blobs"))
orig, patched = b"package errors // the vulnerable code\n", b"package errors // the patched code!!!\n"
def wr(p, b):
os.makedirs(os.path.dirname(p), exist_ok=True); open(p, "wb").write(b)
if eco == "go":
old, new = "v0.9.1", "v0.9.2"; mod = "github.com/pkg/errors"; purl = f"pkg:golang/{mod}@{old}"; key = "errors.go"
cache = os.path.join(w, "gomodcache")
for v, b in ((old, patched), (new, orig)):
wr(os.path.join(cache, f"{mod}@{v}", "errors.go"), b)
wr(os.path.join(cache, f"{mod}@{v}", "go.mod"), f"module {mod}\n".encode())
v = new if bumped else old
wr(os.path.join(proj, "go.mod"), f"module example.com/app\n\ngo 1.21\n\nrequire {mod} {v}\n".encode())
wr(os.path.join(proj, "go.sum"), f"{mod} {v} h1:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n{mod} {v}/go.mod h1:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=\n".encode())
wr(os.path.join(proj, "main.go"), b"package main\n")
copy = os.path.join(cache, f"{mod}@{old}", "errors.go")
elif eco == "nuget":
old, new = "13.0.3", "13.0.4"; purl = f"pkg:nuget/Newtonsoft.Json@{old}"; key = "package/lib/net6.0/Newtonsoft.Json.dll"
pk = os.path.join(w, "pkgs")
for v, b in ((old, patched), (new, orig)):
d = os.path.join(pk, "newtonsoft.json", v)
wr(os.path.join(d, "lib", "net6.0", "Newtonsoft.Json.dll"), b)
wr(os.path.join(d, "newtonsoft.json.nuspec"), b"<package/>")
wr(os.path.join(d, ".nupkg.metadata"), b'{"contentHash":"deadbeef"}')
v = new if bumped else old
wr(os.path.join(proj, "app.csproj"), b'<Project Sdk="Microsoft.NET.Sdk" />')
wr(os.path.join(proj, "obj", "project.assets.json"), json.dumps({"version": 3, "targets": {}, "libraries": {f"Newtonsoft.Json/{v}": {"type": "package", "path": f"newtonsoft.json/{v}"}}, "packageFolders": {pk: {}}}, indent=2).encode())
copy = os.path.join(pk, "newtonsoft.json", old, "lib", "net6.0", "Newtonsoft.Json.dll")
elif eco == "cargo":
old, new = "1.0.11", "1.0.12"; purl = f"pkg:cargo/itoa@{old}"; key = "src/lib.rs"
src = os.path.join(w, "cargo", "registry", "src", "index.crates.io-6f17d22bba15001f")
for v, b in ((old, patched), (new, orig)):
d = os.path.join(src, f"itoa-{v}")
wr(os.path.join(d, "src", "lib.rs"), b)
wr(os.path.join(d, "Cargo.toml"), f'[package]\nname = "itoa"\nversion = "{v}"\n'.encode())
wr(os.path.join(d, ".cargo-ok"), b'{"v":1}')
v = new if bumped else old
wr(os.path.join(proj, "Cargo.toml"), f'[package]\nname = "app"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nitoa = "{v}"\n'.encode())
wr(os.path.join(proj, "Cargo.lock"), f'# This file is automatically @generated by Cargo.\nversion = 3\n\n[[package]]\nname = "app"\nversion = "0.1.0"\ndependencies = [\n "itoa",\n]\n\n[[package]]\nname = "itoa"\nversion = "{v}"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\nchecksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"\n'.encode())
wr(os.path.join(proj, "src", "main.rs"), b"fn main() {}\n")
copy = os.path.join(src, f"itoa-{old}", "src", "lib.rs")
elif eco == "maven":
old, new = "1.0", "1.1"; purl = f"pkg:maven/com.example/victim@{old}"; key = f"package/victim-{old}.jar"
m2 = os.path.join(w, "m2")
for v, b in ((old, patched), (new, orig)):
d = os.path.join(m2, "com", "example", "victim", v)
wr(os.path.join(d, f"victim-{v}.jar"), b)
wr(os.path.join(d, f"victim-{v}.pom"), f"<project><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>victim</artifactId><version>{v}</version></project>".encode())
v = new if bumped else old
wr(os.path.join(proj, "pom.xml"), f"<project><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>app</artifactId><version>1.0</version><dependencies>\n <dependency><groupId>com.example</groupId><artifactId>victim</artifactId><version>{v}</version></dependency>\n</dependencies></project>\n".encode())
copy = os.path.join(m2, "com", "example", "victim", old, f"victim-{old}.jar")
for b in (orig, patched): open(os.path.join(proj, ".socket", "blobs", gh(b)), "wb").write(b)
m = {"patches": {purl: {"uuid": "20000008-0000-4008-8008-000000000008", "exportedAt": "2026-01-01T00:00:00Z",
"files": {key: {"beforeHash": gh(orig), "afterHash": gh(patched)}},
"vulnerabilities": {"GHSA-aaaa-bbbb-cccc": {"cves": ["CVE-2026-0001"], "summary": "s", "severity": "high", "description": "d"}},
"description": "fix", "license": "MIT", "tier": "free"}}}
json.dump(m, open(os.path.join(proj, ".socket", "manifest.json"), "w"), indent=2)
json.dump({}, open(os.path.join(w, "catalog.json"), "w"))
print(copy)Run it with Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 05:23Z: #2453, #2458 and #2461, each No lead was marked Two of those rewriters do not apply the rule to a local path. Filed as #2474, with four real projects and two failing tests. A neighbouring question that the contract does not settle is #2475 ( PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL155, confirmed, filed #2474 ( The binary of d987721, the bench's stand-in patch service, and locks written by uv 0.11.32 and Composer 2.8.12. The local package in each project has the name and version of a package the service patches:
The same entry given to each rewriter (the patched package's entry of a bench fixture, changed to the shape its tool writes for a local file or directory):
Two probe tests fail on L156, filed #2475 ( Hand-made Composer locks, in #2474 as "not in this issue": an entry from another GitHub repository at another commit, an Clean:
No issue closed. No lead is marked Areas examined
Lessons
hxrun.py: run the binary in a bench fixture's environment
#!/usr/bin/env python3
"""hxrun.py <pm-dir> <args...>: run socket-patch with the env the bench printed for <pm-dir>/serve.out, in its project."""
import os, re, shlex, subprocess, sys
d = sys.argv[1]
txt = open(os.path.join(d, "serve.out")).read()
line = re.search(r"^env -i .*$", txt, re.M).group(0)
toks = shlex.split(line)[2:]
env = {}; i = 0
while "=" in toks[i] and not toks[i].startswith("/"):
k, v = toks[i].split("=", 1); env[k] = v; i += 1
P = os.environ.get("HX_CWD") or toks[toks.index("--cwd") + 1]
if sys.argv[2] == "--print":
print(P); print(" ".join(toks[i:])); sys.exit(0)
r = subprocess.run([toks[i]] + sys.argv[2:] + ["--cwd", P], env=env, cwd=P, stdin=subprocess.DEVNULL)
sys.exit(r.returncode)The entry shapes, for the package the baseline scan rewrites:
Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 07:15Z: #2453, #2458 and #2461, each No lead was marked One cell fails: vendored mode replaces a Composer PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL157, confirmed, on #2474 (a comment):
A symlinked The vendored writer finds the lock entry by name and version and asks only whether it is already wired to this patch's copy ( Both writers read the entry through one model ( Clean: every other writer, with locks the real tools wrote. A local
Controls: a uv project locked from PyPI is vendored by the same stand-in, and a vendored Composer project without a Seen and not filed, each a true refusal with an imprecise sentence:
The prune's keeps, read and not mutated. The last three entries left "the keeps under mutation" unrun. Each keep has a test that reads the manifest after the wet run: No issue closed or filed. No lead is marked Areas examined
Lessons
The fixtures
#!/usr/bin/env python3
"""A papi.py catalog entry and dist zip for a vendored Composer run (appended to cat.json)."""
import base64, hashlib, io, json, uuid, zipfile
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
purl = "pkg:composer/acme/zoka@1.2.3"
before = b'<?php namespace Acme\\Zoka; class Client { const WHO = "PUBLIC RELEASE"; }\n'
after = b'<?php namespace Acme\\Zoka; class Client { const WHO = "PUBLIC RELEASE, SOCKET PATCHED"; }\n'
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as z:
z.writestr("acme-zoka-0123abc/composer.json", b'{"name": "acme/zoka", "version": "1.2.3"}\n')
z.writestr("acme-zoka-0123abc/src/Client.php", after)
body = buf.getvalue(); open("art/zoka-1.2.3.zip", "wb").write(body)
u = str(uuid.uuid5(uuid.NAMESPACE_URL, "patch:" + purl)); tok = str(uuid.uuid5(uuid.NAMESPACE_URL, "grant:" + purl))
entry = {"purl": purl, "uuid": u, "file": "package/src/Client.php",
"files": {"package/src/Client.php": {"beforeHash": gh(before), "afterHash": gh(after)}},
"artifact": {"path": f"/patch/composer/acme/zoka/1.2.3/{tok}/{u}/zoka-1.2.3.zip", "local": "art/zoka-1.2.3.zip",
"integrity": {"sha512": "sha512-" + base64.b64encode(hashlib.sha512(body).digest()).decode(),
"sha1": hashlib.sha1(body).hexdigest()}}}
cat = json.load(open("cat.json")); cat["patches"].append(entry); json.dump(cat, open("cat.json", "w"), indent=1)The Composer project: The JS projects: The Python projects: the wheel is a zip of The Go project: Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 09:17Z: #2453, #2458 and #2461, each No lead was marked One defect on PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL158, confirmed, filed #2477 ( With real git 2.43.0 and npm 10.9.9, the binary of d987721 and a stand-in patch API:
The same cell for each lock, files only (an npm monorepo with six applied records, plus one package the lock lists that is not installed):
A test beside The planned fix is one rule in the prune (a lock that is there and was not read exempts the entries of the ecosystem it locks, in both scopes, wet and in the preview), and a diagnosis from the five readers that return "no lock" for a file they cannot parse. The contract's fail-safe for an ecosystem the run never looked for ("absence is not evidence of removal") settles the behaviour; the issue asks one thing, whether the kept entries ride the lock's warning or get a code. How bad: a later The prune's keeps under mutation: guarded, but for the global keep's preview. Six mutants behind one switch, each skipping one keep at its call site (
Seen and not filed: the preview discards the keeps' warnings ( No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The conflict, for any lock: wrap one line in #!/usr/bin/env python3
"""mklock.py <kind>: replace the root package-lock.json of the cwd project with a yarn / pnpm / bun lock of the same four packages."""
import json, os, sys, base64, hashlib
kind = sys.argv[1]
deps = json.load(open("package.json"))["dependencies"]
def integ(n, v): return "sha512-" + base64.b64encode(hashlib.sha512((n+v).encode()).digest()).decode()
def tgz(n, v): return f"https://registry.npmjs.org/{n}/-/{n.split('/')[-1]}-{v}.tgz"
os.remove("package-lock.json")
if kind == "yarn":
out = "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n# yarn lockfile v1\n\n\n"
for n, v in sorted(deps.items()):
key = f'"{n}@{v}"' if n.startswith("@") else f"{n}@{v}"
out += f'{key}:\n version "{v}"\n resolved "{tgz(n, v)}#{hashlib.sha1((n+v).encode()).hexdigest()}"\n integrity {integ(n, v)}\n\n'
open("yarn.lock", "w").write(out)
elif kind == "pnpm":
out = "lockfileVersion: '9.0'\n\nsettings:\n autoInstallPeers: true\n excludeLinksFromLockfile: false\n\nimporters:\n\n .:\n dependencies:\n"
for n, v in sorted(deps.items()):
k = f"'{n}'" if n.startswith("@") else n
out += f" {k}:\n specifier: {v}\n version: {v}\n"
out += "\npackages:\n\n"
for n, v in sorted(deps.items()):
k = f"'{n}@{v}'" if n.startswith("@") else f"{n}@{v}"
out += f" {k}:\n resolution: {{integrity: {integ(n, v)}}}\n\n"
out += "snapshots:\n\n"
for n, v in sorted(deps.items()):
k = f"'{n}@{v}'" if n.startswith("@") else f"{n}@{v}"
out += f" {k}: {{}}\n\n"
open("pnpm-lock.yaml", "w").write(out)
elif kind.startswith("bun"):
ver = int(kind[3:] or 1)
out = '{\n "lockfileVersion": %d,\n "workspaces": {\n "": {\n "name": "p-root",\n "dependencies": {\n' % ver
for n, v in sorted(deps.items()):
out += f' "{n}": "{v}",\n'
out += ' },\n },\n },\n "packages": {\n'
for n, v in sorted(deps.items()):
out += f' "{n}": ["{n}@{v}", "", {{}}, "{integ(n, v)}"],\n\n'
out = out.rstrip("\n") + "\n }\n}\n"
open("bun.lock", "w").write(out)#!/usr/bin/env python3
"""addeco.py <composer|cargo|uv|poetry|go>: give the cwd project that ecosystem's manifest and lock for one package
that is NOT installed, and a manifest record for it."""
import json, hashlib, sys
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
eco = sys.argv[1]
if eco == "composer":
purl, f = "pkg:composer/monolog/monolog@2.9.1", "src/Monolog/Logger.php"
open("composer.json","w").write('{\n "name": "acme/app",\n "require": {\n "monolog/monolog": "2.9.1"\n }\n}\n')
lock = {"_readme": ["This file locks the dependencies of your project to a known state"], "content-hash": "0123456789abcdef0123456789abcdef",
"packages": [{"name": "monolog/monolog", "version": "2.9.1",
"source": {"type": "git", "url": "https://github.com/Seldaek/monolog.git", "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1"},
"dist": {"type": "zip", "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", "shasum": ""},
"type": "library"}],
"packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": False, "prefer-lowest": False, "platform": [], "platform-dev": [], "plugin-api-version": "2.6.0"}
open("composer.lock","w").write(json.dumps(lock, indent=4) + "\n")
elif eco == "cargo":
purl, f = "pkg:cargo/itoa@1.0.11", "src/lib.rs"
open("Cargo.toml","w").write('[package]\nname = "app"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nitoa = "=1.0.11"\n')
open("Cargo.lock","w").write('# This file is automatically @generated by Cargo.\n# It is not intended for manual editing.\nversion = 3\n\n[[package]]\nname = "app"\nversion = "0.1.0"\ndependencies = [\n "itoa",\n]\n\n[[package]]\nname = "itoa"\nversion = "1.0.11"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\nchecksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"\n')
import os; os.makedirs("src", exist_ok=True); open("src/main.rs","w").write("fn main() {}\n")
elif eco == "uv":
purl, f = "pkg:pypi/six@1.16.0", "six.py"
open("pyproject.toml","w").write('[project]\nname = "app"\nversion = "0.1.0"\nrequires-python = ">=3.9"\ndependencies = ["six==1.16.0"]\n')
open("uv.lock","w").write('version = 1\nrevision = 1\nrequires-python = ">=3.9"\n\n[[package]]\nname = "app"\nversion = "0.1.0"\nsource = { virtual = "." }\ndependencies = [\n { name = "six" },\n]\n\n[package.metadata]\nrequires-dist = [{ name = "six", specifier = "==1.16.0" }]\n\n[[package]]\nname = "six"\nversion = "1.16.0"\nsource = { registry = "https://pypi.org/simple" }\nsdist = { url = "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", size = 34041 }\nwheels = [\n { url = "https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254", size = 11053 },\n]\n')
elif eco == "poetry":
purl, f = "pkg:pypi/six@1.16.0", "six.py"
open("pyproject.toml","w").write('[tool.poetry]\nname = "app"\nversion = "0.1.0"\ndescription = ""\nauthors = []\n\n[tool.poetry.dependencies]\npython = "^3.9"\nsix = "1.16.0"\n\n[build-system]\nrequires = ["poetry-core"]\nbuild-backend = "poetry.core.masonry.api"\n')
open("poetry.lock","w").write('# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.\n\n[[package]]\nname = "six"\nversion = "1.16.0"\ndescription = "Python 2 and 3 compatibility utilities"\noptional = false\npython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"\nfiles = [\n {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},\n {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},\n]\n\n[metadata]\nlock-version = "2.0"\npython-versions = "^3.9"\ncontent-hash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"\n')
elif eco == "go":
purl, f = "pkg:golang/github.com/pkg/errors@v0.9.1", "errors.go"
open("go.mod","w").write("module example.com/app\n\ngo 1.21\n\nrequire github.com/pkg/errors v0.9.1\n")
open("go.sum","w").write("github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=\ngithub.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\n")
open("main.go","w").write("package main\n\nimport _ \"github.com/pkg/errors\"\n\nfunc main() {}\n")
b, a = b"before " + eco.encode() + b"\n", b"after " + eco.encode() + b"\n"
for x in (b, a): open(".socket/blobs/" + gh(x), "wb").write(x)
m = json.load(open(".socket/manifest.json"))
m["patches"][purl] = {"uuid": "99999999-0000-4000-8000-0000000000%02d" % (len(m["patches"])), "exportedAt": "2026-01-01T00:00:00Z", "files": {f: {"beforeHash": gh(b), "afterHash": gh(a)}},
"vulnerabilities": {"GHSA-cccc-cccc-0001": {"cves": [], "summary": "s", "severity": "high", "description": "d"}}, "description": "d", "license": "MIT", "tier": "free"}
json.dump(m, open(".socket/manifest.json", "w"), indent=2)#!/usr/bin/env python3
"""mkcatalog.py <project> <catalog.json> name@version:file ...: a catalog for api.py from the installed files."""
import base64, hashlib, json, os, sys
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
proj, out = sys.argv[1], sys.argv[2]; cat = {}
for i, spec in enumerate(sys.argv[3:]):
nv, f = spec.split(":"); n, v = nv.rsplit("@", 1)
before = open(os.path.join(proj, "node_modules", n, f), "rb").read()
after = before + b"\n// patched by the stand-in patch service\n"
purl = f"pkg:npm/{n}@{v}"
cat[purl] = [{"uuid": f"bbbbbbbb-0000-4000-8000-00000000000{i+1}", "purl": purl, "tier": "free", "severity": "high",
"ghsa": f"GHSA-bbbb-bbbb-000{i+1}", "cve": f"CVE-2026-100{i+1}", "publishedAt": "2026-01-01T00:00:00Z",
"files": {"package/" + f: {"before": base64.b64encode(before).decode(), "after": base64.b64encode(after).decode(),
"beforeHash": gh(before), "afterHash": gh(after)}}}]
json.dump(cat, open(out, "w"), indent=1)The real merge ( git init -q -b main . && printf 'node_modules\n' > .gitignore
# package.json: "dependencies": {"is-number": "7.0.0", "ms": "^2.1.0"}
npm install && npm install ms@2.1.1 && sed -i 's/"ms": "^2.1.1"/"ms": "^2.1.0"/' package.json && npm install
sp scan --mode agent --yes && git add -A && git commit -q -m base
git checkout -q -b add-left-pad && npm install left-pad@1.3.0 && npm update ms
sp scan --mode agent --yes && git add -A && git commit -q -m "Add left-pad with its patch; update ms"
git checkout -q main && git checkout -q -b feature
npm install ms@2.1.2 && git checkout -q package.json && npm install && git add -A && git commit -q -m "Update ms"
git merge add-left-pad # CONFLICT (content): Merge conflict in package-lock.json
sp scan --sync --yes # prunes pkg:npm/left-pad@1.3.0The mutants: one helper in Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 11:16Z: #2453, #2458 and #2461, each No lead was marked One finding, filed as #2480 ( PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL159, filed #2480 ( The binary of d987721 and a stand-in patch API; machine A has
The same record on the same machine is kept when Maven is the project's only ecosystem and dropped when the project also has an installed npm half. The second ecosystem's files, with the npm half installed in each row and a record for a package they declare that is not installed:
A probe test beside Why a question: the contract says the prune "removes manifest entries for packages no longer present in the crawl" and is off by default "so a temporary uninstall doesn't silently destroy manifest state"; docs/usage.md says it is to "remove records for dependencies that left the project". The issue gives three options: leave it and say so in the docs; skip an ecosystem the crawl found nothing of, as the empty crawl is skipped (one rule, beside the one planned in #2477); or keep what the project's files still declare (exact for direct dependencies, one reader per ecosystem). The rows are files only; no build tool ran. L160, true, out of charter (rare): with no lock, an installed npm package whose
It needs a project with the lock off and a half-written install, which the package manager's next install replaces. Not filed. Clean: a hosted or vendored Clean: a mode switch from agent to hosted over a manifest that holds records of both scopes. The bench's hosted npm fixture, with three hand-made agent-mode records applied in place: the package the hosted scan switches, another project package, and
A hosted scan writes nothing under Seen and not filed: a project No issue closed. No lead is marked Areas examined
Lessons
The fixtures
#!/usr/bin/env python3
"""addrec.py <project> <purl> <file>: add a manifest record (and its two blobs) for a package of another ecosystem."""
import json, hashlib, sys, os
proj, purl, f = sys.argv[1:4]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
b, a = b"before " + purl.encode() + b"\n", b"after " + purl.encode() + b"\n"
for x in (b, a): open(os.path.join(proj, ".socket/blobs", gh(x)), "wb").write(x)
mp = os.path.join(proj, ".socket/manifest.json")
m = json.load(open(mp))
m["patches"][purl] = {"uuid": "99999999-0000-4000-8000-0000000000%02d" % (len(m["patches"])), "exportedAt": "2026-01-01T00:00:00Z",
"files": {f: {"beforeHash": gh(b), "afterHash": gh(a)}},
"vulnerabilities": {"GHSA-cccc-cccc-0001": {"cves": [], "summary": "s", "severity": "high", "description": "d"}},
"description": "d", "license": "MIT", "tier": "free"}
json.dump(m, open(mp, "w"), indent=2)One cell: copy the applied repository, The two machines: one project, The switch: Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 15:24Z: #2453, #2458 and #2461, each No lead was marked 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 PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL161, confirmed, on #2477 (a comment): 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
The other locks, each beside an npm project with two applied records and one record for a package the lock lists and nothing installs:
L162, true, out of charter (the contract allows):
The contract says the model "is not uniform today": npm-family copies below 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
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). Seen and not filed:
Read and already handled, while choosing:
No issue closed or filed. No lead is marked Areas examined
Lessons
The fixtures
The base project, by hand: The locks by hand: A conflict: one line of the lock wrapped in The wheels: the project's own is a zip of The nested project: Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 17:19Z: #2453, #2458 and #2461, each No lead was marked Two findings, both in the remedies, filed as #2486 and #2487. The other three areas are clean. PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL163, confirmed, filed #2486:
L166, confirmed, filed #2487: most printed remedies drop the
The plan on the issue is one helper for every printed command and a source test that fails on a literal one. It leaves one question open: what a hosted or vendored run over several PATH directories should print. L164, true, out of charter: two flag twins are not in the child-environment scrub list. L165, true, out of charter: Seen and not filed:
Read and already handled, while choosing:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The pseudo-terminal: Python's A shim, linked under each tool's name in a directory first on #!/bin/sh
name=$(basename "$0")
{ printf 'TOOL %s ARGS %s\n' "$name" "$*"; env | grep -E '^SOCKET_|sktsec_' | sed 's/^/ ENV /'; } >> "$SHIM_LOG"
real=$(PATH="$REAL_PATH" command -v "$name" 2>/dev/null)
[ -n "$real" ] && PATH="$REAL_PATH" exec "$real" "$@"
exit 127The run's environment: The npm generator: versions Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 19:13Z: #2453, #2458 and #2461, each No lead was marked One finding, filed as #2489: a vendored scan breaks the usual Dockerfile dependency layer for npm, pnpm, Bun, pip, uv and Go, and the run says so for gems only. One correction to this routine's own #2487, and one more row on #2486. PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL168, confirmed, filed #2489 ( The binary of d987721, a stand-in patch service, a lock written by each real tool, and the Dockerfile in the project root. Every scan exits 0 and prints the two usual next steps. The layer is the files its
With the named files copied, each install passes and the installed file is the patched one. A probe test beside L169, a correction, on #2487 (a comment): the L163, one more row, on #2486 (a comment): PyPI is as npm. L167, rejected: the hand-made git walk in L170, true, out of charter (narrow): the search for projects below Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The Go project: The agent-mode project of L169 and L170 is Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 21:23Z: #2453, #2458 and #2461, each No lead was marked One finding, filed as #2490: after a hosted or vendored NuGet scan, the usual .NET Dockerfile builds the image with the unpatched package, and nothing says so. One more row on #2489 (hosted pnpm), and one on #2490 (sbt, by reading). PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL171, confirmed, filed #2490 ( The real SDK 8.0.428 in
Without The code states the rule for the scan's own machine (the warning of #352, core L172, confirmed, on #2489 (a comment): a hosted pnpm scan on the registry route creates
Nothing is installed in a failing cell, so this is #2489's class (the build breaks), beside its L173, on #2490 (a comment; read, and the suite's own test): sbt's wiring is a root file no user file refers to. Hosted mode writes Read and rejected while choosing: Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixturesThe .NET fixture, the base image, both Dockerfiles and the probe test are in #2490. The routed pnpm grant is the catalog entry of {"reference": {"status": "granted", "purl": "pkg:npm/left-pad@1.3.0", "url": "@BASE@<dir>/left-pad-1.3.0.tgz",
"artifacts": [{"kind": "tarball", "url": "@BASE@<dir>/left-pad-1.3.0.tgz", "integrity": {"sha512": "sha512-<base64>"}}],
"registryOverride": null, "npmRegistryUrl": "@BASE@<dir>/"},
"files": {"<dir>/left-pad": "<a file: {name, dist-tags, versions: {1.3.0: {name, version, dist: {tarball, integrity}}}}>"}}The project is Needs a person
|
|
[agent] 2026-12-03: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 23:21Z: #2453, #2458 and #2461, each No lead was marked One finding, filed as #2494: for a hosted or vendored Maven package, a NuGet package and a PyPI package with a dot in its name, it is not, and the OpenVEX matching library finds no statement for the spelling in the files. No scanner ran (see below), so the last step of the claim is not run. PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL174, confirmed on socket-patch's side, filed #2494 ( The binary of d987721, the bench's stand-in patch service, and the fixture of
"Asked" is L175, on #2494 (a comment): the document writes a NuGet id in lower case. The bench's hosted NuGet project: L176, on #2494 (a comment): a PyPI name with a dot. The patch key is the PEP 503 name ( The other ecosystems, with the same matcher over a document written by hand: Go and Composer names match in any case; npm, Maven, Cargo and gem names match only as written, and by reading the document writes those as the project's files do. A hosted Go module is replaced by a module of another path, which has no advisory. L177, rejected: an installed npm package whose Read and left while choosing:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
The npm states: The PyPI venv ( The matcher's name rules: a document written by hand with the products Needs a person
|
|
[agent] 2026-12-04: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 01:35Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL178, confirmed, filed #2496 (
Two predicates answer "is this a Plug'n'Play project?". The read-only probe refuses when a loader file exists (core The rewritten project works: The issue gives the two ways out: refuse always (the hosted writer takes #539's predicate), or support hosted mode on Plug'n'Play. It says the second is where the runs point, and that one package on one Yarn release is thin, so the first is the safe choice until more cells run. L179, confirmed, filed #2498 (
The contract states the 5.1.0 outcome as a hazard of "a release that predates Rejected: an output mode changes what a command does. 13,104 runs: the 42 rows of the command list (36 distinct commands), each plain, with Rejected: the berry checksum port disagrees with Yarn. 74 direct dependencies picked for old and odd tarballs, 835 locked packages, installed by Yarn 4.12.0, each registry tarball run through Rejected: Yarn's pnpm linker ( Read and left: No issue closed. No lead is marked Areas examined
Lessons
The fixtures
import json, tarfile, hashlib, urllib.request
c = json.load(open("cat.json")); p = c["patches"][0]; a = p["artifact"]
# 1. the grant names the checksum Yarn computes for the patched tarball: a scratch project with
# "left-pad": "<BASE><a['path']>" and nodeLinker: node-modules, `yarn install`, then yarn.lock's checksum
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": "10c0/<hex from that lock>"}}]}
# 2. the undo asks for the upstream release's checksum (the project's lock before the scan has it)
doc = json.load(urllib.request.urlopen("https://registry.npmjs.org/left-pad/1.3.0"))
json.dump({"name": "left-pad", "version": "1.3.0", "integrity": doc["dist"]["integrity"],
"yarnBerry10c0": "10c0/<hex from the original lock>"}, open("art/upstream.json", "w"))
c["files"] = {f"/upstream/npm/{p['uuid']}.json": "art/upstream.json"}
# 3. agent mode downloads blobs by hash
after = tarfile.open(a["local"]).extractfile("package/index.js").read()
before = after[:-len(b"\n// SOCKET_PATCHED\n")]
for name, b in (("after", after), ("before", before)):
h = hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest(); open(f"art/{name}.blob", "wb").write(b)
c["files"][f"/v0/orgs/bench-org/patches/blob/{h}"] = f"art/{name}.blob"
json.dump(c, open("cat.json", "w"), indent=1)The projects:
for st in states:
for cmd in COMMANDS:
res = {}
for form, extra in (("plain", []), ("json", ["--json"]), ("silent", ["--silent"]), ("json+silent", ["--json", "--silent"])):
restore(st); res[form] = run(base(cmd) + extra) # (exit, stdout, stderr)
# flagged: exit codes differ by form; --json stdout is not one JSON document, or its status
# disagrees with the exit code; --silent prints on exit 0, prints nothing on a failure, or
# prints to stdout on a failure; json+silent has stderr on exit 0; an ANSI escape anywhereThe checksum probe, in the tests of core #[test] #[ignore]
fn zz_probe_dir() {
let dir = std::env::var("ZZ_TGZ_DIR").unwrap();
for line in std::fs::read_to_string(format!("{dir}/list.tsv")).unwrap().lines() {
let (ident, file) = line.split_once('\t').unwrap();
let bytes = std::fs::read(format!("{dir}/{file}")).unwrap();
println!("ZZ\t{ident}\t{file}\t{:?}", berry_cache_checksum_10c0(&bytes, ident));
}
}Needs a person
|
|
[agent] 2026-12-04: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 03:40Z: #2453, #2458 and #2461, each No lead was marked A preload shim fails the k-th file operation of a command, for every k: once with PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL180, confirmed, on #2383 (a comment): a file socket-patch did not write, left in the Maven tree, survives a successful undo, and
It was first seen as an empty directory: a L181, rejected: a failed write, sync, rename, link, unlink or mkdir makes a command lie. Every operation of each command failed in turn, once (
On a full disk, a hosted run that has replaced one of two files cannot write the old one back. It says so and names the file: "Cargo.lock is left with its new content (No space left on device); every other file is unchanged" (Bundler, Cargo, Go, NuGet, pnpm, uv, Yarn berry: three operations each). A hosted Maven L182, rejected: a failed read is taken for "not there" and the outcome is wrong. Each open of an existing file, each L183, true, out of charter (narrow): four small things the matrices showed.
Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixtures
// LD_PRELOAD shim: makes a file operation of the process FAIL (return -1, errno set) instead of
// stopping the process. It counts the file operations under FAULT_SCOPE (a path prefix):
// openw an open that can write (O_WRONLY/O_RDWR/O_CREAT/O_TRUNC)
// write write/pwrite/writev/copy_file_range/sendfile/ftruncate/fallocate on such a file (space)
// sync fsync/fdatasync on such a file, or on a directory under the scope (space)
// rename, unlink (unlink, rmdir), mkdir (space), link (link, symlink), chmod
// with FAULT_READS=1 also: openr (an open that only reads an EXISTING file), opendir, read
// FAULT_AT=k the k-th counted operation fails with FAULT_ERRNO (default 5, EIO)
// FAULT_MODE=sticky a full disk: from the k-th SPACE operation on, every space operation fails
// with ENOSPC; everything else succeeds (k counts those only)
// FAULT_MODE=always every counted operation fails (with FAULT_MATCH: one file unreadable all run)
// FAULT_KINDS comma list of the kinds that count (default: all)
// FAULT_MATCH count only operations whose "<kind> <path>" contains this; "...$" = ends with
// FAULT_LOG one line per counted operation: "<n> <kind> <path> [FAIL]"
// No FAULT_AT: nothing fails, the log is the list of operations.
#define _GNU_SOURCE
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#define MAXFD 65536
static int inited = 0, logfd = -1, sticky = 0, always = 0, failing = 0, fault_errno = EIO;
static long fault_at = -1, counter = 0;
static char scope[PATH_MAX], kinds[256], match[512];
static char fdpath[MAXFD][160];
static unsigned char tracked[MAXFD];
static unsigned char rtracked[MAXFD];
static int reads = -1;
static pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
static int reads_on(void) { if (reads < 0) reads = getenv("FAULT_READS") != NULL; return reads; } // FAULT_READS=1: count read-side operations too
#define REAL(name) ({ static __typeof__(&name) p; if (!p) p = (__typeof__(&name))dlsym(RTLD_NEXT, #name); p; })
static void init(void) {
if (inited) return;
inited = 1;
const char *s = getenv("FAULT_SCOPE");
if (s) strncpy(scope, s, sizeof scope - 1);
const char *a = getenv("FAULT_AT");
if (a) fault_at = atol(a);
const char *e = getenv("FAULT_ERRNO");
if (e) fault_errno = atoi(e);
const char *m = getenv("FAULT_MODE");
if (m && !strcmp(m, "sticky")) { sticky = 1; fault_errno = ENOSPC; }
if (m && !strcmp(m, "always")) always = 1; // every counted (matching) operation fails
const char *k = getenv("FAULT_KINDS");
if (k) snprintf(kinds, sizeof kinds, ",%s,", k);
const char *mt = getenv("FAULT_MATCH"); // count only the operations whose kind+path contain this
if (mt) strncpy(match, mt, sizeof match - 1);
const char *l = getenv("FAULT_LOG");
if (l) logfd = REAL(open)(l, O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0644);
}
static int in_scope(int dirfd, const char *path, char *out, size_t n) {
init();
if (!scope[0] || !path) return 0;
char buf[PATH_MAX];
if (path[0] == '/') snprintf(buf, sizeof buf, "%s", path);
else if (dirfd == AT_FDCWD) {
char cwd[PATH_MAX];
if (!getcwd(cwd, sizeof cwd)) return 0;
snprintf(buf, sizeof buf, "%s/%s", cwd, path);
} else {
char link[64], dir[PATH_MAX];
snprintf(link, sizeof link, "/proc/self/fd/%d", dirfd);
ssize_t r = readlink(link, dir, sizeof dir - 1);
if (r <= 0) return 0;
dir[r] = 0;
snprintf(buf, sizeof buf, "%s/%s", dir, path);
}
if (strncmp(buf, scope, strlen(scope))) return 0;
if (out) snprintf(out, n, "%s", buf + strlen(scope));
return 1;
}
// Returns 1 when this operation must fail (errno is set).
static int hit(const char *kind, int space, const char *what) {
init();
if (kinds[0]) { char pat[32]; snprintf(pat, sizeof pat, ",%s,", kind); if (!strstr(kinds, pat)) return 0; }
if (match[0]) { char kw[PATH_MAX + 32]; snprintf(kw, sizeof kw, "%s %s", kind, what); size_t ml = strlen(match), kl = strlen(kw);
if (ml && match[ml - 1] == '$') { if (kl < ml - 1 || strncmp(kw + kl - (ml - 1), match, ml - 1)) return 0; } // "...$": the operation ends with this
else if (!strstr(kw, match)) return 0; }
pthread_mutex_lock(&mu);
int fail = 0;
if (sticky) {
if (space) { counter++; if (fault_at > 0 && counter >= fault_at) fail = 1; }
} else {
counter++;
if (always || (fault_at > 0 && counter == fault_at)) fail = 1;
}
long n = counter;
pthread_mutex_unlock(&mu);
if (logfd >= 0 && (!sticky || space)) {
char line[512];
int len = snprintf(line, sizeof line, "%ld %s %s%s\n", n, kind, what, fail ? " FAIL" : "");
REAL(write)(logfd, line, len);
}
if (fail) { failing = 1; errno = fault_errno; }
return fail;
}
static int writable(int flags) { return (flags & O_ACCMODE) != O_RDONLY || (flags & (O_CREAT | O_TRUNC)); }
static void track(int fd, const char *rel) {
if (fd >= 0 && fd < MAXFD) { tracked[fd] = 1; snprintf(fdpath[fd], sizeof fdpath[fd], "%s", rel); }
}
static const char *fdname(int fd) { return fd >= 0 && fd < MAXFD ? fdpath[fd] : "?"; }
static int is_tracked(int fd) { init(); return fd >= 0 && fd < MAXFD && tracked[fd]; }
#define OPEN_BODY(real_call, dirfd) \
char rel[PATH_MAX]; mode_t mode = 0; \
if (flags & (O_CREAT | O_TMPFILE)) { va_list ap; va_start(ap, flags); mode = va_arg(ap, mode_t); va_end(ap); } \
int inside = in_scope(dirfd, path, rel, sizeof rel); \
int scoped = writable(flags) && inside; \
if (scoped && hit("openw", 0, rel)) return -1; \
if (inside && !scoped && reads_on() && faccessat(dirfd, path, F_OK, 0) == 0 && hit((flags & O_DIRECTORY) ? "opendir" : "openr", 0, rel)) return -1; \
int fd = real_call; \
if (scoped) track(fd, rel); \
else if (inside && reads_on() && fd >= 0 && fd < MAXFD) { rtracked[fd] = 1; snprintf(fdpath[fd], sizeof fdpath[fd], "%s", rel); } \
return fd;
int open(const char *path, int flags, ...) { OPEN_BODY(REAL(open)(path, flags, mode), AT_FDCWD) }
int open64(const char *path, int flags, ...) { OPEN_BODY(REAL(open64)(path, flags, mode), AT_FDCWD) }
int openat(int dirfd, const char *path, int flags, ...) { OPEN_BODY(REAL(openat)(dirfd, path, flags, mode), dirfd) }
int openat64(int dirfd, const char *path, int flags, ...) { OPEN_BODY(REAL(openat64)(dirfd, path, flags, mode), dirfd) }
int creat(const char *path, mode_t mode) {
char rel[PATH_MAX]; int scoped = in_scope(AT_FDCWD, path, rel, sizeof rel);
if (scoped && hit("openw", 0, rel)) return -1;
int fd = REAL(creat)(path, mode); if (scoped) track(fd, rel); return fd;
}
int close(int fd) { if (fd >= 0 && fd < MAXFD) { tracked[fd] = 0; rtracked[fd] = 0; } return REAL(close)(fd); }
ssize_t read(int fd, void *b, size_t n) { if (fd >= 0 && fd < MAXFD && rtracked[fd] && hit("read", 0, fdname(fd))) return -1; return REAL(read)(fd, b, n); }
ssize_t pread64(int fd, void *b, size_t n, off64_t o) { if (fd >= 0 && fd < MAXFD && rtracked[fd] && hit("read", 0, fdname(fd))) return -1; return REAL(pread64)(fd, b, n, o); }
#include <dirent.h>
DIR *opendir(const char *p) { char rel[PATH_MAX]; if (reads_on() && in_scope(AT_FDCWD, p, rel, sizeof rel) && access(p, F_OK) == 0 && hit("opendir", 0, rel)) return NULL; return REAL(opendir)(p); }
ssize_t write(int fd, const void *b, size_t n) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(write)(fd, b, n); }
ssize_t pwrite(int fd, const void *b, size_t n, off_t o) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(pwrite)(fd, b, n, o); }
ssize_t pwrite64(int fd, const void *b, size_t n, off64_t o) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(pwrite64)(fd, b, n, o); }
ssize_t writev(int fd, const struct iovec *v, int c) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(writev)(fd, v, c); }
ssize_t copy_file_range(int in, off64_t *oi, int out, off64_t *oo, size_t n, unsigned f) { if (is_tracked(out) && hit("write", 1, fdname(out))) return -1; return REAL(copy_file_range)(in, oi, out, oo, n, f); }
ssize_t sendfile(int out, int in, off_t *o, size_t n) { if (is_tracked(out) && hit("write", 1, fdname(out))) return -1; ssize_t (*p)(int, int, off_t *, size_t) = dlsym(RTLD_NEXT, "sendfile"); return p(out, in, o, n); }
ssize_t sendfile64(int out, int in, off64_t *o, size_t n) { if (is_tracked(out) && hit("write", 1, fdname(out))) return -1; ssize_t (*p)(int, int, off64_t *, size_t) = dlsym(RTLD_NEXT, "sendfile64"); return p(out, in, o, n); }
int ftruncate(int fd, off_t l) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(ftruncate)(fd, l); }
int ftruncate64(int fd, off64_t l) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(ftruncate64)(fd, l); }
int fallocate(int fd, int m, off_t o, off_t l) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return -1; return REAL(fallocate)(fd, m, o, l); }
int posix_fallocate(int fd, off_t o, off_t l) { if (is_tracked(fd) && hit("write", 1, fdname(fd))) return ENOSPC; return REAL(posix_fallocate)(fd, o, l); }
static int sync_hit(int fd) {
if (is_tracked(fd)) return hit("sync", 1, fdname(fd));
char link[64], p[PATH_MAX], rel[PATH_MAX]; // a directory (or a file opened read-only) under the scope
snprintf(link, sizeof link, "/proc/self/fd/%d", fd);
ssize_t r = readlink(link, p, sizeof p - 1);
if (r <= 0) return 0;
p[r] = 0;
if (!in_scope(AT_FDCWD, p, rel, sizeof rel)) return 0;
char what[PATH_MAX + 8]; snprintf(what, sizeof what, "dir:%s", rel);
return hit("sync", 1, what);
}
int fsync(int fd) { if (sync_hit(fd)) return -1; return REAL(fsync)(fd); }
int fdatasync(int fd) { if (sync_hit(fd)) return -1; return REAL(fdatasync)(fd); }
int fchmod(int fd, mode_t m) { if (is_tracked(fd) && hit("chmod", 0, fdname(fd))) return -1; return REAL(fchmod)(fd, m); }
int rename(const char *a, const char *b) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, b, rel, sizeof rel) && hit("rename", 0, rel)) return -1; return REAL(rename)(a, b); }
int renameat(int da, const char *a, int db, const char *b) { char rel[PATH_MAX]; if (in_scope(db, b, rel, sizeof rel) && hit("rename", 0, rel)) return -1; return REAL(renameat)(da, a, db, b); }
int renameat2(int da, const char *a, int db, const char *b, unsigned f) { char rel[PATH_MAX]; if (in_scope(db, b, rel, sizeof rel) && hit("rename", 0, rel)) return -1; return REAL(renameat2)(da, a, db, b, f); }
int unlink(const char *p) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, p, rel, sizeof rel) && hit("unlink", 0, rel)) return -1; return REAL(unlink)(p); }
int unlinkat(int d, const char *p, int f) { char rel[PATH_MAX]; if (in_scope(d, p, rel, sizeof rel) && hit("unlink", 0, rel)) return -1; return REAL(unlinkat)(d, p, f); }
int rmdir(const char *p) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, p, rel, sizeof rel) && hit("unlink", 0, rel)) return -1; return REAL(rmdir)(p); }
int mkdir(const char *p, mode_t m) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, p, rel, sizeof rel)) { struct stat st; if (stat(p, &st) != 0 && hit("mkdir", 1, rel)) return -1; } return REAL(mkdir)(p, m); }
int mkdirat(int d, const char *p, mode_t m) { char rel[PATH_MAX]; if (in_scope(d, p, rel, sizeof rel) && hit("mkdir", 1, rel)) return -1; return REAL(mkdirat)(d, p, m); }
int link(const char *a, const char *b) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, b, rel, sizeof rel) && hit("link", 0, rel)) return -1; return REAL(link)(a, b); }
int linkat(int da, const char *a, int db, const char *b, int f) { char rel[PATH_MAX]; if (in_scope(db, b, rel, sizeof rel) && hit("link", 0, rel)) return -1; return REAL(linkat)(da, a, db, b, f); }
int symlink(const char *a, const char *b) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, b, rel, sizeof rel) && hit("link", 1, rel)) return -1; return REAL(symlink)(a, b); }
int symlinkat(const char *a, int d, const char *b) { char rel[PATH_MAX]; if (in_scope(d, b, rel, sizeof rel) && hit("link", 1, rel)) return -1; return REAL(symlinkat)(a, d, b); }
int chmod(const char *p, mode_t m) { char rel[PATH_MAX]; if (in_scope(AT_FDCWD, p, rel, sizeof rel) && hit("chmod", 0, rel)) return -1; return REAL(chmod)(p, m); }
int fchmodat(int d, const char *p, mode_t m, int f) { char rel[PATH_MAX]; if (in_scope(d, p, rel, sizeof rel) && hit("chmod", 0, rel)) return -1; return REAL(fchmodat)(d, p, m, f); }Agent mode. """mkproj.py <dir>: an agent-mode npm project, two packages of two files each, records made by hand.
State: not applied (installed files hold the 'before' bytes); both blobs of every file in .socket/blobs."""
import hashlib, json, os, sys
root = sys.argv[1]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
def w(p, b):
os.makedirs(os.path.dirname(p), exist_ok=True); open(p, "wb").write(b)
w(f"{root}/package.json", json.dumps({"name": "app", "version": "1.0.0", "dependencies": {"left-pad": "1.3.0", "right-pad": "1.0.1"}}, indent=2).encode())
patches = {}
for i, (name, ver) in enumerate((("left-pad", "1.3.0"), ("right-pad", "1.0.1"))):
pkg = f"{root}/node_modules/{name}"
w(f"{pkg}/package.json", json.dumps({"name": name, "version": ver, "main": "index.js"}, indent=2).encode())
files = {}
for fn in ("index.js", "lib/util.js"):
before = (f"// {name} {fn}\nmodule.exports = function () {{ return 'upstream' }}\n" + "// pad\n" * 4000).encode()
after = before + b"// SOCKET_PATCHED\n"
w(f"{pkg}/{fn}", before)
for b in (before, after): w(f"{root}/.socket/blobs/{gh(b)}", b)
files[f"package/{fn}"] = {"beforeHash": gh(before), "afterHash": gh(after)}
patches[f"pkg:npm/{name}@{ver}"] = {
"uuid": f"1111111{i}-2222-4333-8444-55555555555{i}", "exportedAt": "2026-11-01T00:00:00.000Z", "files": files,
"vulnerabilities": {f"GHSA-aaaa-bbbb-ccc{i}": {"cves": [f"CVE-2026-000{i}"], "summary": "s", "severity": "high", "description": "d"}},
"description": "d", "license": "MIT", "tier": "free"}
w(f"{root}/.socket/manifest.json", (json.dumps({"patches": patches}, indent=2) + "\n").encode())"""mkcargo.py <dir>: an agent-mode Cargo project that builds from a `cargo vendor` directory, two crates of two
patched files each, records made by hand. State: not applied."""
import hashlib, json, os, sys
root = sys.argv[1]
def gh(b): return hashlib.sha256(b"blob %d\0" % len(b) + b).hexdigest()
def sha(b): return hashlib.sha256(b).hexdigest()
def w(p, b):
os.makedirs(os.path.dirname(p), exist_ok=True); open(p, "wb").write(b if isinstance(b, bytes) else b.encode())
w(f"{root}/Cargo.toml", '[package]\nname = "app"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nalpha = "1.0.0"\nbeta = "1.0.0"\n')
w(f"{root}/src/main.rs", 'fn main() { println!("{} {} {} {}", alpha::value(), alpha::util::value(), beta::value(), beta::util::value()); }\n')
w(f"{root}/.cargo/config.toml", '[source.crates-io]\nreplace-with = "vendored-sources"\n\n[source.vendored-sources]\ndirectory = "vendor"\n')
lock = 'version = 4\n\n'
patches = {}
names = ("alpha", "beta")
for i, name in enumerate(names):
d = f"{root}/vendor/{name}"
files = {"Cargo.toml": f'[package]\nname = "{name}"\nversion = "1.0.0"\nedition = "2021"\n'.encode()}
rec = {}
for fn, body in (("src/lib.rs", 'pub mod util;\npub fn value() -> &\'static str { "%s" }\n'), ("src/util.rs", 'pub fn value() -> &\'static str { "%s" }\n')):
before = (body % "upstream").encode(); after = (body % "PATCHED").encode()
files[fn] = before
for b in (before, after): w(f"{root}/.socket/blobs/{gh(b)}", b)
rec[fn] = {"beforeHash": gh(before), "afterHash": gh(after)}
for fn, b in files.items(): w(f"{d}/{fn}", b)
pkgsum = sha(name.encode() * 7)
w(f"{d}/.cargo-checksum.json", json.dumps({"files": {fn: sha(b) for fn, b in sorted(files.items())}, "package": pkgsum}))
lock += f'[[package]]\nname = "{name}"\nversion = "1.0.0"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\nchecksum = "{pkgsum}"\n\n'
patches[f"pkg:cargo/{name}@1.0.0"] = {"uuid": f"1111111{i}-2222-4333-8444-55555555555{i}", "exportedAt": "2026-11-01T00:00:00.000Z", "files": rec,
"vulnerabilities": {f"GHSA-aaaa-bbbb-ccc{i}": {"cves": [f"CVE-2026-000{i}"], "summary": "s", "severity": "high", "description": "d"}},
"description": "d", "license": "MIT", "tier": "free"}
lock += '[[package]]\nname = "app"\nversion = "0.1.0"\ndependencies = [\n "alpha",\n "beta",\n]\n'
w(f"{root}/Cargo.lock", lock)
w(f"{root}/.socket/manifest.json", json.dumps({"patches": patches}, indent=2) + "\n")Vendored mode. The matrix test of the entry of 08:55Z of 11-30 ( Hosted mode. Per k: L180 by hand. A vendored copy of the Maven fixture ( Needs a person
|
|
[agent] 2026-12-04: architecture refactor
ChosenNo PR this run. Three routine PRs were open at the start and at 05:24Z: #2453, #2458 and #2461, each No lead was marked
PRNone opened. #2453, #2458 and #2461 await review. No code was pushed anywhere. Leads and issuesL184, confirmed, filed #2501 (
The real SDK (.NET 8.0.428, The cause is in L185, confirmed, on #2498 (a comment): a ledger save drops every field it does not know, at every level. The ten vendored fixtures, one unknown field at each of six levels of The released pair: 5.2.0 added
It fails closed and heals on the next online L186, true on
With the unknown kind in the place of a record the backend knows (nine ecosystems, 37 records), one row is unsafe: pnpm's 5.2.0 added five kinds. The released pairs, each a project
So no project two releases share is broken by this today. The differences are #989's four keep policies (the contract documents them per backend), met by an input only a later release can write. Not filed; #989 is the place if a release adds a kind to Cargo, Go or pnpm's workspace file. L187, rejected: an undo's result depends on its order in other ecosystems. Nine fixtures (npm, pnpm, Cargo, Go, Seen and not filed:
No issue closed. No lead is marked Areas examined
Lessons
The fixturesBoth releases. Vendored projects on disk. A test file under #!/bin/bash
# run.sh <fixture-dir> <binary> <args...>: a binary in an exported fixture, hermetic
D=$1; BIN=$2; shift 2
( cd "$D/proj" && env -i PATH="$PATH" HOME="$D/store/home" CARGO_HOME="$D/store/cargo-home" GOMODCACHE="$D/store/modcache" \
MAVEN_REPO_LOCAL="$D/store/m2" NUGET_PACKAGES="$D/store/nuget" SOCKET_NO_CONFIG=1 SOCKET_NO_UPDATE_CHECK=1 SOCKET_TELEMETRY_DISABLED=1 \
$(grep '^export ' "$D/env.sh" | sed "s/^export //; s/'//g") "$BIN" "$@" )More shapes from the same fixtures, written into
The platform gem and Rush. A copy of The merged project of L185. The platform gem's Unknown fields and kinds. Python over The SDK. Needs a person
|
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: 170 open and 166 closed
arch-auditissues · 3 open and 122 mergedarch-refactorPRs.arch-refactor· issues labelledarch-audit· decisions neededRendered 2026-12-04 05:26 UTC (ledger
7b264ed3) 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