Skip to content

Fix iEEG spatial validation e2e on the epic - #605

Merged
neuromechanist merged 3 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/issue-604-ieeg-e2e
Nov 26, 2026
Merged

neuromechanist merged 3 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/issue-604-ieeg-e2e

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #604

Part of #588 (epic nemarOrg/nemar-cli#2324)

Root cause

No epic phase is involved. The spec is stale against the data plane: the same tests fail on origin/staging (b53ffd0, the epic's base, with none of the epic's commits), 3 failures there against 4 on the epic head, so there was nothing to bisect. Since ADR 0034 (subject anatomy, merged 2026-11-19, after these tests were last updated), the Brain panel opens on "This subject's anatomy" whenever the dataset's geometry index has an entry for the electrodes file shown, and then data-template-state reports ready for the subject's own surface. The geometry pipeline uploaded geometry/index.json for on005415 (Last-Modified 2026-11-21 19:27 GMT, sub-72 ACPC listed) and on004473 (2026-11-21 19:24 GMT, sub-1 ACPC listed, sub-1 ScanRAS skipped). The failing runs show it: the panel's label reads "This subject's anatomy, from the dataset's own surfaces; approximate alignment (depth contacts)", and on004473's notes start with "Subject surfaces: derivatives/freesurfer-7.3.2/sub-1/surf/lh.pial, ...".

The varying failure count is a race on the network: the index is fetched when the panel opens, so a none assertion made before the index answers passes, and one made after it fails (the dark-theme run passed on staging; on the epic, on004473 got past the "No brain surface" note and then failed the contacts-only ink check once the subject mesh had been drawn). The "landing fetch failed: upstream_error" log line is unrelated; it did not appear in these runs.

Fix

The new behavior is correct per ADR 0034 (decision 1: the subject's anatomy is the default for that file; decision 2: it is drawn in the contacts' own frame and the template is never loaded), so the spec now asserts it rather than the old default. A new helper, leaveSubjectAnatomy, waits for the subject surface to be ready (which also removes the race), checks the selected option, the subject label and the "Subject surfaces" note, then selects the frame itself. Every original assertion is kept unchanged after that: data-template-state none, the hidden template box, the "No brain surface" sentence, contacts only by ink share, no request for the vendored template's mesh or outlines (checked over the whole test, so it also covers the subject default), and the theme contrast checks. on004473's frame list now expects ["ACPC", "ACPC: Subject anatomy", "ScanRAS"]. No source change.

Testing

  • bun run lint, bun run typecheck (0 errors), bunx vitest run src/lib/ieeg-spatial (642 passed)
  • e2e on a dedicated dev server (port 4613), PUBLIC_DATA_BASE_URL=https://data.nemar.org: ieeg-spatial-validation (29 passed), ieeg-subject-anatomy (4), viewer-scalp-map (3), quality-panel (33), ieeg-spatial-panel (28 passed when run alone; in the combined two-worker run one test timed out waiting for the Zarr host to go quiet, a network wait, and passed on the rerun)
  • Before the change: the 4 targeted tests fail on the epic head and 3 on origin/staging

Agentic AI tools were used in preparing this PR.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 97781c1
Status: ✅  Deploy successful!
Preview URL: https://970328ec.nemar-website.pages.dev
Branch Preview URL: https://fix-issue-604-ieeg-e2e.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit c441d5d into feature/issue-586-epic-pipeline-progress Nov 26, 2026
3 of 4 checks passed
@neuromechanist
neuromechanist deleted the fix/issue-604-ieeg-e2e branch November 26, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant