From 5c986330deb0e184b2382098283e3db9805a77a0 Mon Sep 17 00:00:00 2001 From: devdanzin <74280297+devdanzin@users.noreply.github.com> Date: Mon, 29 Jun 2026 19:44:10 -0300 Subject: [PATCH] refactor: convert replay-script writeFunction to `with self.indented():` The last manual addLevel/restoreLevel call site in a live code path. WriteReplayScript (fusil/process/replay_python.py, used by process.create to emit the crash-replay script) gets the same treatment as the generators (#145/#146/#147, under #106). Provably equivalent (Pattern A) and confirmed byte-identical with a direct equivalence check. After this, the only addLevel/restoreLevel references in the live tree are the `indented()` definition itself and the one documented callee-opens-a-level contract between _dispatch_fuzz_on_instance and the h5py dispatcher. Suite 328 OK, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- fusil/process/replay_python.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fusil/process/replay_python.py b/fusil/process/replay_python.py index ad501e0..c020d49 100644 --- a/fusil/process/replay_python.py +++ b/fusil/process/replay_python.py @@ -88,9 +88,8 @@ def debug(self, level, format, *args): def writeFunction(self, name, callback, *args): self.write(0, "def %s:" % name) - old = self.addLevel(1) - callback(*args) - self.restoreLevel(old) + with self.indented(): + callback(*args) self.emptyLine() def pythonImports(self):