Skip to content

Viewer abort, share-alike JSON-LD, doc refs - #281

Merged
neuromechanist merged 5 commits into
stagingfrom
fix/viewer-jsonld-docs
Sep 3, 2026
Merged

neuromechanist merged 5 commits into
stagingfrom
fix/viewer-jsonld-docs

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary: three small, independently-scoped fixes bundled into one reviewable PR.

A. eeg-viewer (website#208): openRecording and readWindow now accept an AbortSignal, threaded through every internal zarrita open/get call. mountEegViewer creates one AbortController per mount and registers an abort-only disposer on the slot before the store even opens, so a mount that supersedes another one while it is still awaiting openRecording cancels the in-flight fetch instead of letting it run to completion for a result nobody will use. The same controller is folded into the mount's full destroy(). Aborted reads are treated as benign cancellations: no "Signal unavailable" message, no console warnings, and no state written from a stale request, reusing the existing renderSeq/isStale staleness machinery.

B. jsonld.ts (website#209): conditionsOfAccess() branched only on "noncommercial" and "noderiv", silently dropping the note for a pure share-alike license (CC-BY-SA) even though licenseTier already classifies it as its own "sharealike" tier. Added the missing branch with wording consistent with the existing two.

C. Docs (website#273, part 1): AGENTS.md, .rules/astro.md, and ADR 0004 still cited src/components/BidsDirChildren.astro as the example of Astro's scoped-style-duplication convention, but that file no longer exists. Swapped in a live, verified example that illustrates the same point: SiteNotices.astro and src/pages/admin/notices.astro each declare their own matched notice-tone rules, kept in sync with a comment on each side. Only the example reference changed; ADR 0004's decision text is untouched. Part 2 of #273 (the zarr-index fetch logging) was already done on staging before this PR.

Closes #208
Closes #209
Closes #273

Note: staging is not this repo's default branch, so these Closes lines will not auto-close the issues on merge; they are included for traceability and the issues will be closed by hand after merging, per this repo's AGENTS.md.

Test plan

  • bun run lint (biome check src) — clean on every commit
  • bun run typecheck (astro check) — 0 errors, 0 warnings
  • bun run test (vitest) — 1496 pass, including 3 new abort-propagation tests in store.test.ts (real in-memory fetch stub, real AbortController/AbortSignal, no mocks) and 7 new per-license-tier tests in jsonld.test.ts
  • NEMAR_SKIP_OG_GENERATE=1 bun run build — astro build succeeds (the unskipped build calls the live api.nemar.org to pre-render OG cards, which this sandbox has no network path to; CI has that path so the plain bun run build is what actually runs there)
  • Verified no remaining references to BidsDirChildren.astro outside .context/scratch_history.md, which is an intentionally historical log of a past PR and was left as-is

openRecording and readWindow now accept an AbortSignal, threaded
through every internal zarrita open/get call. mountEegViewer creates
one AbortController per mount, registers an abort-only disposer
before the store even opens (so a superseding mount cancels it while
still in flight), and folds the same controller into the full
destroy(). Aborted reads are treated as benign cancellations: no
"Signal unavailable" message, no console warnings, no state written.

Tested: bun run test (1489 pass, includes 3 new abort tests in
store.test.ts using a real in-memory fetch stub); bun run lint;
bun run typecheck.
conditionsOfAccess() branched only on "noncommercial" and "noderiv",
silently dropping the note for a pure share-alike license (CC-BY-SA)
even though licenseTier already classifies it as its own tier.

Tested: bun run test (1496 pass, includes 7 new license-tier tests
in jsonld.test.ts covering CC-BY, CC-BY-SA, CC-BY-NC, CC-BY-NC-SA,
CC-BY-ND, CC-BY-NC-ND, CC0/PDDL); bun run lint; bun run typecheck.
BidsDirChildren.astro no longer exists in src/components/. Swapped
the three CSS-duplication examples in AGENTS.md, .rules/astro.md,
and ADR 0004 for a live one: SiteNotices.astro and
src/pages/admin/notices.astro each declare their own matched
notice-tone rules, kept in sync with a comment on each side, per
the same scoped-style-duplication convention the stale example
illustrated. Only the example reference changed; ADR decision text
is untouched. scratch_history.md's mentions are a historical record
of a past PR and were left as-is.

Tested: bun run lint; verified no remaining references to
BidsDirChildren.astro outside the historical scratch log.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: bb694dd
Status:⚡️  Build in progress...

View logs

eventsReady's .then() callback wrote store.events/eventTypes, the
legend, and called render() with no disposed check, unlike
watchViewLevels -- a mount torn down while it was in flight could
touch glRenderer after dispose(). Added the same guard.

readOverview had no AbortSignal, so the minimap fetch was never
cancelled on teardown, and loadOverview's only staleness guard
(overviewSeq) wasn't bumped on destroy(), so a late resolution could
write overviewData and touch a detached minimap element. Threaded
signal through readOverview into zarr.get, wired
abortController.signal from loadOverview, and added a disposed
check before loadOverview writes any state.

Tested: bun run test (1497 pass, includes a new readOverview abort
test in store.test.ts using the same in-memory fetch stub pattern
as the other abort tests -- readOverview never rejects, so the test
asserts it resolves to null rather than hanging or throwing);
bun run lint; bun run typecheck.
The "recursive rendering, common rows" framing described the old
BidsTree/BidsDirChildren example, which the previous commit already
replaced with SiteNotices.astro / admin/notices.astro's matched
notice-tone rules -- neither recursive nor row-based. Reworded to
generic "must stay visually matched" language, matching AGENTS.md
and ADR 0004's phrasing from the same PR.

Tested: no code touched; bun run lint still clean.
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