-
-
Notifications
You must be signed in to change notification settings - Fork 0
Tests Report
mchristegh edited this page Jul 14, 2026
·
1 revision
test-scripts/report-harness.js — the report engine (lib/report.js) and the report node. Its defining feature: the incident under test is generated by a real RecorderStore on a fake clock — controlled gaps, a mark, a genuinely truncated record, an error-trigger dump — so the renderer is proven against authentic incident shapes rather than hand-built approximations. Timezone is pinned to UTC so date assertions are exact; file behavior runs against real temp directories.
| Group | Why it exists |
|---|---|
| R1 — detection | Payload classification: incidents (including copies arriving via the events envelope), snapshots (including via query envelopes), events, and everything else as unknown — the auto-detection that lets one node wire to any recorder output. |
| R2 — text incident layout | The layout contract, line by line and character-exact: the header, the cause block front-and-center for error triggers, the stats line, exact timeline rows (this is where "test 1b verifies the title is displayed" lives — every column, the ⚠ on the 3×-median gap, the ✂ on the truncated record, the ── MARK ── and ── RESTART ── rules in their correct sequence positions, the footer legend). |
| R3 — text snapshot | The status-report layout, including the tap extras line (mutes with suppressed counts, scope counters) and its absence for inline snapshots. |
| R4 — events & unknown | The event one-liner format, and the harmless "not a recorder payload" note. |
| R5 — Markdown skin | Same model, different skin: header, cause blockquote, the timeline as a real table, bolded anomalies, mark and restart rows. |
| R6 — HTML skin | Self-containment as assertions: starts with a doctype, carries the family orange, contains no external URLs and no scripts — and an injection test proving payload content is escaped, never executed. |
| R7 — preview width & empty | The previewChars config actually clips (with ellipsis), and an empty incident renders sensibly ("recording was empty", median —). |
| R8 — message destination | The output contract: payload becomes the rendered document, topic and _msgid survive, and msg.report carries kind, format, the untouched source, and an empty files list. |
| R9 — file destination | Template-named files land with the incident's own timestamp, content is the report, the confirmation payload names the path, and msg.report.files reports per-file success. |
| R10 — the evidence pair |
both + Raw JSON: report and .json share one stem, and the JSON round-trips bit-for-bit against the original incident — the lossless-evidence promise as a test. |
| R11 — collisions | The same incident filed twice yields a -2-suffixed pair — evidence is never overwritten, and the pair stems stay consistent. |
| R12 — retention | Keep-newest-2 across three filings prunes the oldest pair (never orphaning a report from its JSON) while a foreign file in the same directory is untouched. |
| R13 — degradation | The two misconfigurations (Raw JSON without file output; file destination without a directory) warn with the correct, specific message, keep rendering, and name the problem in the confirmation — this group caught a real ordering bug during development. |
| R14 — non-incident inputs through the node | Events render as one-liners and are never filed even with file output configured; snapshots file as status pairs; unknowns pass with their source preserved. |
| R15 — template internals | Hostile store ids sanitize into safe filenames (no separators), and the template-derived regex matches the node's own files (including suffixes) while rejecting foreign ones — the property retention's safety depends on. |
| R16 — meta rendering | The runtime line renders in all three skins when the incident carries meta, null fields are skipped gracefully, and meta-less (pre-0.2.0) incidents render exactly as before. |
Flight Recorder
Node Reference
Reference
Guides
Testing