supercov 4.29.8 → 4.29.10

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/docs/cli.md CHANGED
@@ -1124,6 +1124,16 @@ one command measured on different machines and copied into one
1124
1124
  `.supercov/runs` replace none of each other: each is a share of the suite, and
1125
1125
  all are merged.
1126
1126
 
1127
+ A test whose records two runs hold byte for byte alike, once each run's id is
1128
+ the merge's, is kept once, from the first run, and so are an entry's records
1129
+ of no test (a server's background): a run made from another without measuring
1130
+ (a continuation round's shard) adds nothing to them, and the merge says how
1131
+ many copies it kept once (`3402 copy(ies) of records that an earlier run held
1132
+ byte for byte kept once, from that run`). A copy that differs in anything, a
1133
+ timestamp, a path the test took, an outcome, is kept beside the others, so
1134
+ nothing any run recorded is lost. Jobs that each measured the whole suite
1135
+ record each test with times of their own, and keep a copy each.
1136
+
1127
1137
  The runs may differ in their tests, the helpers beside them, and the test
1128
1138
  runners' settings, as long as nothing that changed reaches what an earlier
1129
1139
  run's tests did. Measuring a new test alone and adding it to the runs before it
package/docs/mutation.md CHANGED
@@ -210,6 +210,11 @@ npx supercov mutants --diff origin/main --format markdown --output mutants.md
210
210
  it has the mutation score and lists the survivors. `supercov mutants` takes
211
211
  `--format markdown` and `--output <file>` too, and writes its own answer
212
212
  that way.
213
+ - A survivor that only changes a log line (its change lies wholly inside the
214
+ arguments of `console.*`, or of a method named `info`, `warn`, `error`,
215
+ `debug`, `trace` or `log`) is still `survived`, but marked `(only changes a
216
+ log line)` (`logOnly` in JSON) and counted on its own: `survived 185 (109
217
+ only change a log line)`. Triage can set those aside.
213
218
  - `--fail-on` exits `1` when a mutant asked about has one of the statuses
214
219
  given. On `runs latest mutants` they are weak statuses, from the run alone;
215
220
  on `supercov mutants` and `mutants test` they are verdicts: `survived`,
@@ -435,7 +440,12 @@ no mutants shows none of this.
435
440
  stopping at its first failing test.
436
441
  - **Playwright** carries each test's mutant with its requests, so one server
437
442
  serves different mutants to different workers. A mutant of a server's
438
- start-up runs with the server started again for it. StrykerJS has no
443
+ start-up runs with the server started again for it. A mutant in a
444
+ module-level object or array literal (a translation table, a menu) runs
445
+ against the tests that read its value, which a run measured with the
446
+ mutants' probes records, not every test whose server loaded the module;
447
+ the plan says how many were narrowed and by how much
448
+ (`docs/design/strong-mutation.md`, Module-level values). StrykerJS has no
439
449
  Playwright runner, so Playwright's verdicts are checked by hand (see below).
440
450
  A test run with a mutant gets StrykerJS's time limit: its baseline (the
441
451
  longest of its measured run and its runs without a mutant in the pass)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.29.8",
3
+ "version": "4.29.10",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -97,7 +97,7 @@
97
97
  "benchmark:check": "cargo build --release -p supercov && node scripts/rust-transform-benchmark.mjs",
98
98
  "benchmark:python": "cargo build -p supercov && node scripts/python-benchmark.mjs",
99
99
  "check": "npm run check:lint && npm run check:tests",
100
- "check:lint": "cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings",
100
+ "check:lint": "node scripts/check-fault-sites.mjs && cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings",
101
101
  "check:tests": "npm run test && npm run check:tooling",
102
102
  "check:tooling": "npm run test:release-tooling && npm run test:runtime && npm run test:action && npm run test:rust-assets && npm run test:agent-commands && npm run test:assertions && npm run test:sweep-target && npm run test:skip-guard && npm run test:windows-tls && node scripts/package-preflight.mjs && node scripts/verify-binstall-metadata.mjs --offline",
103
103
  "release:check": "cargo clean && node scripts/sweep-target.mjs && npm run check && npm run test:engine && npm run test:go && npm run test:jvm && npm run test:launcher && npm run test:fixture && npm run test:watchdog && npm run test:engine-contract && npm run test:agent && npm run test:child-attribution && npm run test:host-loader && npm run test:python && npm run test:ruby-coverage && npm run test:rust-public-cargo && npm run test:packed-npx && npm run test:clang-mcdc && npm run benchmark:check",
@@ -125,14 +125,14 @@
125
125
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
126
126
  },
127
127
  "optionalDependencies": {
128
- "@supercov/cli-darwin-arm64": "4.29.8",
129
- "@supercov/cli-darwin-x64": "4.29.8",
130
- "@supercov/cli-linux-arm64-gnu": "4.29.8",
131
- "@supercov/cli-linux-arm64-musl": "4.29.8",
132
- "@supercov/cli-linux-x64-gnu": "4.29.8",
133
- "@supercov/cli-linux-x64-musl": "4.29.8",
134
- "@supercov/cli-win32-arm64": "4.29.8",
135
- "@supercov/cli-win32-x64": "4.29.8"
128
+ "@supercov/cli-darwin-arm64": "4.29.10",
129
+ "@supercov/cli-darwin-x64": "4.29.10",
130
+ "@supercov/cli-linux-arm64-gnu": "4.29.10",
131
+ "@supercov/cli-linux-arm64-musl": "4.29.10",
132
+ "@supercov/cli-linux-x64-gnu": "4.29.10",
133
+ "@supercov/cli-linux-x64-musl": "4.29.10",
134
+ "@supercov/cli-win32-arm64": "4.29.10",
135
+ "@supercov/cli-win32-x64": "4.29.10"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@playwright/test": ">=1.55.0",
@@ -31,7 +31,8 @@
31
31
  // with every request (header, cookies, child processes) and the page through
32
32
  // an init script. A mutant the server must start with (its code ran in work
33
33
  // no request named, or is a server module's top level, or ran for a request
34
- // that named no test) is run alone afterwards, in an invocation of its own
34
+ // that named no test, or its switch is evaluated as a server module loads)
35
+ // is run alone afterwards, in an invocation of its own
35
36
  // with SUPERCOV_ACTIVE_MUTANT set, which the engine starts for each `restart`
36
37
  // record the judge writes (javascript_run.rs). So do a kill (or a timeout)
37
38
  // that ran beside another mutant's attempt or whose control failed (one test
@@ -384,8 +385,13 @@ function buildPass(pass, root, config) {
384
385
  const infected = [...new Set(own.filter((test) => test.infected).map((test) => test.id))];
385
386
  const ordered = [...new Set(own.map((test) => test.id))];
386
387
  const switched = `${mutant.file}#${found.index}`;
387
- if (mutant.serverWide) {
388
- restarts.push({ id: mutant.id, mutant: switched, tests: ordered, reason: mutant.serverWide });
388
+ // A switch the copy evaluates as its module loads (an arrow
389
+ // mutated whole at a module's top level), in a module a server
390
+ // ran: the server made the original once, for every request,
391
+ // whatever mutant a request names.
392
+ const serverWide = mutant.serverWide ?? (found.entry.static && mutant.serverRan ? "module-level" : undefined);
393
+ if (serverWide) {
394
+ restarts.push({ id: mutant.id, mutant: switched, tests: ordered, reason: serverWide });
389
395
  continue;
390
396
  }
391
397
  mutants.push({ id: mutant.id, mutant: switched, tests: ordered, infected });
@@ -2346,6 +2346,17 @@ function registerProbeV2(definition) {
2346
2346
  none: optionalCallEmptySpread
2347
2347
  };
2348
2348
  rememberProbeV2File(file);
2349
+ // The module registering is loading until its top level ends: see trackV2.
2350
+ try {
2351
+ markModuleLoading(file);
2352
+ } catch {
2353
+ }
2354
+ file.loaded = () => {
2355
+ try {
2356
+ valueReadState().loading.delete(file);
2357
+ } catch {
2358
+ }
2359
+ };
2349
2360
  // What a probe calls: this file's hit, by place alone. Outside a loop the
2350
2361
  // probe is the call alone and this makes its check, so it stays small
2351
2362
  // enough for V8 to inline where the code is hot. The epoch is NaN wherever
@@ -2725,6 +2736,174 @@ function valueV2(site, value) {
2725
2736
  }
2726
2737
  return value;
2727
2738
  }
2739
+ // Module-level values (docs/design/strong-mutation.md, "Module-level
2740
+ // values"). An object or array literal a module's top level makes, holding a
2741
+ // module-level mutant, is read through a proxy: each read is a hit of a point
2742
+ // of the literal -- one for any read, one for each key a mutant is under --
2743
+ // credited as every hit is, to the test whose work read it. A read while a
2744
+ // module loads is a hit of the literal's other points, its escapes: what that
2745
+ // read took (a copy, a lookup table built from it) outlives the read, and the
2746
+ // plan then takes every test that loaded the module, as without the proxies.
2747
+ // The state is on the global object, so copies of this runtime in one realm
2748
+ // agree on whether a module is loading.
2749
+ const valueReadStateKey = Symbol.for("supercov.valueReads");
2750
+ const capturedQueueMicrotask = typeof queueMicrotask === "function" ? queueMicrotask : void 0;
2751
+ function valueReadState() {
2752
+ let reads = globalThis[valueReadStateKey];
2753
+ if (reads === void 0) {
2754
+ reads = { loading: /* @__PURE__ */ new Set(), resetQueued: false, targets: /* @__PURE__ */ new WeakMap(), cloneWrapped: false };
2755
+ try {
2756
+ Object.defineProperty(globalThis, valueReadStateKey, { __proto__: null, value: reads, configurable: true });
2757
+ } catch {
2758
+ return reads;
2759
+ }
2760
+ }
2761
+ return reads;
2762
+ }
2763
+ // A module is loading from its registration, the first thing its code does,
2764
+ // to the end of its top level, where it calls its file's `loaded()`. One that
2765
+ // throws there never gets to it: no module is loading once the code that
2766
+ // loaded it gives up the thread, as module graphs evaluate synchronously, and
2767
+ // the first microtask after runs once they are done. A module's top-level
2768
+ // await gives it up too, and `resumeV2` marks it loading again where it
2769
+ // resumes.
2770
+ function markModuleLoading(file) {
2771
+ const reads = valueReadState();
2772
+ reads.loading.add(file);
2773
+ if (reads.resetQueued)
2774
+ return;
2775
+ reads.resetQueued = true;
2776
+ const reset = () => {
2777
+ reads.loading.clear();
2778
+ reads.resetQueued = false;
2779
+ };
2780
+ if (capturedQueueMicrotask !== void 0)
2781
+ capturedQueueMicrotask(reset);
2782
+ else
2783
+ Promise.resolve().then(reset);
2784
+ }
2785
+ function resumeV2(file, value) {
2786
+ try {
2787
+ markModuleLoading(file);
2788
+ } catch {
2789
+ }
2790
+ return value;
2791
+ }
2792
+ // `file`'s points from `base`: any read, any read while loading, then a read
2793
+ // and a read while loading for each of `keys`.
2794
+ function trackV2(file, base, keys, value) {
2795
+ if (value === null || typeof value !== "object" && typeof value !== "function")
2796
+ return value;
2797
+ let reads;
2798
+ try {
2799
+ reads = valueReadState();
2800
+ wrapStructuredClone(reads);
2801
+ } catch {
2802
+ return value;
2803
+ }
2804
+ const places = /* @__PURE__ */ new Map();
2805
+ for (let place = 0; place < keys.length; place += 1)
2806
+ places.set(keys[place], place);
2807
+ const note = (key) => {
2808
+ try {
2809
+ const place = typeof key === "string" ? places.get(key) : void 0;
2810
+ const loading = reads.loading.size > 0 ? 1 : 0;
2811
+ file.hit(base + loading);
2812
+ if (place !== void 0)
2813
+ file.hit(base + 2 + 2 * place + loading);
2814
+ } catch {
2815
+ }
2816
+ };
2817
+ const proxy = new Proxy(value, {
2818
+ __proto__: null,
2819
+ get(target, key, receiver) {
2820
+ note(key);
2821
+ return Reflect.get(target, key, receiver);
2822
+ },
2823
+ has(target, key) {
2824
+ note(key);
2825
+ return Reflect.has(target, key);
2826
+ },
2827
+ getOwnPropertyDescriptor(target, key) {
2828
+ note(key);
2829
+ return Reflect.getOwnPropertyDescriptor(target, key);
2830
+ },
2831
+ ownKeys(target) {
2832
+ note(void 0);
2833
+ return Reflect.ownKeys(target);
2834
+ },
2835
+ set(target, key, assigned, receiver) {
2836
+ note(key);
2837
+ return Reflect.set(target, key, assigned, receiver === proxy ? target : receiver);
2838
+ },
2839
+ defineProperty(target, key, descriptor) {
2840
+ note(key);
2841
+ return Reflect.defineProperty(target, key, descriptor);
2842
+ },
2843
+ deleteProperty(target, key) {
2844
+ note(key);
2845
+ return Reflect.deleteProperty(target, key);
2846
+ }
2847
+ });
2848
+ reads.targets.set(proxy, value);
2849
+ return proxy;
2850
+ }
2851
+ // structuredClone refuses a proxy. A value the program clones, which holds
2852
+ // a tracked literal, is cloned as a copy read through it: every value the
2853
+ // clone holds is read, as the clone reads it without the proxies.
2854
+ function wrapStructuredClone(reads) {
2855
+ if (reads.cloneWrapped)
2856
+ return;
2857
+ reads.cloneWrapped = true;
2858
+ const native = globalThis.structuredClone;
2859
+ if (typeof native !== "function")
2860
+ return;
2861
+ const cloning = function structuredClone(value, options) {
2862
+ try {
2863
+ return arguments.length > 1 ? native(value, options) : native(value);
2864
+ } catch (error) {
2865
+ const copies = /* @__PURE__ */ new Map();
2866
+ let held = false;
2867
+ const copy = (inner) => {
2868
+ if (inner === null || typeof inner !== "object")
2869
+ return inner;
2870
+ if (copies.has(inner))
2871
+ return copies.get(inner);
2872
+ const tracked = reads.targets.has(inner);
2873
+ held || (held = tracked);
2874
+ if (!tracked && !Array.isArray(inner) && Object.getPrototypeOf(inner) !== Object.prototype && !(inner instanceof Map) && !(inner instanceof Set))
2875
+ return inner;
2876
+ if (inner instanceof Map) {
2877
+ const made2 = /* @__PURE__ */ new Map();
2878
+ copies.set(inner, made2);
2879
+ for (const [key, entry] of inner)
2880
+ made2.set(copy(key), copy(entry));
2881
+ return made2;
2882
+ }
2883
+ if (inner instanceof Set) {
2884
+ const made2 = /* @__PURE__ */ new Set();
2885
+ copies.set(inner, made2);
2886
+ for (const entry of inner)
2887
+ made2.add(copy(entry));
2888
+ return made2;
2889
+ }
2890
+ const made = Array.isArray(inner) ? new Array(inner.length) : {};
2891
+ copies.set(inner, made);
2892
+ for (const key of Object.keys(inner))
2893
+ made[key] = copy(inner[key]);
2894
+ return made;
2895
+ };
2896
+ const unwrapped = copy(value);
2897
+ if (!held)
2898
+ throw error;
2899
+ return arguments.length > 1 ? native(unwrapped, options) : native(unwrapped);
2900
+ }
2901
+ };
2902
+ try {
2903
+ Object.defineProperty(globalThis, "structuredClone", { __proto__: null, value: cloning, writable: true, configurable: true, enumerable: false });
2904
+ } catch {
2905
+ }
2906
+ }
2728
2907
  // Strong mutation (mutant schemata). A file instrumented in strong mode has
2729
2908
  // every listed mutant behind a switch and reads one record from here when
2730
2909
  // it loads, `strongSlot(file)`, with `file` its path from the project root
@@ -3445,6 +3624,8 @@ const directRuntimeApi = {
3445
3624
  assignV2,
3446
3625
  methodV2,
3447
3626
  valueV2,
3627
+ trackV2,
3628
+ resumeV2,
3448
3629
  strongSlot,
3449
3630
  setActiveMutant,
3450
3631
  clearActiveMutant,
@@ -3527,6 +3708,8 @@ export {
3527
3708
  assignV2,
3528
3709
  methodV2,
3529
3710
  valueV2,
3711
+ trackV2,
3712
+ resumeV2,
3530
3713
  strongSlot,
3531
3714
  setActiveMutant,
3532
3715
  clearActiveMutant,