Skip to content

Trends/Signals scans off the UI thread + Signals chart UX fixes#28

Merged
ozgesolidkey merged 1 commit into
mainfrom
feat/trends-worker-signals-ux
Jun 30, 2026
Merged

Trends/Signals scans off the UI thread + Signals chart UX fixes#28
ozgesolidkey merged 1 commit into
mainfrom
feat/trends-worker-signals-ux

Conversation

@ozgesolidkey

Copy link
Copy Markdown
Contributor

Trends/Signals run off the main thread

All five trend scans (discover fields, value-over-time, signal series, flips, correlate) ran synchronously on the Electron main process, blocking the event loop on big files → the panel looked frozen. Moved them into a worker thread (mirrors the existing MF4 worker fix).

  • src/main/trendWorker.ts — runs the trend engine in a worker_thread with its own fd, reading the same bytes via a byte-offset index from the main process.
  • src/main/trendWorkerClient.tsrunTrendJob() builds the index snapshot and transfers it zero-copy (ArrayBuffer transfer) to the worker.
  • FileHandler.getScanContext() — exports the line-offset index as typed arrays.
  • src/main/timestampParse.tsparseTimestampFast extracted to a shared module so main and the worker parse identically.
  • Both the IPC handlers and the agent/MCP ApiContext methods now await the worker → main/UI loop stays responsive.

Signals chart UX fixes

  • formatAxisNum SI-suffix formatter → big timestamps read as 57.3G, not 5.73e+10 (x ticks, band min/max, overlay y-axis, hover readout).
  • Clearer x-axis: 5 ticks + tick marks + faint vertical gridlines, edge-aligned labels.
  • Click pins a sample: floating value box (x + every signal value w/ color swatch) persists after the mouse leaves; solid line = pinned, dashed = hover.
  • Robust click-to-line: nearestViewerLine() searches outward across all signals so downsampled empty buckets still navigate to the log.

Build green; 319/319 tests pass; compiled worker verified end-to-end on a fixture. .mcp.json intentionally excluded.

🤖 Generated with Claude Code

Trends/Signals off-thread:
- All five trend scans (discover fields, value-over-time, signal series,
  flips, correlate) ran synchronously on the Electron main process, blocking
  the event loop on large files so the panel appeared frozen. Move them into
  a worker thread.
- New src/main/trendWorker.ts runs the trend engine in a worker_thread with
  its own fd, reading the same bytes via a byte-offset index handed over from
  the main process (zero-copy ArrayBuffer transfer).
- New src/main/trendWorkerClient.ts (runTrendJob) builds the index snapshot
  and spawns the worker; FileHandler.getScanContext() exports the index as
  typed arrays.
- src/main/timestampParse.ts: extract parseTimestampFast into a shared module
  so main and the worker parse identically.
- Both the IPC handlers and the agent/MCP ApiContext methods now await the
  worker, keeping the main/UI loop responsive.

Signals chart UX:
- SI-suffix axis/label formatter (formatAxisNum) so big timestamps read as
  "57.3G" instead of "5.73e+10"; applied to x ticks, band min/max, overlay
  y-axis, and the hover readout.
- Clearer x-axis: 5 ticks with tick marks + faint vertical gridlines,
  edge-aligned end labels.
- Click pins a sample: a floating value box (x + every signal value with
  color swatches) stays after the mouse leaves; solid line = pinned, dashed
  = live hover.
- Robust click-to-line: nearestViewerLine() searches outward across all
  signals so downsampled empty buckets still navigate to the log.

Build green; 319 tests pass; compiled worker verified end-to-end on a fixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ozgesolidkey
ozgesolidkey merged commit 6672f5e into main Jun 30, 2026
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