Skip to content

fix: tgtrace writes its trace atomically; verify refuses a missing or broken trace (#108) - #155

Merged
inth3shadows merged 2 commits into
mainfrom
fix/108-trace-atomic
Oct 30, 2026
Merged

inth3shadows merged 2 commits into
mainfrom
fix/108-trace-atomic

Conversation

@inth3shadows

Copy link
Copy Markdown
Owner

Fixes #108.

  • tgtrace writes <out>.tmp.<pid> and os.replaces it, so a killed run leaves no trace or a whole one, never a truncated one.
  • verify refuses (exit 2) a missing, truncated or non-object trace, instead of exiting 1 (= tests failed) on a traceback or 3 (= no journey-level test) on an empty trace. The refusal carries pytest's stderr tail. pytest_adapter refuses the same cases.
  • README and --help say exit 2 also covers "no readable trace".

Reviewed by /code-review and a code-reviewer agent; the agent drove real pytest runs (red, SIGKILL, SIGTERM, Ctrl-C, os._exit, bad flag, -p no:tgtrace) and found no wrong exit code. The high-severity findings are fixed in daaef68 (non-object trace, the dropped stderr, a test that stopped covering its path); the rest are filed as #153 and #154.

… truncated trace (#108)

A truncated trace raised an uncaught JSONDecodeError out of verify.run,
so the CLI exited 1 (= tests failed); a missing trace read as {}, so
every selected journey was reported uncovered (exit 3). Both are a
broken run, not a verdict.

- tgtrace writes <out>.tmp.<pid> and os.replace()s it; a failed write
  removes the temp file, so the target is absent or whole.
- verify.run returns an error (exit 2, REFUSED) for a missing or
  unreadable trace; pytest_adapter.run refuses a truncated one too.
- README and --help say exit 2 also covers "no readable trace".
…n the refusal (#108 review)

- H1: `null` / `[]` / a string parse as JSON, then crashed validate()
  with an AttributeError (exit 1 again). verify and pytest_adapter
  refuse a non-object trace like a truncated one.
- H3: the missing-trace refusal now carries the tail of pytest's stderr,
  which names the real cause (a bad flag, tgtrace's xdist refusal).
- ConnectionClosedTests writes a whole (empty) trace, so it covers the
  validate/ledger path again instead of stopping at the new refusal.
@inth3shadows
inth3shadows merged commit fa221a4 into main Oct 30, 2026
5 checks passed
@inth3shadows
inth3shadows deleted the fix/108-trace-atomic branch October 30, 2026 17:13
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.

tgtrace: trace written non-atomically; a truncated trace makes verify exit 1 (same code as tests-failed)

1 participant