@ai-ecoverse/slicc-kernel 1.42.0 → 1.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -499,7 +499,7 @@ npm run test:unit
499
499
 
500
500
  `npm test` builds `dist/` and runs the integration tests in Chromium from `playwright-core`, over raw CDP through the [harness from slicc-shared-web](https://github.com/ai-ecoverse/slicc-shared-web#integration-test-harness), against a cross-origin isolated test page that installs bash and coreutils into OPFS. Each test writes screenshots, console logs and CPU profiles to `artifacts/`; V8 coverage from the page and every worker, mapped back to `src/` through the source maps, goes to `coverage/`, and `artifacts/hotspots.md` lists where the time went.
501
501
 
502
- Unit tests live in `test/unit/`, which stays out of git. They run real wasm bash and coreutils through the whole stack in Node `worker_threads` against an in-memory OPFS. The pre-commit hook runs them under coverage and requires every changed line in `src/` to be covered.
502
+ Unit tests live in `test/unit/`, which stays out of git. They run real wasm bash and coreutils through the whole stack in Node `worker_threads` against an in-memory OPFS. The pre-commit hook runs them under coverage and requires every changed line in `src/` to be covered. `tools/heavy.sh` runs them two files at a time, holding the lock `/tmp/slicc-heavy.lock` (`SLICC_HEAVY_LOCK`) that the Chromium tests take too, and stops the run if its processes use more than 3,000,000 KB together or 2,000,000 KB in one process, or run longer than 900 s once they hold the lock (`SLICC_HEAVY_TIMEOUT`; each test also has 180 s) (`SLICC_HEAVY_REPORT=1` prints the peak). `SLICC_HEAVY_TREE_KB` and `SLICC_HEAVY_PROC_KB` raise the caps, but only for measuring a run under a higher ceiling that still stops a runaway, never to get a commit through. The guard follows the command's process group and every process it has seen, including children that leave the group, but a process that forks, calls `setsid` and whose parent exits within one 0.25 s sample can escape: macOS has no unprivileged containment, and a test that daemonizes is a bug. The compiler tests (zig, rustc and cargo), each a few GB, are integration tests in `test/integration/compilers.test.mjs`, which CI runs.
503
503
 
504
504
  The Biome, TypeScript, lefthook, Renovate and CI configuration comes from [slicc-shared-web](https://github.com/ai-ecoverse/slicc-shared-web), which also provides the `slicc-lint-comments` (no comments anywhere), `slicc-no-unit-tests` (no unit tests in git) and `slicc-diff-cover` (100% coverage of changed lines) commands that `npm run lint` and the pre-commit hook use.
505
505
 
@@ -9171,7 +9171,7 @@ var WasmProcess = class {
9171
9171
  const fd = this.fds.install(heldFile(), 3);
9172
9172
  try {
9173
9173
  const nodes = this.nodes;
9174
- const path = req.orphan ? req.path : req.exclusive ? await nodes.entryKey(req.path) : req.create ? await nodes.targetKey(req.path) : await this.keptOr(await nodes.targetKey(req.path));
9174
+ const path = req.orphan ? req.path : req.exclusive ? await nodes.entryKey(req.path) : req.create ? await nodes.targetKey(req.path) : await this.keptOr(await nodes.targetKey(req.path), req.handle);
9175
9175
  const open = { ...req, path };
9176
9176
  if (req.exclusive) {
9177
9177
  await nodes.createExclusive(path);
@@ -9329,7 +9329,10 @@ var WasmProcess = class {
9329
9329
  }
9330
9330
  }
9331
9331
  keptPath;
9332
- async keptOr(path) {
9332
+ keptHandle;
9333
+ async keptOr(path, handle) {
9334
+ const held = handle === void 0 ? void 0 : this.keptHandle?.(handle);
9335
+ if (held !== void 0) return held;
9333
9336
  const kept = this.keptPath?.(path);
9334
9337
  return kept !== void 0 && !await present(this.options.fs, path, true) ? kept : path;
9335
9338
  }
@@ -9340,7 +9343,7 @@ var WasmProcess = class {
9340
9343
  return;
9341
9344
  }
9342
9345
  if (req.path === void 0) throw new KernelError("EINVAL");
9343
- const path = req.orphan ? req.path : await this.keptOr(await this.nodes.targetKey(req.path));
9346
+ const path = req.orphan ? req.path : await this.keptOr(await this.nodes.targetKey(req.path), req.handle);
9344
9347
  if (!this.fds.get(req.fd).file.held) throw new KernelError("EBADF");
9345
9348
  const file = vfsFile(
9346
9349
  this.options.fs,
@@ -9372,6 +9375,8 @@ var WasmProcess = class {
9372
9375
  ...file.heldMeta ? { meta: file.heldMeta } : {},
9373
9376
  ...flags !== void 0 ? { flags } : {},
9374
9377
  ...this.fds.closesOnExec(fd) ? { cloexec: true } : {},
9378
+ ...file.read && !file.write ? { access: "read" } : {},
9379
+ ...file.write && !file.read ? { access: "write" } : {},
9375
9380
  ...file.tty?.name ? { name: file.tty.name } : file.pty ? { name: "/dev/ptmx" } : {}
9376
9381
  };
9377
9382
  }
@@ -9781,6 +9786,7 @@ function spawnWasmProcess(opts) {
9781
9786
  opts.held?.add(holds);
9782
9787
  const token = holdingToken(opts, holds);
9783
9788
  process.keptPath = (path) => holds.keptAt(path)?.hidden;
9789
+ process.keptHandle = (handle2) => holds.keptFor(handle2)?.hidden;
9784
9790
  const worker = opts.createWorker();
9785
9791
  const dying = new Dying();
9786
9792
  const dispatch2 = (req) => dying.serving(() => isWasmSyscall(req) ? process.syscall(req) : dispatchSyncFs(req));