Repository navigation
Session: reuse one driver macro instead of a new file per call - #36
Merged
Merged
Conversation
Each call wrote a new _driver_<n>.mac, so long sessions left thousands of small files in the scratch folder. DISCUS keeps macros in memory by file name, but empties that store whenever a top-level macro ends (also after an error), so overwriting one file is safe: checked by running different text through the same name, including right after a failed macro. The scratch folder now stays at a handful of files (driver, data outputs, input copy). New test: test_scratch_folder_does_not_grow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
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.
Merges into
claude-python-app(notmaster).This commit was pushed to
claude/fourier-pdfjust after #35 was merged, so it did not make it in. Same change, now on top of the mergedclaude-python-app.What it fixes
Every
diffusecall wrote a new driver macro (_driver_0.mac,_driver_1.mac, …), so a long session left thousands of small files in its scratch folder. Now each session reuses one_driver.mac, overwritten on every call.Why reusing one file name is safe
DISCUS keeps the macros it runs in memory, keyed by file name (
lib_f90/macro.f90,class_macro_internal), so a reused name could in principle run stale text. Butmacro_closeempties that store whenever a top-level macro ends, including after an error. Checked directly withsuite_python: three different texts through the same file name, one of them failing, each ran its new content.Tests
test_scratch_folder_does_not_grow: 20 calls with different text, a failing call, a call after the error, and powder calculations before and after; the folder contents are unchanged and each call sees its own text.pytest tests/python: 40 passed (33 legacy macro tests skipped withoutDISCUS_SUITE)._driver.mac,fourier.inte,input/,pdf.gr,powder.dat.Generated by Claude Code