Skip to content

refactor: drop debug-comment cruft + finish converting _dispatch_fuzz_on_instance#146

Merged
devdanzin merged 1 commit into
mainfrom
generator-dispatch-debug-cleanup
Jun 29, 2026
Merged

refactor: drop debug-comment cruft + finish converting _dispatch_fuzz_on_instance#146
devdanzin merged 1 commit into
mainfrom
generator-dispatch-debug-cleanup

Conversation

@devdanzin

Copy link
Copy Markdown
Owner

Follow-up to #145 (under #106).

_dispatch_fuzz_on_instance emitted three diagnostic comment lines into every generated fuzzing script — leftover cruft from diagnosing an indentation bug long ago:

# self.base_level=0
    # self.base_level=1
    # L_main_if_target_not_none=0

This removes 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 … 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.

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.py has no manual addLevel/restoreLevel left except the single h5py-contract restore. Next up: the h5py writer itself (write_h5py_code.py).

🤖 Generated with Claude Code

…_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>
@devdanzin devdanzin merged commit 686a251 into main Jun 29, 2026
2 checks passed
@devdanzin devdanzin deleted the generator-dispatch-debug-cleanup branch June 29, 2026 22:06
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