|
| 1 | +[agent] 2026-11-30: architecture refactor |
| 2 | + |
| 3 | +**`main`:** cfc870f. The run started at 00:55Z. |
| 4 | + |
| 5 | +### Chosen |
| 6 | +No PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify leads instead. All three are `ready` and unchanged since 2026-11-26 (each `updated_at` is the same): none merged or closed, none has a review from a person, and no maintainer has commented on the discussion. No `arch-audit` issue has been opened since #2372, and no lead was left to verify. |
| 7 | + |
| 8 | +So this run took two areas no entry names. The first, **the hosted opt-out flags**, is clean. The second is **settings files outside the project in an encoding the tool reads and socket-patch does not**. It gave one problem, filed as #2375: a Maven `settings.xml` or a `NuGet.Config` that is there but is not UTF-8 is read as no settings. In the default mode that undoes the mirror gate of #2135: the scan pins a patch behind a company's catch-all mirror, reports success, and every Maven build fails. |
| 9 | + |
| 10 | +### PR |
| 11 | +None opened. #2261, #2265 and #2267 still await review. `main` has not moved from cfc870f. |
| 12 | + |
| 13 | +### Leads and issues |
| 14 | + |
| 15 | +**New: L102, filed as #2375.** Three readers of machine settings use a strict UTF-8 read and take a failure for "no file": |
| 16 | + |
| 17 | +- the mirror gate (core `crawlers/maven_crawler/settings_mirrors.rs`, lines 192 to 198: `Err(_) => Vec::new()`); |
| 18 | +- the Maven local repository (core `crawlers/maven_crawler.rs`, `settings_local_repository`, line 952: `.ok()?`); |
| 19 | +- NuGet's settings chain (core `vendor/nuget_config.rs`, lines 147 to 150, 182 to 185 and 216 to 220). |
| 20 | + |
| 21 | +The contract's rule for project files is that a file which exists and is not UTF-8 "is never read as absent" (line 467, #721), and Gradle's init scripts follow it (`note_unreadable_init_script`: the repository is then undetermined). The earlier fixes of the class are 829d0af1 (#721), 793edd44 (#1152) and 21536b29 (#1212) for `requirements.txt`, which got a decoder that reads the file as pip does. The mirror gate arrived on 2026-11-19 (40ac5a7c, #2135, in v5.1.0) with the plain read. |
| 22 | + |
| 23 | +Real Maven 3.9.11, the bench's Maven project, the binary built from `main`, and a repository manager stand-in on loopback as the mirror. One `~/.m2/settings.xml` with `<mirrorOf>*</mirrorOf>`, in eight encodings: |
| 24 | + |
| 25 | +``` |
| 26 | +settings.xml scan Maven reads the mirror |
| 27 | +UTF-8 (ASCII; an accented comment; with a BOM) skipped, redirect_maven_mirror_captures_repository yes (the ASCII file ran) |
| 28 | +ISO-8859-1, declared applied, no warning, 3 files changed yes |
| 29 | +windows-1252, declared applied, no warning, 3 files changed yes |
| 30 | +UTF-16 LE with a BOM applied, no warning, 3 files changed yes |
| 31 | +declared UTF-8, one ISO-8859-1 byte in a comment applied, no warning, 3 files changed yes |
| 32 | +no declaration, one ISO-8859-1 byte applied, no warning, 3 files changed yes |
| 33 | +``` |
| 34 | + |
| 35 | +End to end under the ISO-8859-1 file: `mvn dependency:resolve` is BUILD SUCCESS before the scan; the scan prints "Switched 1 package to hosted patches; rewrote 3 files … Nothing left to patch" and exits 0; the same Maven command then fails with `Could not find artifact io.midadi2:bech2-client:jar:3.3.7-socket.07ea3d34 in corp (http://127.0.0.1:18999/repository/maven-public/)`. Under the UTF-8 file the scan withholds the pin and the build stays green. |
| 36 | + |
| 37 | +The two other readers, by a dry agent-mode scan: with `<localRepository>` naming an empty directory, the UTF-8 file gives `scannedPackages: 0` and the ISO-8859-1 and UTF-16 files give 20 (the crawler read `~/.m2/repository`). With `globalPackagesFolder` in a user `NuGet.Config`, the real .NET SDK 8.0.428 (`dotnet nuget locals global-packages --list`) names the configured folder for UTF-8, ISO-8859-1 and UTF-16, and the crawler reads it for UTF-8 only (0 against 18). |
| 38 | + |
| 39 | +Two throwaway unit tests, one beside each Maven reader, fail on `main` (`left: [("UTF-8", Some("corp")), ("ISO-8859-1", None), ("UTF-16", None)]`). They are in the issue, with the planned fix: one decoder for an XML settings file beside `utils::requirements::decode`, and "cannot tell" where a file still cannot be read. |
| 40 | + |
| 41 | +**#2375, two more sites; commented.** The same read serves two layers that a Node tool reads whatever their bytes: |
| 42 | + |
| 43 | +- **Yarn classic's offline mirror** (core `patch/redirect/yarnrc.rs`, line 716). A `~/.yarnrc` with one ISO-8859-1 byte in a comment: yarn 1.22.22 still reports the mirror, and the scan pins (`applied`, no warning) where the UTF-8 file gives `redirect_yarn_classic_offline_mirror`. |
| 44 | +- **npm's `allow-remote` in the user config** (CLI `commands/scan/hosted.rs`, lines 2019 to 2022). A `~/.npmrc` with `allow-remote=root` and the same byte: npm 12.2.3 reads `root`, and the scan creates the project `.npmrc` with `allow-remote=all`, where the contract says such a value "is RESPECTED and never rewritten". With the UTF-8 file it writes nothing. |
| 45 | + |
| 46 | +**Seen and not filed:** |
| 47 | +- **A project file that is not UTF-8 is refused by name.** An ISO-8859-1 or UTF-16 `pom.xml`, and a project `.yarnrc` with one ISO-8859-1 byte, each end the hosted scan with `candidate_file_unreadable`, exit 1, nothing written. As the contract says. Maven builds such a pom; the refusal is true and names the remedy. |
| 48 | +- **The hosted NuGet scan's write differs with the user config's encoding.** With a user config that maps `*` to a company source, the UTF-8 run adds one mapping for the Socket source; the UTF-16 run also adds `nuget.org` → `*`. It is in #2375 as a note; no restore ran over it. |
| 49 | +- **NuGet is stricter than Maven.** The SDK refuses a config declared UTF-8 with an ISO-8859-1 byte, and one declared windows-1252. Yarn 1 refuses a UTF-16 `.yarnrc`. None is a case. |
| 50 | +- **`utils::requirements::decode` is the shape the fix wants.** Read, not run. |
| 51 | +- **About 190 sites discard the error of a strict text read** (`grep -A3 read_regular_to_string` for `.ok()`, `Err(_) =>` and `unwrap_or_default()`). Most read a file that must be UTF-8 for its own tool. I ran the five above. `hosted/governing_root.rs` (15 sites: a workspace root's settings above the project) is the next place to look. |
| 52 | + |
| 53 | +### Areas examined |
| 54 | +All with the binary built from `main` and the bench's patch API on loopback. |
| 55 | + |
| 56 | +- **The hosted opt-out flags, 28 runs.** `--no-npm-allow-remote-config` on `scan`, by flag and by its variable as `1`, `true`, `0` and empty: with the opt-out no `.npmrc` is written and the warning stays; `0` and empty do not opt out. It and `--no-trust-lockfile-config` on `get <purl>`, by flag and by variable: the same, for `.npmrc` and `pnpm-workspace.yaml`. Then, for each, a sequence: a scan with the opt-out, the same again, a plain scan (the file is written: the heal the contract describes), a scan with the opt-out over the healed tree (the file stays), then `list`, `repair` and `scan --prune` with the opt-out (accepted, nothing changed). |
| 57 | +- **Maven settings in eight encodings**, the hosted scan and real Maven (the table above); the agent-mode crawl under three; the human output of the scan under two. |
| 58 | +- **A user `NuGet.Config` in four encodings**, the agent-mode crawl and the real SDK (which also got a mis-declared file and a windows-1252 one); the hosted scan under a mapped user config in three. |
| 59 | +- **A `.yarnrc`** in the project (three encodings) and in the home directory (two), with real yarn; a user `.npmrc` in two, with real npm 12.2.3. |
| 60 | +- **A non-UTF-8 `pom.xml`**, two encodings, the hosted scan. |
| 61 | +- Read: `settings_mirrors.rs`, `formats/maven/mirror.rs` (its header), `settings_local_repository` and the local repository lookup, `nuget_config.rs` (the two chains), `yarnrc.rs`, `patch/redirect/npmrc.rs` (the ini reader and the layers), `requirements.rs` (the rewriter) and `utils/requirements.rs` (`decode`), `utils/repo_root.rs`, `vlt_project_root`, `ui/browser.rs` (its header), `e2e_artifactory_mirror.rs` (its header), and the contract on the mirror gate, the npm and pnpm auto-config and non-UTF-8 files. |
| 62 | +- Not run: Windows; Maven 3.6, 3.8 and 4, `mvnd` and the wrapper; a wet agent-mode run over a default folder that holds an older copy; a `yarn install` from a mirror after the pin; a NuGet restore after the differing write; `--no-vlt-install-cleanup` (the vlt heal is #2265's file) and the three gem opt-outs (they need a real Bundler tree); the `replace-registry-host` and `omit-lockfile-registry-resolved` warnings under an unread user config. |
| 63 | + |
| 64 | +### Lessons |
| 65 | +- **A gate that reads the machine is only as good as its read.** The mirror gate finds the settings files by rules the contract spends a page on, and its matching was checked against four Mavens. Its read is one line, and one byte in a comment turns the gate off. |
| 66 | +- **Give a settings file outside the project one byte that is not UTF-8, then write it as UTF-16, and ask the tool what it reads.** The project's own files are covered by `candidate_file_unreadable`; the files above the project are not. `file -b` names the encoding for the write-up. |
| 67 | +- **The tools differ, so each needs its own run.** Maven reads anything; .NET refuses a malformed byte and windows-1252; yarn refuses UTF-16; npm and yarn read a stray byte. |
| 68 | +- **A value that equals the default proves nothing.** `allow-remote=none` in the user file gave `none` from npm with and without the file. `root` showed that npm reads it. |
| 69 | +- **A repository manager stand-in is 40 lines**: a static directory for the project's own groups and Maven Central for the rest. With `<mirrorOf>*</mirrorOf>` the build tool's requests all arrive there, so its log says what Maven read. |
| 70 | +- **Maven Central answered 404 for about half of all requests here, at random**, over HTTP/1.1 and HTTP/2, from `curl` and from Python. The first Maven run failed on a parent pom because of it. The stand-in asks up to 30 times and keeps what it got. |
| 71 | +- **Counting words per flag found the first area and nothing in it.** The finding came from asking which words no entry holds at all: "encoding", "ISO-8859", "UTF-16". |
| 72 | +- **Read the clock.** The run took about 35 minutes of wall time: the CLI build 4 (in the background), choosing 8, the opt-outs 2, the encodings and the real Maven 10 (two background runs), NuGet, yarn and npm 6, the issue and the ledger the rest. |
| 73 | +- The register was at 11,989 characters and is at 11,942. L102 joined the `filed` row, #2375 the Next PR line after #2360, and the two areas are one phrase each of the Areas row. Two notes are new in substance (a settings file in another encoding; Central's 404s), each a clause of an existing note. To make room, the recipes line lost the nine recipes that are in their issues. |
| 74 | +- The owner was notified at about 01:22Z of #2375. |
| 75 | + |
| 76 | +<details><summary>The bench runner</summary> |
| 77 | + |
| 78 | +`socket-patch-bench serve <pm>/hosted --bin <cli> --scale 0.02 --work-dir bench > bench/<pm>.out` for each package manager, then: |
| 79 | + |
| 80 | +```python |
| 81 | +"""run.py: drive the built binary over copies of a bench project.""" |
| 82 | +import hashlib, os, shlex, shutil, subprocess |
| 83 | +S = os.path.dirname(os.path.abspath(__file__)) |
| 84 | +class Result: |
| 85 | + def __init__(self, code, out, err): self.code, self.out, self.err = code, out, err |
| 86 | +class Bench: |
| 87 | + def __init__(self, pm): |
| 88 | + line = next(l for l in open(os.path.join(S, "bench", pm + ".out")).read().splitlines() if l.startswith("env -i ")) |
| 89 | + toks = shlex.split(line)[2:] |
| 90 | + self.env, i = {}, 0 |
| 91 | + while "=" in toks[i] and not toks[i].startswith("/"): |
| 92 | + k, v = toks[i].split("=", 1); self.env[k] = v; i += 1 |
| 93 | + self.bin, self.args = toks[i], toks[i + 1:] |
| 94 | + self.project = self.args[self.args.index("--cwd") + 1] |
| 95 | + self.work = os.path.dirname(self.project) |
| 96 | + def copy(self, name): |
| 97 | + dst = os.path.join(self.work, "p-" + name) |
| 98 | + if os.path.exists(dst): shutil.rmtree(dst) |
| 99 | + shutil.copytree(self.project, dst, symlinks=True) |
| 100 | + return dst |
| 101 | + def run(self, project, args, env=None): |
| 102 | + e = dict(self.env); e.update(env or {}) |
| 103 | + p = subprocess.run([self.bin] + args + ["--cwd", project], env=e, cwd=S, capture_output=True, text=True) |
| 104 | + return Result(p.returncode, p.stdout, p.stderr) |
| 105 | +``` |
| 106 | + |
| 107 | +For a file in the home directory, copy `work/home` to `work/home-b` and pass every variable of the bench's line that holds the home's path, rewritten: `{k: v.replace(home, home2) for k, v in b.env.items() if home in v}`. |
| 108 | + |
| 109 | +</details> |
| 110 | + |
| 111 | +<details><summary>One settings file in eight encodings, and the real tools</summary> |
| 112 | + |
| 113 | +```python |
| 114 | +BODY = '''<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"> |
| 115 | + <!-- {comment} --> |
| 116 | + <mirrors> |
| 117 | + <mirror> |
| 118 | + <id>corp</id> |
| 119 | + <mirrorOf>*</mirrorOf> |
| 120 | + <url>http://127.0.0.1:18999/repository/maven-public/</url> |
| 121 | + </mirror> |
| 122 | + </mirrors> |
| 123 | +</settings> |
| 124 | +''' |
| 125 | +A = "Configuración corporativa" |
| 126 | +cases = { |
| 127 | + "utf8-ascii": ('<?xml version="1.0" encoding="UTF-8"?>\n' + BODY.format(comment="Corporate configuration")).encode("utf-8"), |
| 128 | + "utf8-accent": ('<?xml version="1.0" encoding="UTF-8"?>\n' + BODY.format(comment=A)).encode("utf-8"), |
| 129 | + "utf8-bom": b"\xef\xbb\xbf" + ('<?xml version="1.0" encoding="UTF-8"?>\n' + BODY.format(comment="Corporate configuration")).encode("utf-8"), |
| 130 | + "latin1": ('<?xml version="1.0" encoding="ISO-8859-1"?>\n' + BODY.format(comment=A)).encode("latin-1"), |
| 131 | + "cp1252": ('<?xml version="1.0" encoding="windows-1252"?>\n' + BODY.format(comment="Configuración “corporativa”")).encode("cp1252"), |
| 132 | + "utf16-bom": b"\xff\xfe" + ('<?xml version="1.0" encoding="UTF-16"?>\n' + BODY.format(comment="Corporate configuration")).encode("utf-16-le"), |
| 133 | + "utf8-declared-latin1-byte": ('<?xml version="1.0" encoding="UTF-8"?>\n' + BODY.format(comment=A)).encode("latin-1"), |
| 134 | + "no-declaration-latin1-byte": BODY.format(comment=A).encode("latin-1"), |
| 135 | +} |
| 136 | +``` |
| 137 | + |
| 138 | +The mirror stand-in (`mirror.py`) is in #2375. Its static directory is a copy of the bench's `work/home/.m2/repository` without the `_remote.repositories` files. |
| 139 | + |
| 140 | +```bash |
| 141 | +python3 mirror.py static 18999 mirror.log central-cache & |
| 142 | +# Maven, with the file named and a local repository of its own: |
| 143 | +mvn -B -s <file> -Dmaven.repo.local=<dir> dependency:resolve |
| 144 | +# the scan, with the same file as ~/.m2/settings.xml of the bench's home: |
| 145 | +<bench env> socket-patch scan --yes --json --cwd <copy> |
| 146 | +# after a failed resolve, Maven caches the failure: remove <dir>/io/midadi2/bech2-client/<version> to see the first message again. |
| 147 | + |
| 148 | +# NuGet: dockerd > dockerd.log 2>&1 &, then for each config |
| 149 | +docker run --rm -v "$PWD/nuget-real":/cfg:ro mcr.microsoft.com/dotnet/sdk:8.0-noble sh -c \ |
| 150 | + 'mkdir -p /root/.nuget/NuGet && cp /cfg/<name>.config /root/.nuget/NuGet/NuGet.Config && dotnet nuget locals global-packages --list' |
| 151 | + |
| 152 | +# yarn and npm, with the home that holds the file: |
| 153 | +env -i PATH="$PATH" HOME=<home> yarn config get yarn-offline-mirror |
| 154 | +(mkdir npm12 && cd npm12 && npm i npm@12); env -i PATH="$PATH" HOME=<home> node npm12/node_modules/npm/bin/npm-cli.js config get allow-remote |
| 155 | +``` |
| 156 | + |
| 157 | +</details> |
| 158 | + |
| 159 | +### Needs a person |
| 160 | +- **#2375 is in v5.1.0.** On a machine whose Maven settings hold one byte that is not UTF-8 and a catch-all mirror, a hosted scan breaks every Maven build and says it succeeded. The issue has one point for a maintainer: whether a settings file socket-patch cannot read should withhold the pin with a warning (I would). |
| 161 | +- **Review #2261, #2265 and #2267.** This is the forty-seventh run in a row that could only verify leads, by the entries since 05:13Z of 2026-11-26. |
| 162 | +- **#2270** still blocks `ci-ok` on every PR; #2280 is open for it. |
| 163 | +- **#2372 and #2353 are on `main` and not released**, and **#2359 is in v5.0.0 and v5.1.0.** |
| 164 | +- **#2366, #2347, #2340, #2309, #2277 and #2297 need an answer.** **#2299**, **#2315** and **#2362** each ask which of two fixes a maintainer prefers. |
| 165 | +- Sixty-one confirmed problems of this routine wait for a slot, in the order the register's "Next PR" line gives. |
0 commit comments