Skip to content

fix: mk_dirs_if_missing leaves no stray directory for a key a layer below rejects (#122) - #128

Merged
thorwhalen merged 2 commits into
masterfrom
fix/mk-dirs-filter-122
Oct 13, 2026
Merged

thorwhalen merged 2 commits into
masterfrom
fix/mk-dirs-filter-122

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #122. mk_dirs_if_missing(filt_iter(Files, filt=...)): the preset made the directory before the inner filt_iter refused the key. Layers cannot be asked in advance (see #129/#130 for a probe), so the decorator now wraps __setitem__ itself: it makes the missing directories (recording only those this call made), writes, and if the write raises removes them again, deepest first, only if still empty. Other directories, and anything another writer put there, are untouched. mk_dirs_if_missing_preset is kept unchanged (public) but the decorator no longer uses it.

Adversarial review (Opus): no defect in any stacking (class/instance, either side of filt_iter/wrap_kvs/KeyCodecs, doubled, graze/astern suites); found a race where a directory created meanwhile by another process was counted as made here: fixed (level-by-level mkdir, tracked only on success) with a test. Residual, documented: a concurrent writer that had just seen the new directory exist can lose it to the cleanup (its write fails like any write to a missing directory).

Dependents gate (101 suites, timeout 2400 priv test-dependents dol with this branch on PYTHONPATH vs master): identical failing set (25 environmental/pre-existing: missing wkhtmltopdf, couchdb, collection errors...). mergeset passed 320 vs 331 with the same 2 failures (its tree changed between the runs). /dev/null intact.

🤖 Generated with Claude Code

thorwhalen and others added 2 commits October 13, 2026 11:24
…e then fails (#122)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit 8f38711 into master Oct 13, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/mk-dirs-filter-122 branch October 13, 2026 11:55
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.

mk_dirs_if_missing over filt_iter: a key the filter rejects still gets its directory

1 participant