Skip to content

feat(evidence): brand evidence viewer with filters, inspection and pinned search - #143

Merged
ElbertePlinio merged 3 commits into
mainfrom
feat/117-evidence-viewer
Sep 9, 2026
Merged

ElbertePlinio merged 3 commits into
mainfrom
feat/117-evidence-viewer

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Refs #117 (bullets 2, 3 and the rendering half of 6). Merge after #141 (device metadata and outcomes) and rebase to swap the local ReportManifest/ReportOutcome types for the shared ones.

Turns the run report.html into the approved charcoal/ember viewer using the brand tokens: summary with device, revision and scenario, outcome banners for pass, fail, partial, blocked and none recorded, explicit empty, truncated and corrupt states, device and scenario filters with server-rendered counts, a filmstrip with per-capture inspection, and search.

Interaction strategy: everything works with scripts blocked. Filters are hidden radio groups with sibling selectors, inspection is a :target view with previous/next anchors, an actual-size checkbox and an "open original" link, and controls are real links and inputs with visible focus. One self-contained inline script adds text search and arrow-key browsing; the CSP gains exactly script-src 'sha256-…' computed from that script's bytes at render time. No external scripts, no network, no eval or innerHTML. The session index CSP is unchanged. README, SECURITY.md and the unreleased notes now describe this instead of "no-script".

Validation: typecheck and oxlint clean; bun run test:coverage 1655 passed with thresholds held (evidence-render tests 8 to 32: CSP hash equality, forbidden script tokens, escaping and redaction in new fields, legacy manifests, empty/truncated/corrupt states, determinism, path safety). Headless Chromium 1440 wide with --enable-logging=stderr printed zero "Refused to" lines with scripts on and off. Screenshots kept locally under Boards/pickforge/117/viewer.

Author: Opus subagent. Reviewer: separate Astra review.

…nned search

Turn the finalized run report into the approved charcoal viewer: run,
device and outcome summary, explicit empty, truncated and corrupt-journal
states, device and scenario filters, a filmstrip with a full-size capture
inspection view, and text search.

Filters, inspection, actual-size and browsing are CSS-only (hidden radio
inputs, sibling selectors, :target), so the report stays usable with
scripts blocked. One self-contained inline script adds text search and
arrow-key browsing; the report CSP admits it by the sha256 of the emitted
script text and nothing else. Rendering stays pure, synchronous and
deterministic, with every data-derived string on the existing redaction
and escaping path and screenshot admission unchanged.

Device metadata and acceptance outcome records are read through narrow
local types until the manifest and journal changes land.
…counts

Redact each search component before lowercasing it, so case-sensitive
credential patterns cannot survive into the data-search index.

Validate device metadata at runtime and fall back to unknown per field:
a null or partial viewport, a non-boolean touch, a non-finite scale, a
blank browser or platform, and an unlisted kind no longer crash or print
half-values, and an unlisted kind falls back to the desktop lens.

Always emit data-scenario, empty included, so the scenario rules exclude
captures that belong to no scenario.

Count only what the checked filter radios leave visible, recount when a
filter changes, and name timeline matches separately from capture matches.
The live count and the empty state are scripted state, so both are hidden
while scripts are blocked; the server-rendered per-lens counts remain.

Project the actual-size checkbox focus and checked state onto its label,
prove exactly one src-less script whose text hashes to the CSP source, and
correct the docs: filters, inspection and navigation work with scripts
blocked, while search and arrow keys need the pinned script.
Resolve packages/core/src/evidence-render.ts by keeping the viewer
rendering and swapping the local structural types for the shared ones:
EvidenceDevice from run.ts, EvidenceOutcomeRecord and isOutcomeRecord
from evidence-outcome.ts, and the EvidenceRecord union that now carries
outcome records. The runtime validation of malformed device values stays,
since bad journal data must still render as unknown.

Outcome records are excluded from step numbering exactly once, by the
partition that runs before sortEvidenceRecords, so the placeholder outcome
article from main is dropped in favour of the outcome banners. The
renderRunReport device and outcome lines from main are kept for the CLI
text report, and the three tests that asserted the placeholder markup now
assert the viewer's outcome banner.
@ElbertePlinio
ElbertePlinio merged commit e6252b0 into main Sep 9, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the feat/117-evidence-viewer branch September 9, 2026 19:51
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