Skip to content

feat: add actionable structured failure diagnostics - #195

Draft
cpendery (cpendery) wants to merge 2 commits into
mainfrom
feat/structured-failure-artifacts
Draft

feat: add actionable structured failure diagnostics#195
cpendery (cpendery) wants to merge 2 commits into
mainfrom
feat/structured-failure-artifacts

Conversation

@cpendery

Copy link
Copy Markdown
Member

Summary

  • add a versioned FailureDetails envelope to core errors and carry it through CLI JSON, N-API, PyO3, JavaScript, and Python
  • trace locator stages, effective occurrence, candidate counts, anchor/selection failures, style mismatches, and distinct polling outcomes
  • retain bounded recent screen and operation history with pinned terminal, process, backend, profile, and timing evidence
  • write collision-safe failure artifacts containing failure.json, deterministic report.md, pinned terminal text/SVG, and an optional immutable automatic-recording prefix
  • add CLI artifact/context flags, configurable screen-history retention, and an explicit daemon protocol revision
  • preserve human error messages and compatibility terminal fields while moving location() failures into the core

Failure artifact

Bundle mode writes:

failure-<timestamp>-p<pid>-<sequence>/
  failure.json
  report.md
  current.txt
  current.svg
  session.cast

failure.json is committed last and records file status, hashes, omissions, truncation, sensitivity, and capture errors. Recording copies are worker-snapshotted immutable prefixes; if output advances after the pinned failure observation, the cast is omitted instead of pairing mismatched evidence.

Compatibility and privacy

  • existing error classes, messages, exit codes, and Terminal content: output remain available
  • JavaScript retains the legacy newline native-error parser; Python retains message-only behavior for older native modules
  • reused sessions keep their original history retention while each client/command can choose its own artifact policy
  • artifacts can contain terminal output, titles, locator/assertion operands, snapshot evidence, diagnostic context, and recordings; recording inclusion is explicit
  • TuiTestError is now non-exhaustive and exposes boxed diagnostic/artifact payloads to keep Result sizes bounded

Validation

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo clippy -p tui-test-rs --all-targets --no-default-features -- -D warnings
  • cargo test --workspace -- --test-threads=1
  • Python: 117 tests passed with the rebuilt worktree extension
  • python bindings/python/scripts/generate_stubs.py --check
  • JavaScript TypeScript compilation passed
  • focused JavaScript native/options suites: 31 tests passed
  • new N-API Rust code passed workspace check, clippy, and tests

The full npm run test:node path was not run because rebuilding the .node addon is blocked on this Windows machine by the existing Ghostty/Zig linking failure; focused JavaScript tests used the existing addon for mocked runtime behavior while the changed native Rust code was validated through Cargo.

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