Skip to content

Refactor snapshot bookkeeping into wrapper; add test output .gitignore#108

Merged
lukstafi merged 1 commit into
mainfrom
ludics/task-45c21e19-s3/root
Apr 15, 2026
Merged

Refactor snapshot bookkeeping into wrapper; add test output .gitignore#108
lukstafi merged 1 commit into
mainfrom
ludics/task-45c21e19-s3/root

Conversation

@lukstafi

Copy link
Copy Markdown
Owner

Summary

  • Extract paired pop_snapshot()/snapshot_ch() calls from close_tree into a with_snapshot_bookkeeping wrapper in the PrintBox functor, making the save/restore boundary structural rather than positional (prevents regressions of the PR Fix toc file truncation during snapshot_every_sec #104 bug class)
  • Add .gitignore patterns (debugger_*_debug*, *.raw) for generated test debug output files that were showing up as untracked

Test plan

  • dune build compiles successfully
  • dune runtest passes — all existing tests confirm behavior is preserved

🤖 Generated with Claude Code

@lukstafi

Copy link
Copy Markdown
Owner Author

@codex review Focus on bugs, correctness issues, and edge cases. Do not check adherence to a spec or plan.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…nore

Extract paired pop_snapshot/snapshot_ch calls from close_tree into a
with_snapshot_bookkeeping wrapper, making the save/restore boundary
structural rather than positional. This prevents future regressions of
the class of bug fixed in PR #104 (snapshot_ch placed between main
output and TOC output).

Also add .gitignore patterns for generated test debug output files
(debugger_*_debug*, *.raw) that were showing up as untracked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lukstafi lukstafi force-pushed the ludics/task-45c21e19-s3/root branch from 521b06e to ee44932 Compare April 15, 2026 07:25
@lukstafi lukstafi merged commit 14ed7b1 into main Apr 15, 2026
@lukstafi

Copy link
Copy Markdown
Owner Author

Retrospective — task-45c21e19

What went well

  • Clean single-commit implementation, approved on first round with no action items.
  • Codex automated review also found no issues.
  • The proposal was precise enough that no deviation or investigation was needed.

What I'd do differently next time

  • Nothing significant for this task. It was a small, well-scoped refactor with clear acceptance criteria. The proposal-to-implementation path was direct.

Possible follow-up improvements

  • Consider making with_snapshot_bookkeeping exception-safe. The current wrapper does not call snapshot_ch if f () raises. In practice this is fine because snapshot() (the caller of close_log_impl ~from_snapshot:true) already has its own try/with that restores the stack on exception. However, a Fun.protect ~finally pattern would make the wrapper independently robust:
    let with_snapshot_bookkeeping ~from_snapshot f =
      pop_snapshot ();
      Fun.protect ~finally:(fun () ->
        if not from_snapshot then snapshot_ch ())
        f
    This is a judgment call — the extra safety may not be worth the complexity given the existing exception handling in snapshot(), but it would decouple the wrapper's correctness from its caller's behavior.

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