@ai-ecoverse/slicc-kernel 1.42.1 → 1.42.3

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
 
@@ -5480,6 +5480,7 @@ var init_wasi_host = __esm({
5480
5480
  startCwd;
5481
5481
  interruptWakes = false;
5482
5482
  onRaise;
5483
+ muted;
5483
5484
  listening;
5484
5485
  o;
5485
5486
  constructor(o) {
@@ -5828,6 +5829,7 @@ var init_wasi_host = __esm({
5828
5829
  return this.o.kernel.call({ op: "fd-vfs-stat", fd });
5829
5830
  }
5830
5831
  write(fd, data) {
5832
+ if (this.muted?.(fd, data)) return data.length;
5831
5833
  const e = this.fds.get(fd);
5832
5834
  if (e.type === "kernel") {
5833
5835
  try {
@@ -6223,18 +6225,22 @@ var init_wasi_module = __esm({
6223
6225
  });
6224
6226
 
6225
6227
  // src/process/wasi/wasi-signals.ts
6226
- var DELIVERED_MASK, WasiSignals;
6228
+ var DELIVERED_MASK, LIBC_DEFAULT_EXIT, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
6227
6229
  var init_wasi_signals = __esm({
6228
6230
  "src/process/wasi/wasi-signals.ts"() {
6229
6231
  "use strict";
6230
6232
  init_signals();
6233
+ init_wasi_host();
6231
6234
  DELIVERED_MASK = Object.values(SIG).filter((sig) => sig !== SIG.KILL && sig !== SIG.STOP).reduce((m, sig) => m | sigbit(sig), 0);
6235
+ LIBC_DEFAULT_EXIT = 127;
6236
+ WASIX_LIBC_DEFAULT_LINE = /^Program recieved (?:stop|termination|fatal) signal: [^\n]+\n$/;
6232
6237
  WasiSignals = class {
6233
6238
  exports;
6234
6239
  callback;
6235
6240
  uncaught = 0;
6236
6241
  delivering;
6237
6242
  defaulted = false;
6243
+ libcDefault = false;
6238
6244
  fallBack;
6239
6245
  onKilled;
6240
6246
  constructor(fallBack, onKilled) {
@@ -6257,19 +6263,28 @@ var init_wasi_signals = __esm({
6257
6263
  raise(sig) {
6258
6264
  const handler = this.handler();
6259
6265
  if (!handler) return;
6260
- const outer = { sig: this.delivering, defaulted: this.defaulted };
6266
+ const outer = { sig: this.delivering, defaulted: this.defaulted, libc: this.libcDefault };
6261
6267
  this.delivering = sig;
6262
6268
  this.defaulted = false;
6269
+ this.libcDefault = false;
6263
6270
  try {
6264
6271
  handler(sig);
6265
6272
  } catch (e) {
6266
- if (!(e instanceof WebAssembly.RuntimeError)) throw e;
6273
+ const libcExit = e instanceof WasiExit && e.code === LIBC_DEFAULT_EXIT && this.libcDefault;
6274
+ if (!(libcExit && !this.defaulted) && !(e instanceof WebAssembly.RuntimeError)) throw e;
6267
6275
  if (!this.defaulted) this.defaultAction(sig);
6268
6276
  } finally {
6269
6277
  this.delivering = outer.sig;
6270
6278
  this.defaulted = outer.defaulted;
6279
+ this.libcDefault = outer.libc;
6271
6280
  }
6272
6281
  }
6282
+ muted(fd, data) {
6283
+ if (fd !== 2 || this.delivering === void 0) return false;
6284
+ if (!WASIX_LIBC_DEFAULT_LINE.test(new TextDecoder().decode(data))) return false;
6285
+ this.libcDefault = true;
6286
+ return true;
6287
+ }
6273
6288
  raised(sig) {
6274
6289
  if (sig !== SIG.ABRT || this.delivering === void 0) return false;
6275
6290
  if (!this.defaulted) this.defaultAction(this.delivering);
@@ -8119,6 +8134,7 @@ async function runWasiProcess(init, port3) {
8119
8134
  publishMemory(init.sab, sizeOf(main)());
8120
8135
  signals.bind(instance.exports);
8121
8136
  host.onRaise = (sig) => signals.raised(sig);
8137
+ host.muted = (fd, data) => signals.muted(fd, data);
8122
8138
  const exports = instance.exports;
8123
8139
  driver.bind(instance.exports);
8124
8140
  try {