Problem
The focused #826 diagnosis found that its exact 10,000-entry timeout is dominated by probing descendants below an already-proven-absent moved stage directory. Skipping those descendants fixes that concrete job blocker.
A separate scaling cost remains for genuinely present recorded trees on the Windows verified-path fallback. Each file independently captures and re-verifies the same parent/ancestor chain during source and tombstone state checks.
Measured modeled-Windows work for a flat present 1,000-file tree:
- 5,014 fallback ancestor captures
- 11,016 ancestor re-verifications
- 164,232
lstat calls
The current shape projects to roughly 1.64 million lstat calls at 10,000 present files. This is not the moved-stage state exercised by #826, so solving it there would turn a one-line fail-closed optimization into a much larger Win32 transaction rewrite.
Related: #768, #770, #771, #826
Scope
- Group present-tree cleanup by verified parent or retain a bounded parent binding so invariant ancestor work is not repeated for every flat child.
- Preserve no-follow, exact identity/digest, junction/reparse, hard-link, mount, rollback, tombstone, and late-replacement defenses.
- Keep Windows fallback behavior explicit; do not assume POSIX
dir_fd support.
- Add deterministic operation-count coverage for genuinely present flat and nested trees.
Acceptance criteria
- Present flat-tree cleanup performs work linear in entries plus directory depth, not entries times repeated ancestor depth.
- Operation-count tests fail on the current repeated-capture shape and remain stable across at least two substantially different entry counts.
- Late parent relocation/replacement, junction/reparse, mount, digest, hard-link, and read-only adversarial tests preserve unknown content.
- The exact native Windows transaction job, Pyright, Ruff, the full unit suite, and Godot 4.7.1 validation pass.
Problem
The focused #826 diagnosis found that its exact 10,000-entry timeout is dominated by probing descendants below an already-proven-absent moved stage directory. Skipping those descendants fixes that concrete job blocker.
A separate scaling cost remains for genuinely present recorded trees on the Windows verified-path fallback. Each file independently captures and re-verifies the same parent/ancestor chain during source and tombstone state checks.
Measured modeled-Windows work for a flat present 1,000-file tree:
lstatcallsThe current shape projects to roughly 1.64 million
lstatcalls at 10,000 present files. This is not the moved-stage state exercised by #826, so solving it there would turn a one-line fail-closed optimization into a much larger Win32 transaction rewrite.Related: #768, #770, #771, #826
Scope
dir_fdsupport.Acceptance criteria