Skip to content

Commit 40624d5

Browse files
refactor: archive topo2d.js — tested but not wired to index.html (janitor F2)
topo2d.js is moved to archive/topo2d/ along with its unit test. It had 71.29% mutation score at time of archive but production index.html never instantiated EEGTopo2D — F2 from the 2026-05-20 janitor dead-code audit. Stryker mutate scope updated. Aggregate moves from 40.70% → 35.32% (topo2d was dragging it up by ~5pp). Threshold: lowered break 38 → 30. archive/topo2d/README.md documents the restore procedure if a future PR wires topo2d into the viewer's metadata overlay.
1 parent 0bfe747 commit 40624d5

6 files changed

Lines changed: 85 additions & 11 deletions

File tree

archive/topo2d/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# topo2d.js — archived 2026-05-21
2+
3+
This module implements an MNE/EEGLAB-style 2D EEG topographic map
4+
renderer. It has full unit-test coverage (71.29% mutation score at
5+
time of archive) and works as designed when instantiated.
6+
7+
It is archived rather than deleted because production `index.html`
8+
never instantiated `EEGTopo2D` — the wiring is incomplete on the
9+
viewer side (there's no overlay slot, no controller that calls
10+
`Topo2D.init()`). Janitor finding F2 in the 2026-05-20 dead-code
11+
audit flagged this.
12+
13+
## Restoring
14+
15+
If a future PR wires topo2d into the viewer UI:
16+
17+
1. `git mv archive/topo2d/topo2d.js ./topo2d.js`
18+
2. `git mv archive/topo2d/unit-topo2d.test.mjs tests/unit-topo2d.test.mjs`
19+
3. Add `<script src="topo2d.js?v=1"></script>` to `index.html` between
20+
`traces.js` and `viewer.js`.
21+
4. Add the integration code in viewer.js — minimum: a metadata-overlay
22+
slot that calls `EEGTopo2D.init(containerEl)` and `setMontage()` /
23+
`setSelected()` on channel selection.
24+
5. Re-add to `stryker.conf.json`'s mutate list and commandRunner.
25+
26+
The original tests still pass against the archived file:
27+
28+
```bash
29+
node --test archive/topo2d/unit-topo2d.test.mjs
30+
```
File renamed without changes.

docs/mutation-survivors-2026-05.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,3 +1122,48 @@ Neither is on the current Tier 1+2+3 plan; both are documented as
11221122
catching REGRESSIONS in the existing 4 well-mutated files (traces,
11231123
filters, topo2d, bids-recording), not in the placeholder floors for
11241124
viewer + worker.
1125+
1126+
## Iteration 13 (T11, 2026-05-21) — topo2d archived
1127+
1128+
Janitor F2 closure: `topo2d.js` was moved to `archive/topo2d/` along
1129+
with its unit test. The module had a high mutation score (71.29%) but
1130+
was never instantiated by production `index.html` — wiring the
1131+
controller into a metadata-overlay slot is UX work that's out of
1132+
scope for the Tier 1+2+3 maturation plan. See
1133+
`archive/topo2d/README.md` for the restore procedure.
1134+
1135+
### Per-file results (fresh baseline, 3604 mutants, ~18 min runtime)
1136+
1137+
| File | iter-12 | iter-13 | Δ |
1138+
|---|---:|---:|---:|
1139+
| traces.js | 66.71% | 66.71% ||
1140+
| filters.js | 92.37% | 92.37% ||
1141+
| topo2d.js | 71.29% | (archived) | n/a |
1142+
| bids-recording.js | 76.14% | 74.24% | −1.90 (sampling) |
1143+
| viewer.js | 0.64% | 0.64% ||
1144+
| worker.js | 4.56% | 4.56% ||
1145+
| **Aggregate** | 40.70% | **35.32%** | **−5.38** |
1146+
1147+
### Why the aggregate dropped 5.38pp
1148+
1149+
`topo2d.js` was carrying 613 mutants at 71.29% — well above the
1150+
aggregate. Removing it drops the high-scoring contribution while
1151+
leaving the low-scoring floors (viewer 0.64%, worker 4.56%) at full
1152+
weight. The 5pp drop is arithmetic, not a regression: per-file
1153+
scores for the four remaining real-tested files (traces, filters,
1154+
bids-recording, worker) are unchanged within sampling noise.
1155+
1156+
bids-recording's small dip (76.14 → 74.24) is sampling noise from
1157+
Stryker's non-deterministic mutant ordering; no test or source
1158+
changes were made.
1159+
1160+
### Threshold: lowered 38 → 30
1161+
1162+
Per the documented decision tree: aggregate (35.32%) is below the
1163+
current break (38), so lower to `aggregate − 5 = 30`. This is NOT a
1164+
regression in the actual code — the gate is recalibrated for the
1165+
narrower scope (5 files: traces, filters, bids-recording, viewer,
1166+
worker). The per-file scores for the well-tested files remain the
1167+
durable measurement.
1168+
1169+
low threshold also lowered: 42 → 34 (mirrors the previous gap).

stryker.conf.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
{
22
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
3-
"_comment": "Mutation testing config — see docs/qa-strategy.md § Mutation testing. Scope (v4): traces.js (render path) + filters.js (signal processing) + topo2d.js (electrode-position layout) + bids-recording.js (metadata loader) + viewer.js (JSDOM smoke + partial pure-logic coverage) + worker.js (self-shim smoke + protocol re-implementation harness). Per-file scores are the durable measurement; aggregate is informational.",
3+
"_comment": "Mutation testing config — see docs/qa-strategy.md § Mutation testing. Scope (v5): traces.js (render path) + filters.js (signal processing) + bids-recording.js (metadata loader) + viewer.js (JSDOM smoke + partial pure-logic coverage) + worker.js (self-shim smoke + protocol re-implementation harness). topo2d.js was archived 2026-05-21 (janitor F2, not wired into index.html). Per-file scores are the durable measurement; aggregate is informational.",
44
"packageManager": "npm",
55
"reporters": ["html", "clear-text", "progress", "json"],
66
"testRunner": "command",
77
"commandRunner": {
8-
"command": "node --test tests/unit-traces-draw.test.mjs tests/unit-traces-partial-fill.test.mjs tests/unit-traces-nice-round.test.mjs tests/unit-traces-time-axis.test.mjs tests/unit-traces-scalebar-axis.test.mjs tests/traces.test.mjs tests/unit-filters.test.mjs tests/unit-topo2d.test.mjs tests/unit-bids-recording.test.mjs tests/unit-bids-recording-assemble.test.mjs tests/unit-viewer-jsdom.test.mjs tests/unit-viewer-render-loop.test.mjs tests/unit-viewer-races.test.mjs tests/unit-worker-jsdom.test.mjs tests/unit-worker-protocol.test.mjs tests/unit-worker-faults.test.mjs tests/unit-worker-cache.test.mjs tests/unit-worker-races.test.mjs"
8+
"command": "node --test tests/unit-traces-draw.test.mjs tests/unit-traces-partial-fill.test.mjs tests/unit-traces-nice-round.test.mjs tests/unit-traces-time-axis.test.mjs tests/unit-traces-scalebar-axis.test.mjs tests/traces.test.mjs tests/unit-filters.test.mjs tests/unit-bids-recording.test.mjs tests/unit-bids-recording-assemble.test.mjs tests/unit-viewer-jsdom.test.mjs tests/unit-viewer-render-loop.test.mjs tests/unit-viewer-races.test.mjs tests/unit-worker-jsdom.test.mjs tests/unit-worker-protocol.test.mjs tests/unit-worker-faults.test.mjs tests/unit-worker-cache.test.mjs tests/unit-worker-races.test.mjs"
99
},
1010
"coverageAnalysis": "off",
1111
"mutate": [
1212
"traces.js",
1313
"filters.js",
14-
"topo2d.js",
1514
"bids-recording.js",
1615
"viewer.js",
1716
"worker.js"
@@ -31,8 +30,8 @@
3130
"incrementalFile": "reports/stryker-incremental.json",
3231
"thresholds": {
3332
"high": 80,
34-
"low": 42,
35-
"break": 38
33+
"low": 34,
34+
"break": 30
3635
},
3736
"timeoutMS": 60000,
3837
"concurrency": 4

tests/unit-api-surface.test.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ const EXPECTED = {
7575
'lastTotalChannels',
7676
'meanStd',
7777
],
78-
// topo2d.js exports via `window.EEGTopo2D = api` only — no
79-
// module.exports fallback. Same export-pattern bug as fiff.js had
80-
// pre-c57dc88. Documented as janitor F2 (file loaded by tests but
81-
// NOT by production index.html). When F2 is decided (wire in or
82-
// archive), add topo2d back to this snapshot OR remove from
83-
// tests/unit-topo2d.test.mjs.
78+
// topo2d.js was archived 2026-05-21 to archive/topo2d/topo2d.js
79+
// (janitor F2 closure — file was tested but never instantiated by
80+
// production index.html). If a future PR wires topo2d into the
81+
// viewer UI, restore per archive/topo2d/README.md and re-add the
82+
// entry here. The original export pattern (window.EEGTopo2D = api,
83+
// no module.exports fallback) was the same as fiff.js pre-c57dc88.
8484
'../bids-loader.js': [
8585
'parseCoordsystem',
8686
'parseElectrodesTSV',

0 commit comments

Comments
 (0)