TST-21: Expand demo director reporting, assertions, presets, and soak#500
TST-21: Expand demo director reporting, assertions, presets, and soak#500Chris0Jeky merged 7 commits intomainfrom
Conversation
Creates demo-report-html.mjs with utilities to generate self-contained static HTML reports from demo director artifacts (run-summary.json, trace.ndjson, screenshots). Reports include inline styles, step-by-step trace table, pass/fail badges, and embedded screenshot images.
Creates demo-trace-assertions.mjs with exact match, structural match, step ordering, error detection, and required events assertions. Supports both strict comparison and shape-only validation modes for comparing demo traces against known-good snapshots.
Creates demo-director-presets.mjs with four built-in presets: happy-path-capture, review-approve-flow, error-recovery-demo, and soak-baseline. Each preset defines scenario, director args, and trace expectations. Supports loading by name, merging with overrides, and runtime registration of custom presets.
Creates demo-soak.mjs with configurable iteration count, duration limit, and cooldown between runs. Tracks cumulative metrics including pass rate, timing drift, and memory indicators. Builds a structured summary report at completion.
63 tests covering: HTML report generation (escaping, status badges, screenshots, XSS prevention), trace assertions (exact/structural match, ordering, error detection), preset loading/merging/registration, soak config validation and loop execution, and a full integration test that runs a preset through the assertion and reporting pipeline.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Adversarial Self-ReviewFindings
VerdictAll findings are known trade-offs or intentional scope boundaries. No blocking issues found. |
Adversarial Code Review of PR #500I read every line of the diff across all 9 new files (4 source modules, 5 test files). Here are the findings, ordered by severity. BUG:
|
| Severity | Count | Issues |
|---|---|---|
| Bug | 1 | XSS via unescaped dataUrl in HTML report |
| Design | 1 | Unbounded iterations array in soak mode (stack overflow on spread) |
| Quality | 2 | Test pollution via registerPreset; Typo in TraceAssertionResult |
| Minor | 3 | stepRows falsy check, unguarded summary read, missing top-level array check |
The XSS issue and the Math.min(...durations) stack overflow on large soak runs are the two items I would fix before merge.
…ummary - Escape s.dataUrl with escapeHtml() in screenshot img src attribute to prevent XSS via crafted dataUrl strings in generateHtmlReport - Replace Math.min(...durations)/Math.max(...durations) spread with incremental tracking loop in buildSoakSummary to avoid RangeError when iterations array exceeds V8 max call stack argument limit
Summary
Closes #331
demo-report-html.mjs): Generates self-contained static HTML reports from demo artifact bundles. Reports include inline styles, step-by-step trace tables with pass/fail badges, and embedded base64 screenshots. No external dependencies.demo-trace-assertions.mjs): Assertion utilities supporting exact match, structural/shape match, step ordering validation, error detection, and required event checks. Integrates with vitest for test-time validation.demo-director-presets.mjs): Four built-in presets (happy-path-capture, review-approve-flow, error-recovery-demo, soak-baseline) with scenario config, timing, and trace expectations. Loadable by name with override merging.demo-soak.mjs): Long-run loop runner with configurable iteration count and duration limit. Tracks cumulative metrics: pass rate, timing drift, min/max/avg iteration time, and memory indicators.Test plan
npx vitest --run)npm run buildsucceeds (typecheck + vite build)