Skip to content

feat: configurable case directory naming (case_naming), thread-safe signal handling - #78

Merged
yannrichet merged 2 commits into
mainfrom
feat/case-naming
Jul 29, 2026
Merged

feat: configurable case directory naming (case_naming), thread-safe signal handling#78
yannrichet merged 2 commits into
mainfrom
feat/case-naming

Conversation

@yannrichet

Copy link
Copy Markdown
Member

Summary

  • fzr() gains a case_naming parameter (CLI --case_naming, env FZ_CASE_NAMING): "path" (default, unchanged var1=val1,var2=val2,... subdirectories), "hash" (short content hash of the variable combination), or "index" (case_<i>). "path" can exceed filesystem filename length limits (~255 chars) with many input variables; "hash"/"index" avoid that.
  • With "hash"/"index", a single cases.csv manifest is written at the results root mapping each case directory to its variables. fzo() reads it back (falling back to each case's own info.txt, which always has input.<var>=<value> lines) when a directory name doesn't parse as key=val,....
  • fzd() now runs its internal per-iteration fzr() calls (file-based models) with case_naming="index" by default, since algorithm-generated design points can carry many variables with long float values. cache:// matching is by .fz_hash content, not directory name, so cross-iteration cache reuse is unaffected.
  • Fixed: fzr/fzd installed a SIGINT handler unconditionally, which raises ValueError when called from a non-main thread (e.g. Streamlit reruns, a ThreadPoolExecutor worker, or a background thread embedding fz). Signal handler install/restore is now skipped outside the main thread instead of raising.
  • Docs updated: README.md, doc/core-functions.md, doc/INDEX.md, doc/parallel-and-caching.md, skills/fz/reference.md, NEWS.md.

Test plan

  • New tests/test_case_naming.py (6 tests): path/hash/index naming, cases.csv manifest content, fzo fallback to info.txt when the manifest is missing, invalid case_naming validation, FZ_CASE_NAMING env var default.
  • tests/test_skill_static.py updated (scoped a too-broad choices=[...] regex to --format specifically) and passing.
  • Full local suite (matching CI's ignore list for SSH/funz-protocol tests needing local servers): 844 passed, 1 failed (pre-existing, environment-only python vs python3 PATH issue in test_debug_execution.py, reproduced on unmodified main), 82 skipped.
  • Manually verified fzr/fzo round-trip for hash/index naming, including after a cache-hit (fzd-like iteration reuse), and the no-variables case.

🤖 Generated with Claude Code

yannrichet-asnr and others added 2 commits July 29, 2026 11:36
…ignal handling

fzr() gains a case_naming option ("path" default, "hash", "index") to avoid
exceeding filesystem filename length limits when many input variables are
used (var1=val1,var2=val2,... can exceed ~255 chars). With "hash"/"index",
a single cases.csv manifest is written at the results root mapping each
case directory to its variables; fzo() reads it back (falling back to each
case's own info.txt) when directory names don't parse as "key=val,...".

fzd() now runs its internal per-iteration fzr() calls with case_naming="index"
by default, since algorithm-generated design points can carry many variables
with long float values; cache:// matching is unaffected since it's based on
.fz_hash content, not directory names.

Also fixes fzr/fzd installing a SIGINT handler unconditionally, which raised
ValueError when called from a non-main thread (Streamlit reruns, a
ThreadPoolExecutor worker, or any background thread embedding fz).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Windows CI failed: the test built expected paths with a hardcoded "/"
separator, which doesn't match fzr's native "\" paths on Windows.
Compare directory basenames via Path instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@yannrichet
yannrichet merged commit 953e79d into main Jul 29, 2026
41 checks passed
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.

2 participants