Skip to content

Electron desktop prototype over the CLI, plus timeline, motion and test-corpus fixes - #2

Merged
ShankhanilSaha merged 6 commits into
mainfrom
feat/desktop-prototype
Sep 19, 2026
Merged

ShankhanilSaha merged 6 commits into
mainfrom
feat/desktop-prototype

Conversation

@ShankhanilSaha

Copy link
Copy Markdown
Owner

Summary

A working desktop prototype for SPECTRA, and fixes for four problems found while reviewing
the repo against the docs. The app covers the pre-selection demo scope (doc 8 §3.4) end to
end: new case → documents & custody → evidence → identify → parse → time model → recover →
timeline → analytics → export & play → report.

What's in it

Desktop app — desktop/ (Electron + React + TypeScript)

  • One screen per doc 7 §4 step, plus Settings and a Command Log.
  • No forensic logic in the UI. Every action runs python -m spectra.cli … --json as a
    child process, from a fixed argument list built in the main process. Each click is
    therefore an audited command anyone can re-run, and the Command Log shows each one.
  • Locked down to keep the offline, read-only rules:
    • sandboxed renderer with context isolation;
    • loads only spectra-app:// (the UI) and spectra-media://, which serves stored clips
      from the open case by SHA-256 only;
    • every other request is cancelled, and no hostname resolves;
    • no dev server, so nothing listens on a socket;
    • the window never opens evidence itself.
  • Highlights: identification with the matched bytes shown; the timeline on the UTC axis
    with uncertainty and all-channel gaps; a player for the verified evidence MP4; §7
    negative findings; the s. 63(4) certificate preview; live audit-chain status.

CLI (72b5aa8)

  • --json on the ten commands the app drives that lacked it.
  • New read-only commands, which write no audit record: identify show and list artifacts.

Fixes

  • 811e2ae Motion analysis gave different results depending on whether OpenCV was
    installed.
    • The two code paths disagreed at the threshold and on small patches of change.
    • Now there is one rule, and a parity test holds the two paths to it.
    • New ml extra (OpenCV + NumPy), installed in CI.
  • **b951682 A clock change produced a recording that ended before it started, and
    spectra gaps cra
    • The timeline and gap analysis keep such recordings off the axis and list them.
  • 52de8d4 Test-corpus answer files.
    • S-03 recorded a surviving range of −13,086 bytes.
    • S-10's ambiguity test only passed by swapping in a fake Hikvision plugin; it is now a
      strict xfail with the real plugins.
    • Added: an S-08 check, and checks that every recorded range is real and that the
      checked-in answer files match the generator.

Docs & setup (64220eb, b1f33f5)

  • requirements.txt, and README instructions to run the engine and the app, including
    under a Windows AllSigned execution policy.
  • Docs 1, 2, 3 and 8 and CLAUDE.md §17 (items 22–26) updated.

Decisions for reviewers

  • Electron replaces the planned PySide6 shell. This changes a documented decision;
    doc 3 §16 now records why. ui/ becomes desktop/ (P5).
  • The 2 s split threshold is a policy, not a format fact. It assumes at least 1
    frame/s. A slower stream splits frame by frame, with a note on each split, rather than
    getting a false time span. (P2)
  • findings.json gains a new anomaly kind. This changes the P5 contract.
  • The timeline change touches the P4 area. gap_report gains not_placed, which
    lists every recording the gap figures don't cover.

Testing

  • Test suite at every commit: 464 → 472 → 476 → 477 passed. Final: 477 passed, 6 skipped
    (no pyewf wheel for Python 3.14; no real-hardware time vectors), 1 xfailed (S-10). Ruff
    clean.
  • New tests fail on the old code and pass on the new.
  • End-to-end: a 26-step Playwright run through the real app on Windows 11, from an
    empty screen to the report, and a tamper check that names the altered audit record.
    Native file dialogs were answered by the script. The script is not in this PR.
  • Not tested: Linux/macOS, PDF output, T4, selecting between ambiguous candidates,
    exporting a copy to a folder.
  • CI has not been confirmed on GitHub yet.

Known limitations

  • Hikvision recordings parse but can't be exported or played: frames() doesn't strip
    PES headers or set frame timing. Engine gap; next up.
  • Raw Dahua disks are carve-only until the layout is verified on hardware.
  • No installer yet (NFR-15). Acquisition, live capture, firmware import and object/face
    analytics appear disabled and labelled.
  • Analytics shows the model name and disclaimer as fixed text in the UI. The stored
    annotations carry the engine's own values.

The OpenCV path kept pixels strictly above the sensitivity and dropped small
contours; the pure-Python path counted pixels at or above it and boxed every
changed pixel. The same recording gave different hits depending on installed
packages (NFR-08, AC-11). CI never saw it because CI had no OpenCV.

- One rule for both paths: changed when |delta| >= sensitivity, box around every
  changed pixel, ROI clipped to the frame; a parity test enforces it.
- Fix the threshold test, which compared a delta of 50, not the 80 it claimed.
- New `ml` extra (OpenCV + NumPy), installed in CI so the parity test runs.
- Motion spec description no longer claims blur and morphological closing.
…before it starts

A .dav file spanning a clock set back 2 h (Tier S S-08) parsed as one recording
running 14:00 -> 12:00 at confidence 1.0; `spectra gaps` crashed on it, and so
would `spectra timeline` once an offset was set.

- Dahua (plugin 0.2.0): split a channel where its device time steps back or
  jumps forward more than 2 s, with a note on both sides; note segments that
  do not start on an I-frame.
- New FR-55 anomaly `ends_before_start` (NF-TIME-ENDS-BEFORE-START); inverted
  items are excluded from the overlap check.
- Gap analysis and correlation keep inverted recordings off the axis and list
  them; gap_report gains `not_placed`, which also covers items with no time.
…lugin

- S-03 listed a surviving range of -13086 bytes: the 16 KiB overwrite runs past
  its 5378-byte recording. Survivors are now computed as the recording minus
  the overwrite (image bytes and hashes unchanged).
- S-10's ambiguity test swapped in a stand-in Hikvision plugin. It now runs the
  shipping registry as a strict xfail (Tier S / published layout conflict).
- New: S-08 split against its oracle, every oracle range is a real span of its
  image, and checked-in oracles match the generator.
- --json on case new/attach/custody, import image/files, identify select,
  parse, export clip, time set and report generate.
- `identify show`: the stored identification, read-only, not audited.
- `list artifacts`: stored artefacts with digests and store paths.
- `gaps` lists the recordings its figures do not account for.
One screen per doc 7 §4 step: case, documents & custody, evidence, identify,
parse, time model, recover, timeline, analytics, review & export, report.

The app holds no forensic logic: every action runs `spectra ... --json` as a
child process from a fixed argv, so each click is an audited command anyone can
re-run (View > Command Log). Sandboxed renderer; loads only its own
spectra-app:// UI and spectra-media:// artefacts (by digest, from the open case);
every other request cancelled, no hostname resolves, no dev server.

Replaces the planned PySide6 shell: docs 1, 2, 3 and 8 and CLAUDE.md §17
item 26 record the decision; ui/ becomes desktop/ (P5). CLAUDE.md §17 items
22-25 record the fixes in the preceding commits.
- requirements.txt installs spectra editable with the dev and ml extras plus a
  development FFmpeg (imageio-ffmpeg); versions stay in pyproject.toml. E01 support
  (libewf) is opt-in because its wheel does not build on Python 3.14.
- README: current status, and how to run the engine and the desktop app on
  Windows (python.exe and npm.cmd called directly, so it works under an AllSigned
  execution policy) and on Linux/macOS, with fixes for the common errors.
- desktop/README.md and CLAUDE.md point at requirements.txt.
@ShankhanilSaha
ShankhanilSaha merged commit c7736dc into main Sep 19, 2026
8 checks passed
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