refactor: drop debug-comment cruft + finish converting _dispatch_fuzz_on_instance#146
Merged
Merged
Conversation
…_on_instance `_dispatch_fuzz_on_instance` emitted three diagnostic comment lines into every generated script (`# self.base_level=0`, `# self.base_level=1`, `# L_main_if_target_not_none=0`) -- leftover cruft from diagnosing an indentation bug long ago. Remove them. With the level variable no longer referenced in generated output, the method's manual `addLevel(1)`/`restoreLevel(...)` blocks convert cleanly to `with self.indented():` (the outer `if target is not None:` body and the skip-trivial block). The inner `try/finally` that restores the h5py writer's returned level stays: that's a genuine callee-opens-a-level contract, not the manual idiom. This is the one intended generated-output change: the golden snapshot (tests/python/test_golden_output.py) is regenerated to drop exactly those three comment lines -- verified the diff is those lines and nothing else. Suite 328 OK, ruff clean. write_python_code.py now has no manual addLevel/restoreLevel left except the h5py-contract restore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #145 (under #106).
_dispatch_fuzz_on_instanceemitted three diagnostic comment lines into every generated fuzzing script — leftover cruft from diagnosing an indentation bug long ago:This removes them. With the level variable no longer referenced in generated output, the method's manual
addLevel(1)/restoreLevel(...)blocks convert cleanly towith self.indented():(the outerif … is not None:body and the skip-trivial block). The innertry/finallythat restores the h5py writer's returned level stays — that's a genuine callee-opens-a-level contract, not the manual idiom.Verification
This is the one intended generated-output change. The golden snapshot is regenerated; the diff against the old snapshot is exactly those three comment lines and nothing else (confirmed under pinned
PYTHONHASHSEED). Suite 328 OK, ruff clean.After this,
write_python_code.pyhas no manualaddLevel/restoreLevelleft except the single h5py-contract restore. Next up: the h5py writer itself (write_h5py_code.py).🤖 Generated with Claude Code