Skip to content

fzd: do not leave an empty iterNNN_<timestamp> directory per iteration - #108

Merged
yannrichet merged 1 commit into
mainfrom
claude/fzd-empty-iter-dirs
Nov 7, 2026
Merged

yannrichet merged 1 commit into
mainfrom
claude/fzd-empty-iter-dirs

Conversation

@yannrichet

Copy link
Copy Markdown
Member

Pull Request

Description

With a file-based model, fzd left an empty iterNNN_<timestamp>/ directory next to each iterNNN/ of its analysis_dir, even in a fresh directory. It created iterNNN/ and then called fzr() on it, and fzr() renames an existing results_dir with a timestamp before running.

The directory is no longer created before fzr(), which creates it itself. The function-model branch writes values.csv into it directly, so it still creates it there.

Related Issues

Fixes #106

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Test addition/modification

Changes Made

  • fz/core.py (iteration loop of fzd): iteration_result_dir.mkdir(...) is moved into the function-model branch, just before _save_function_model_iteration_csv. The file-based path leaves the creation to fzr().
  • tests/test_fzd_iteration_dirs.py:
    • after a 2-iteration file-based run (bfgs, max_iter=2), analysis_dir contains only iter001/ and iter002/, each with case directories. This test fails on main, which leaves ['iter001', 'iter001_<ts>', 'iter002', 'iter002_<ts>'];
    • the function model still writes iter001/values.csv.
  • NEWS.md: one entry in the 2.0 "Robustness" section, since the 2.0 tag does not exist yet.

Testing Performed

  • Reproduced on main (4ed796e) with the new test before the fix.
  • After the fix:
    • the 78 fzd tests pass (test_fzd*.py, including the new file);
    • re-running fzd into the same analysis_dir reuses all cases from cache://…/an_<timestamp>/iter001, so the cross-run cache path mentioned in the issue still works;
    • the CI's blocking flake8 check (--select=E9,F63,F7,F82) reports 0 errors.
  • Full local suite (Linux, Python 3.13, ci.yml --ignore list): 5 failed, 1082 passed, 86 skipped. The 5 failures are the pre-existing environmental ones, identical on main: 3 permission tests that fail when run as root, and 2 yq tests that need a different yq.

Generated by Claude Code

#106)

fzd created analysis_dir/iterNNN/ before calling fzr() on it; fzr() renames an
existing results_dir with a timestamp, so every iteration of a file-based model
left an empty iterNNN_<timestamp>/ next to the real iterNNN/.

The directory is no longer created before fzr() (which creates it); the
function-model branch, which writes values.csv itself, creates it there.
Results and cross-run cache reuse are unchanged (checked: a re-run into the
same analysis_dir reuses every case from cache://).

tests/test_fzd_iteration_dirs.py: no iter*_* directory after a 2-iteration
file-based run (fails on main), and the function model still writes
values.csv. NEWS (2.0, Robustness).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjXvVRjM6aMvKvvSFoxpZ6
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.

fzd leaves an empty iterNNN_<timestamp> directory per iteration

2 participants