Skip to content

BUILD-1210: retain the last observed startup exception - #4227

Open
akimfomin wants to merge 1 commit into
ItsNotRexed:mainfrom
akimfomin:fix/boot-trace-last-exception
Open

akimfomin wants to merge 1 commit into
ItsNotRexed:mainfrom
akimfomin:fix/boot-trace-last-exception

Conversation

@akimfomin

Copy link
Copy Markdown

Claimed under BUILD-1210 in #4084 (comment). Independently reproduced in #4084 (comment).

A startup trace with 11 early C++ throws and a later exception counts all 12 on main, but the default report drops the latest exception's location and stack. Keep the first samples and show one extra entry for the last observed exception when it falls outside them. The startup JSON includes an optional last_exception field in that case. The last observed exception can be handled, so the report labels it without inferring a crash.

Windows 11, Python 3.12.14:

  • 14 boot-trace tests passed. The added regression exercises the text and JSON CLI modes; it failed on main before the fix.
  • 11 documentation checks passed (links, paths and CLI flags).
  • A separate CLI check with the default limit retained the 12th exception in both formats, including its stack, before a truncated final line.
  • git diff --check passed.

Synthetic logs only. AI-assisted.

BUILD-1210. Retain the first samples and include the final observed exception in text and JSON when it falls outside the sample.

AI-assisted.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at e39a62a0 on Windows 11: python -I tests/test_boot_trace.py -> 14 tests, OK; git diff --check clean.

The parser keeps the first --limit samples and stores the final exception separately, and the text summary appends it as last observed exception (so the detail list can exceed the limit by one, as the help says). The JSON keeps exceptions plus last_exception; the existing tests and the capped-trace case pass.

One edge to decide: with --limit 0 this still prints one last observed exception, while #4223's variant (replacing the last slot) prints none. Since #4223 is the competing PR, the coordinator should pick the intended --limit 0 behavior along with the duplicate.

Duplicate note: #4223 (4866ae5c, Vonsek) implements the same finding by replacing the last slot. Claims: this PR's BUILD-1210 claim at 00:05:07Z, #4223's EGEN claim at 00:06:46Z, so this is the earlier claimant even though it opened later. No functional blocker in either.

@akimfomin

Copy link
Copy Markdown
Author

Thanks for the Windows check, @Kam471. I ran the CLI at main aa2988cc, #4223 4866ae5c and this PR e39a62a0. All three reject --limit 0 with exit code 2 and --limit must be at least 1, before reading the trace. The internal parser is separate from that CLI check. With --limit 1 on a 12-event fixture, this PR keeps the first exception and labels the last separately. #4223 uses the single slot for the last. The extra entry here is bounded to one and documented in --help. AI-assisted.

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.

2 participants