35 lines
4.5 KiB
Markdown
35 lines
4.5 KiB
Markdown
# Queue filesystem optimization review — 2026-10-19
|
|
|
|
## Verdict
|
|
|
|
**Approved for the final reviewed diff. No remaining Critical or Important findings.** The initial rotation exception-semantics issue identified during review has been corrected. The optimization retains live filesystem validation, per-step evidence, fsync, atomic command publication, and file identity checks.
|
|
|
|
Reviewed `legacy_paths.py`, `retention.py`, `logging_setup.py`, `quick_run.py`, the new filesystem-work tests, relevant existing long-path/logging/cache/retention coverage, and supplied XML/metrics artifacts. No tests, CAD, application operations, source changes, or Git mutations were performed. This report is the only output written.
|
|
|
|
## Final code review
|
|
|
|
- `_prepare_project_access` uses a local `seen` set keyed by the exact raw project-path field. Repeated commands resolve each input once within that preparation call. Different raw paths are not silently merged, and the set is discarded afterward. Strict short-path/alias identity checks and before/after-worker access validation remain. This is not a lifetime cache of filesystem trust.
|
|
- `rotate_text_log` performs one fresh `stat` for normal files. If that query raises `OSError` or `ValueError`, the exceptional branch invokes `Path.exists()` to retain pathlib's own platform-specific distinction between an absent/invalid path and a genuine filesystem error. False returns false; true re-raises the original exception; permission and other non-ignored errors from `exists` propagate. No blanket `OSError` suppression was added.
|
|
- This final exceptional branch fixes the intermediate implementation that caught only `FileNotFoundError`. On the installed Python 3.12, the former `exists()` also treated ENOTDIR, EBADF, ELOOP, specific Windows path errors, and nonencodable paths as absent. Keeping the platform predicate in the cold branch avoids duplicating those rules in the application.
|
|
- `_task_directory` and `_append_log` perform a live `is_dir()` check on every call and still execute `mkdir(parents=True, exist_ok=True)` when needed. Existing directories avoid the failed-mkdir path; removed directories are recreated. File collisions, missing ancestors, and permission failures still pass through the existing filesystem operations and error paths. A race removing the directory after the check remains an error, as was already possible after the previous mkdir call.
|
|
- Task ID validation is unchanged. Existing symlink/junction handling is unchanged. Rotation's link checks, thresholds, backup ordering, and rename operations remain in place.
|
|
- The event pre/post stamps and handle identity comparison, sequence invalidation, flush/fsync, current-command atomic writer, post-worker command comparison, `batch.request` job binding, backup-state durability, executor shutdown, and every step's event remain unchanged by this diff.
|
|
|
|
## Test evidence inspected
|
|
|
|
| Artifact | Tests | Failures | Errors | Skipped |
|
|
| --- | ---: | ---: | ---: | ---: |
|
|
| `build/release-queue-filesystem-red-20261019.xml` | 3 | 3 | 0 | 0 |
|
|
| `build/release-queue-filesystem-green-20261019.xml` | 19 | 0 | 0 | 0 |
|
|
| `build/release-queue-filesystem-errors-red-20261019.xml` | 8 | 3 | 0 | 0 |
|
|
| `build/release-queue-filesystem-final-20261019.xml` | 24 | 0 | 0 | 0 |
|
|
| `build/release-queue-performance-optimized-20261019.xml` | 1 | 0 | 0 | 0 |
|
|
|
|
The new tests check distinct-input resolution counts across two preparation calls, one-stat rotation for an existing small log, avoidance of redundant mkdir, recreation after removal, original absence/error semantics, and continued permission-error propagation. Existing suites cover path redirection, event sequence cache invalidation, rotation, and canonical immediate event visibility. The artifacts were read, not rerun by this reviewer.
|
|
|
|
## Performance and release limits
|
|
|
|
The unchanged independent 1,000-step test's supplied optimized metrics record **22.5226234 seconds**, 91 saved steps, and 2,210,321 peak bytes with tracemalloc enabled. The source still requires `elapsed < 30`, `peak < 128 MiB`, complete progress, exact saved/no-match counts, and 1,000 unique calls. No gate relaxation or workload reduction was found.
|
|
|
|
The final exception correction affects the cold error branch; the measured normal-file optimization remains the single-stat path. This static review does not substitute for building the final frozen artifact with the reviewed optimization. The coordinator's completed v2 live CAD acceptance applies to the preceding artifact; any final release claim must identify the rebuilt package and its applicable verification evidence.
|