Repository navigation
impl(027): increment 7, the platform packages - #140
Conversation
AI review (findings)Looking at the diff, the main changes are: seven new platform Finding 1 —
if (main.scripts) failures.push(`${main.name}: has scripts (3.13.2 allows none)`);The spec's "no script" constraint is stated for platform packages. This line rejects any Finding 2 —
Finding 3 —
execFileSync('npm', ['pack', '--json', '--ignore-scripts', '--pack-destination', into, dir], {
encoding: 'utf8',
shell: process.platform === 'win32',
});
{"head": "768a872aa1c2a2b3f5be33978c64c7a353be926e", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 51, "summary": "check() tests main.scripts for absence of scripts, but the spec's no-script constraint applies only to platform packages; any dev/build script entry on the main package.json causes check to always fail."}, {"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 100, "summary": "addonName() is called without try/catch in stage() and fresh(), producing a raw stack trace on unsupported platforms instead of the clean error message copy-addon.mjs's own main block produces."}, {"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 108, "summary": "shell: true on Windows passes unescaped user-supplied path arguments (dir, into) through cmd.exe, making paths with shell-special characters (& ^ () spaces) subject to misinterpretation or injection."}]}Subject: cbd5bfb...768a872, diff digest 6435177c2d52a9ed781b80e0184462cbe371cf22a175080d220bad1274c1828a, 1 call(s). An AI comment is not an approval. |
768a872 to
1eaaab3
Compare
AI review (findings)Reviewing the diff for bugs, security issues, and inconsistencies.
Line ~133: Lines ~119-122 ( Platform Makefile -- The {"head": "1eaaab3dab916bfbd84424c60f12dd0e595f64f3", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 133, "summary": "rmSync with recursive+force is called on the raw user-supplied path with no bounds check; if BINDINGS_OUT is unset the Makefile expands to /native-fresh and the deletion proceeds silently against an absolute system path."}, {"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 122, "summary": "pack() joins the filename from npm's JSON output directly without sanitisation; a path-traversal value in npm's response would resolve the tarball outside the intended tarballs directory, and a malformed response produces an opaque SyntaxError rather than a clear diagnostic."}]}Subject: cbd5bfb...1eaaab3, diff digest 919667dd6b760f28752e83865cda45a198ad98e1f30d5d1b922ca5c763468505, 1 call(s). An AI comment is not an approval. |
1eaaab3 to
02297d2
Compare
AI review (findings)Reviewing the seven new platform Platform package files (
const had = Object.hasOwn(process.report, 'excludeNetwork')
? process.report.excludeNetwork
: undefined;
if (had !== undefined) process.report.excludeNetwork = true; // ← never fires when property is absent
glibc = process.report.getReport().header?.glibcVersionRuntime;
if (had !== undefined) process.report.excludeNetwork = had;When
Makefile shell expansion: {"head": "02297d21e740b21ba89a180e7273f79b4e5226ff", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/copy-addon.mjs", "line": null, "summary": "In addonName(), the excludeNetwork optimisation is never applied when the property is absent from process.report (had === undefined causes both guards to skip), so getReport() runs the expensive network section on any Node.js version that does not already expose that property."}]}Subject: cbd5bfb...02297d2, diff digest 593e335086faa87df96c96732aca0e3fbc3e37e658b1eb9395da04784fc0c7ba, 1 call(s). An AI comment is not an approval. |
02297d2 to
7251222
Compare
AI review (no-findings)Reviewing the diff for bugs, security problems, and inconsistencies. copy-addon.mjs refactor — The conversion from a standalone script to an ESM module with exported functions is clean. The platform-packages.mjs —
Makefile — Platform No critical bugs or security issues found. {"head": "725122205fd332cd614708f9c4370410ea9443ca", "verdict": "no-findings", "findings": []}Subject: cbd5bfb...7251222, diff digest 6a43ca85104a80c1e2386f7af149c2226e5903d587aa77a264f0d8c852d40df6, 1 call(s). An AI comment is not an approval. |
7251222 to
f5d267b
Compare
AI review (findings)Reviewing the diff: new platform package manifests, a new
const dirs = existsSync(npmDir) ? readdirSync(npmDir).sort() : [];
Everything else looks correct: the TOCTOU guard on the {"head": "f5d267b2d1ec403395d8fe41918c8c69b38cbde0", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/copy-addon.mjs", "line": 43, "summary": "builtAddon() does not validate the platform, returning a path ending in '.undefined' if called on an unsupported platform without a prior addonName() guard."}, {"path": "tools/rustev-conformance/js/platform-packages.mjs", "line": 89, "summary": "readdirSync without a directory filter causes check() to flag any stray file (e.g. .DS_Store) in npm/ as a missing optional dependency, producing false failures on macOS."}]}Subject: b2c5c6d...f5d267b, diff digest 6a43ca85104a80c1e2386f7af149c2226e5903d587aa77a264f0d8c852d40df6, 1 call(s). An AI comment is not an approval. |
The seven platform packages of 3.13.1 in napi-rs's optional-dependency layout, a check that they agree with the main package, staging of this host's addon, and a fresh install from the tarballs alone that the native conformance suite runs on.
f5d267b to
92d4d9a
Compare
AI review (no-findings)Reviewing the diff carefully: seven new platform
Platform No bugs or security issues found. {"head": "92d4d9a5a0f1f8f6ad5b5916300e9a151e6db93c", "verdict": "no-findings", "findings": []}Subject: b2c5c6d...92d4d9a, diff digest cc2816232d17af02064917ff5799bf54d2058d3d1be16caf422d55abf869ce99, 1 call(s). An AI comment is not an approval. |
Spec 027 increment 7, second change: the WebAssembly package in headless Chromium (3.10.5, 3.11.3, 3.13.3). - `tools/rustev-conformance/js/package.json`: `playwright-core` exact-pinned at 1.63.0 (no dependencies; `npm audit signatures` covers it), which fixes the Chromium build; `make bindings` installs that version's headless shell. - `tools/rustev-conformance/js/chromium.mjs time <pkg> <out>`: cold instantiation as 3.10.5 defines it (module bytes in memory to the first successful `version()`), 3 discarded warm-up runs then 21 measured, each in a fresh browser process, the page served from a loopback server holding only the package directory (paths outside it refused). Writes browser version, samples, median and p95; prints the median. - `wasm-check.mjs`: `--chromium-record <file>` records those in the measurement document (`chromium`, `chromium_instantiation_ms` with samples and p95); its median must equal the gated `--chromium-ms`. - `run.mjs`: the WebAssembly adapter now turns each case into one plain call (`wasmCall`, bytes as base64) run by one self-contained executor (`executeWasm`), so identical code runs in Node and in a Chromium page. `run.mjs chromium <pkg>` runs every WebAssembly case in Chromium. A replay's synchronous resolver answers from the case's store items, exactly as before. - `Makefile` (`bindings`): installs the headless shell, measures Chromium, passes the median and record to `wasm-check.mjs`, and runs the conformance cases in Chromium after Node. - Spec 027: implementation record. #140 has merged; this PR is rebased onto `main`. Local verification (macOS arm64): `make bindings` passes end to end: WebAssembly conformance 23/23 in Node and 23/23 in Chromium 153.0.8010.12 (headless shell), Chromium instantiation median 3.1 ms and p95 3.3 ms (budget 100 ms), Node median 3.7 ms, sizes raw 2,216,152 / gzip 763,059 / Brotli 543,437, 27 native tests, native conformance 34/34 on the local build and on the fresh install. That run preceded the rebase onto #140's review fixes, which touch only `platform-packages.mjs` and were verified there. `make gate`; `bash scripts/check-authored-content.sh`. Review round 1 (3 findings, fixed): 1. An absent optional argument crossed into the page as `undefined` (which a page receives as `null`) and stayed `undefined` in Node. Both cases already read as `None` (wasm-bindgen's `isLikeNone` tests both), which is why all 23 cases passed in Chromium, but `wasmCall` now writes `null` itself for `--execution` and `--host-cap-ms`, so Node and the page receive the same value, with a comment saying why. 2. A request whose URL does not parse or whose path does not decode threw out of the server's handler; it is now answered 400 (checked locally with a raw request for `/%E0%A4%A`). 3. The timing run launched a 25th browser only to read its version; each sample now returns its browser's version, and the record takes the first measured one. Rebased onto #140's review rounds 2 and 3. After the fixes: `run.mjs wasm` 23/23 and `run.mjs chromium` 23/23, `chromium.mjs time` median 3 ms with version 153.0.8010.12 recorded.
Spec 027 increment 7, first change: the native package's platform packages (3.13.1, 3.13.2).
integrations/rustev-node/npm/<platform>/package.jsonfor the seven platforms the main package'soptionalDependenciesname (linux-x64-gnu,linux-x64-musl,linux-arm64-gnu,linux-arm64-musl,darwin-arm64,darwin-x64,win32-x64-msvc):@statecrafting/rustev-<platform>at the main package's version, license and engines;os,cpuand, on Linux,libcas the name says;mainandfilesthe addonrustev.<platform>.nodealone; no scripts;privateuntil spec 031's release.tools/rustev-conformance/js/platform-packages.mjs:check: every optional dependency has its package and they agree as above; no stray platform directory; no script in a platform package and no install-time script (preinstall,install,postinstall,prepare) in the main package;stage <target>: copies this host's release addon into its platform package;fresh <dir>:npm packs the main package and this host's platform package and installs both into a fresh project from the tarballs (--omit=optional --ignore-scripts), so nothing is fetched for another platform, and fails if the main package's tarball carries an addon.copy-addon.mjsexports the addon naming it already had (addonName,builtAddon) for that reuse; its command line is unchanged.make bindingsrunscheck,stage,fresh, then the native conformance suite on the fresh install, so the suite exercises the loader's platform-package path (3.13.2), not only the local build.Building and smoke-testing each of the seven targets in CI is a later change of this increment (the
bindingsjob).Local verification (macOS arm64, clean build of the changed crates):
make bindingspasses end to end (npm audit signatures, WebAssembly conformance 23/23, 27 native tests, native conformance 34/34 on the local build and 34/34 on the fresh install);make gate;bash scripts/check-authored-content.sh.Review round 1 (3 findings, fixed):
checkrefused anyscriptson the main package. 3.13.2 forbids install-time code, so it now refuses only npm's install lifecycle scripts there (preinstall,install,postinstall,prepare); a platform package still has no script at all. Seeded locally: abuildscript on the main package passes, apostinstallfails naming it.stageandfreshletaddonName()'s throw on an unsupported platform escape as a stack trace; both now go throughhostPlatform(), which exits with the message.shell: trueon Windows, so cmd.exe parsed the paths. npm now runs without a shell everywhere: on Windows its entry point (node_modules/npm/bin/npm-cli.jsbesidenode.exe) runs under the current Node, and a missing one fails by name.Review round 2 (2 findings, fixed):
freshdeleted its target directory unconditionally. It now writes a marker (.rustev-fresh) into the directory it makes and replaces only a directory carrying it; any other existing path is refused by name and left alone (seeded locally: a scratch directory holding a file was refused and kept). Inmake bindingsthe path is under the cargo target directory, which the target already refuses to be empty.packjoined npm's reported file name unchecked. A response that is not JSON, or a name that is not one plain.tgzfile name, or a tarball that is not there, now fails with a message naming the package.Review round 3 (1 finding, answered in the diff, no behavior change):
addonName()skipsexcludeNetworkwhenprocess.reporthas no such own property. That is deliberate and unchanged from #135's loader: only a Node that supports leaving the network section out exposes the property, and assigning it elsewhere would add a plain property the report never reads. The comment at the call now says so; the report then runs whole, slower but correct.Rebased onto
mainafter #138 and #139 merged. Localmake bindingson the rebased branch, aftercargo clean -pof every crate #139 changed: WebAssembly conformance 23/23, 27 native tests, native conformance 34/34; itsfreshstep refused anative-freshdirectory left by a run from before the round-2 marker existed (the guard working as intended). With that directory removed, the fresh install's suite passed 34/34.Review round 4 (2 findings, fixed):
builtAddon()produced a path ending in.undefinedon an unsupported platform; it now throws naming the platform, andstagereports it cleanly.checkcounted any entry undernpm/as a platform directory, so macOS's.DS_Storefailed it; only non-hidden directories count now (seeded locally with a.DS_Store:checkpasses).