RCA Register — Errors, Technical Dead-Ends, Approximations & Unimplemented Ideas¶
Governance Rule (
AGENTS.md§3 &.agents/rules/project-governance.md): This register guarantees full engineering traceability for the FileCleaner project (strictly in English). It MUST be systematically updated on every request, every change, and every result across its four sections: 1. Errors & Bugs Encountered (Root Cause Analysis —RCA-XXX) 2. Technical Dead-Ends & Abandoned Leads (IMP-XXX) 3. Current Approximations & Simplifying Assumptions (APP-XXX) 4. Unimplemented Ideas & Future Roadmap (IDEA-XXX)
1. Errors & Bugs Encountered (Root Cause Analysis — RCA)¶
RCA-001 — WSL2 /tmp tmpfs Exhaustion (ENOSPC) Under Concurrent CARGO_TARGET_DIR Build Caches¶
- Date / Linked Action:
2026-11-20(ACT-004/ Issue#12) - Observed Symptom:
- During Wave 3
cargo testcompilation inside WSL2 Ubuntu-24.04, Rust build andTempDircreation failed withNo space left on device (os error 28)(ENOSPC) while/tmptmpfsreached7.7G / 7.7G(100%full). - Root Cause Analysis (5 Whys):
- Why did
/tmprun out of disk space? Because cumulative Cargo build and LLVM coverage target caches from Wave 1 and Wave 2 workers (/tmp/filecleaner-target,/tmp/filecleaner-target-core,/tmp/filecleaner-target-actions) consumed5.0Ginside the7.7GRAM-backed/tmptmpfs. - Why were multiple large target caches kept in
/tmp? Because isolated worktree builds defaulted to/tmp/filecleaner-target-*without pruning stale worker caches or using persistent Linux storage (/var/tmp,769Gfree). - Applied Change / Fix:
- Cleared stale
/tmp/filecleaner-target*caches from/tmpto restore healthyTempDirexecution and standardized Wave 3+ WSL2 builds and coverage runs onCARGO_TARGET_DIR="/var/tmp/filecleaner-target-*"(strictly outside Dropbox and off RAM-limited/tmp). - Result & Non-Regression Test:
- Full
cargo test(94/94passing) andcargo llvm-cov(92.67%–92.68%coverage) completed with zeroENOSPCerrors.
RCA-002 — Cross-OS GitHub Actions CI Failures & Warnings on windows-latest and macos-latest (PR #15 / Run 44712069431)¶
- Date / Linked Action:
2026-11-20(ACT-005/ Issue#14/ PR#15) - Observed Symptom:
- While
ubuntu-latestpassedfmt-and-clippy,coverage-gate >= 90%, andcross-os-test(94/94), GitHub Actions CI Run44712069431failed onwindows-latestandmacos-latestwith:src/in_use.rs:956:assertion failed: direct_missing.fatal_error.is_some()on both Windows and macOS.src/scanner.rs:909:assertion left != right failed(resolved_ts == modified_ts) onmacos-latest.src/scanner.rs:982:overflow when adding duration to SystemTimepanic onwindows-latest.- Windows compiler warnings (
src/daemon.rs:514-515unusedmut signal_sentandtarget_pid;tests/hooks_pre_delete_test.rsunused imports/helpers;tests/retention_age_size_count_test.rs:6unusedFileCleanerError) under#[cfg(unix)]-gated test/signal paths.
- Root Cause Analysis (5 Whys):
- Why did
src/in_use.rs:956fail on Windows/macOS? BecauseOsLockProbe::check_proc_fd_batchonly scans/proc/*/fdon#[cfg(target_os = "linux")]and returns an emptyProcFdProbeOutcomeon non-Linux platforms, yet the test unconditionally assertedfatal_error.is_some(). - Why did
src/scanner.rs:909fail on macOS APFS? Because APFS clampsst_birthtimebackward tomtimewhenevermtimeis explicitly set older thanbirthtime(1_500_000_000in 2017 vs. 2026 creation time), makingcreated_ts == modified_ts. - Why did
src/scanner.rs:982panic on Windows? Because WindowsSystemTime(FILETIME) caps out around year 30828 AD, so uncheckedUNIX_EPOCH + Duration::from_secs(u64::MAX / 2)overflows insideSystemTime::add. - Why were Windows-specific warnings and handle-lifetime subtleties missed before pushing? Because local verification ran exclusively on WSL2 Linux (
ubuntu-latest) andcross-os-testin.github/workflows/ci.ymlrancargo test --all-targetswithoutcargo clippy --all-targets -- -D warnings. - Applied Change / Fix:
src/in_use.rs: Gateddirect_missing.fatal_error.is_some()with#[cfg(target_os = "linux")]and asserted empty/non-fatal outcome under#[cfg(not(target_os = "linux"))].src/scanner.rs: Updatedscan_rule_time_basis_created_succeeds_or_fails_without_fallbackto advancemtimeinto the future (>= 1_900_000_000) so APFS/NTFS/ext4 preserve distinctbirthtime, and switched overflow tests insystem_time_overflow_and_lexical_path_resolution_handle_edge_casestochecked_add/checked_sub.src/daemon.rs: Replacedmut signal_sent/target_pidindaemon_stopwith clean#[cfg(unix)]/#[cfg(not(unix))]branches, added bounded WindowsPermissionDeniedretry on atomic state rename, scoped file-handle drops before daemon deletions, and enabled cross-OS stop-file shutdown coverage.- Integration Tests (
tests/hooks_pre_delete_test.rs,tests/retention_age_size_count_test.rs,tests/in_use_detection_test.rs,tests/daemon_and_cli_test.rs): Gated Unix-only imports/helpers cleanly, added cross-platform and#[cfg(windows)]hook (powershell.exe/ping.exe) andshare_mode(0)lock tests, and removed Notify/mtime timing races. .github/workflows/ci.yml: Addedcomponents: clippyandcargo clippy --all-targets -- -D warningstocross-os-testacross all 3 runner OSes.- Result & Non-Regression Test:
- Verified locally in WSL2 (
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings,cargo test,cargo llvm-cov --fail-under-lines 90) and queued for multi-OS GitHub Actions re-verification acrossubuntu-latest,windows-latest, andmacos-latest.
RCA-003 — windows-latest clippy::needless_bool and macos-latest Zombie is_pid_alive Timeout (PR #15 / Run 44714006240)¶
- Date / Linked Action:
2026-11-20(ACT-005/ Issue#14/ PR#15) - Observed Symptom:
- GitHub Actions CI Run
44714006240passed all threeubuntu-latestjobs (fmt-and-clippy,coverage-gate >= 90%,cross-os-test), passed57/57unit tests and7/8integration suites onmacos-latest, and surfaced two platform-specific defects:windows-latest(cargo clippy --all-targets -- -D warnings): failed onsrc/actions.rs:914withclippy::needless_bool(this if guard returns a bool literal and is followed by another).macos-latest(tests/daemon_and_cli_test.rs:643):cli_daemon_subprocess_lifecycle_notify_status_duplicate_pid_stop_and_templatestimed out infilecleaner daemon stop --timeout 10s(timed out after 10000ms waiting for daemon PID ... to stop).
- Root Cause Analysis (5 Whys):
- Why did
src/actions.rs:914triggerclippy::needless_boolon Windows? Because#[cfg(unix)]compiled out thelibc::EXDEVbranch on Windows, collapsingis_cross_device_errortoif err.kind() == io::ErrorKind::CrossesDevices { return true; } false. - Why did
daemon stoptime out on macOS? Because the test spawnsfilecleaner daemon runas a child process and holds its un-waitedstd::process::Childhandle until afterdaemon stopreturns; when the daemon exits, it remains a zombie (Z) until reaped. On Linuxis_linux_zombiechecks/proc/<pid>/stat, whereas on macOSkill(pid, 0)continued returning0on the zombie process. - Why did
is_pid_aliveon Windows usetasklist.exe? Because no native Win32 handle check was wired, risking unnecessary process-spawn overhead and differing exit semantics for un-waitedChildhandles (STILL_ACTIVE). - Applied Change / Fix:
src/actions.rs: Rewroteis_cross_device_errorwith clean#[cfg(unix)]and#[cfg(not(unix))]boolean expressions.src/daemon.rs: Addedis_non_linux_unix_zombie(ps -o stat= -p <pid>) under#[cfg(all(unix, not(target_os = "linux")))]so macOS/BSD zombies reportfalse, and replacedtasklist.exeunder#[cfg(windows)]with directkernel32FFI (OpenProcess+GetExitCodeProcesscheckingSTILL_ACTIVE == 259+CloseHandle).- Local Cross-Target Verification: Added
x86_64-pc-windows-gnuandaarch64-apple-darwintargets in WSL2 to runcargo clippy --lib --bins --tests --target <triple> -- -D warningslocally prior to pushing. - Result & Non-Regression Test:
- Cross-target Clippy (
x86_64-pc-windows-gnu,aarch64-apple-darwin,x86_64-unknown-linux-gnu) passed with zero warnings, alongside full WSL2cargo fmt,cargo test, andcargo llvm-cov --fail-under-lines 90.
RCA-004 — macOS /var -> /private/var TempDir Symlink Divergence in hooks_pre_delete_test.rs:142 and Stock macOS shasum Portability (PR #15 / Run 44715379817)¶
- Date / Linked Action:
2026-11-20(ACT-005/ Issue#14/ PR#15) - Observed Symptom:
- GitHub Actions CI Run
44715379817passed 4 of 5 jobs (Format & Clippy,Line Coverage Gate >= 90%,Cross-OS Test Suite (ubuntu-latest), andCross-OS Test Suite (windows-latest)— including strictcargo clippy --all-targets -- -D warningson Windows), passed57/57unit tests and7/8integration suites (includingdaemon_and_cli_test6/6) onmacos-latest, and failed on a single assertion intests/hooks_pre_delete_test.rs:hook_direct_argv_blocks_shell_injection_and_passes_all_env_vars(tests/hooks_pre_delete_test.rs:142):PWD=comparison failed onmacos-latest.
- Root Cause Analysis (5 Whys):
- Why did
captured.contains(&format!("PWD={}", workdir.display()))fail on macOS? Because on macOS/varis a symlink to/private/var;tempfile::TempDircreates paths under/var/folders/..., whereasbash's$(pwd)inside the hook script resolves the physical path/private/var/folders/.... - Why might stock macOS environments also fail running
examples/hooks/*.shwithout GNU coreutils? Because bare macOS ships BSDshasum -a 256(andopenssl) rather than GNUsha256sum. - Applied Change / Fix:
tests/hooks_pre_delete_test.rs: Updated thePWD=assertion inhook_direct_argv_blocks_shell_injection_and_passes_all_env_varsto accept eitherworkdir.display()orfs::canonicalize(&workdir).examples/hooks/verify_checksum_before_delete.sh&examples/hooks/archive_to_s3_mock.sh: Added acompute_sha256()helper that checkssha256sum, falls back toshasum -a 256(stock macOS/BSD), and falls back toopenssl dgst -sha256.- Result & Non-Regression Test:
- Verified locally in WSL2 (
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warningsacross Linux,x86_64-pc-windows-gnu, andaarch64-apple-darwin,cargo test95/95includingexample_hook_scripts_execute_veto_and_verify_checksums, andcargo llvm-cov --fail-under-lines 90).
RCA-005 — Intermittent macOS FSEvents Delayed Self-Unlink Sweep Count Failure in daemon_notify_and_cooperative_stop_file_work_deterministically (main Post-Merge Run 44716793832)¶
- Date / Linked Action:
2026-11-20(ACT-006/ Issue#16) - Observed Symptom:
- Post-merge
pushCI Run44716793832onmain(commitaee4028) passed 4 of 5 jobs (Format & Clippy,Line Coverage Gate >= 90%,Cross-OS Test Suite (ubuntu-latest), andCross-OS Test Suite (windows-latest)) and failed intermittently onCross-OS Test Suite (macos-latest)atsrc/daemon.rs:daemon::tests::daemon_notify_and_cooperative_stop_file_work_deterministically:assertion left == right failed(left: 2,right: 1forfinal_state.sweeps_completed).
- Root Cause Analysis (5 Whys):
- Why did
final_state.sweeps_completedequal2instead of1onmacos-latest? Because the notify watcher fired a second debounced sweep after sweep #1 had already completed and returned toDaemonStatus::Idle. - Why did a filesystem event trigger a second sweep after sweep #1? Because sweep #1 itself unlinked
a_old.loginsidewatch_dir, and macOSFSEventsdelivers directory-change notifications asynchronously viafseventsdwith non-deterministic coalescing latency. When the self-deletion notification fora_old.logarrives after the30msdebounce window (cfg.daemon.debounce = Duration::from_millis(30)), the daemon runs another sweep undermax_sweeps = Some(5)before processingstop_file. - Why did the test fail intermittently? Because the unit test asserted strict equality
assert_eq!(final_state.sweeps_completed, 1)rather than verifying bounded notify execution (1..=5matchingmax_sweeps = Some(5)) alongside exact retention (!old.exists(),newer.exists()) and fast cooperative shutdown (< 2s,DaemonStatus::Stopped). - Applied Change / Fix:
src/daemon.rs: Updateddaemon_notify_and_cooperative_stop_file_work_deterministicallyto assertassert!((1..=5).contains(&final_state.sweeps_completed));undermax_sweeps = Some(5), preserving all retention and cooperative stop-file assertions.- Result & Non-Regression Test:
- Verified locally in WSL2 (
cargo fmt --all -- --checkPASS,cargo clippy --all-targets -- -D warningsPASS with0warnings,cargo testPASS95/95(57unit +38integration across 8 suites),cargo llvm-cov --all-targets --workspace --summary-only --fail-under-lines 90PASS at92.84%line coverage across8,082lines). Pending PR & post-merge multi-OS CI verification acrossubuntu-latest,windows-latest, andmacos-latest.
RCA-006 — Ponytail Security, Correctness, Scale, and CI Hardening Audit (Issue #18)¶
- Date / Linked Action:
2026-11-20(ACT-007/ Issue#18) - Observed Symptom:
- A full post-
v1.0.0Ponytail engineering and security audit uncovered 6 critical security/correctness/scale defects alongside 8 companion CI, permission, latency, and code-deduplication improvements:- Symlink-swap TOCTOU & world-readable staging (
#1):copy_stream_with_sha256,compress_file_staged,execute_copy_truncate, andexecute_pipelineopened candidate files with default following semantics and default umask.fc-tmpstaging, allowing a symlink swapped afterScanner::scan_ruleto hijack reads, overwrites, or truncation. - Daemon in-place
.gz.gz/_date_dateinfinite loop (#2): Repeated daemon sweeps re-matched already date-stamped or already compressed files on rules lacking terminal removal steps, appending duplicate_YYYYMMDD_HHMMSSstamps and.gz.gzextensions indefinitely. - In-place quota accounting error (
#3):RetentionEngine::planunconditionally decrementedremaining_filesandremaining_bytesfor every evicted candidate, falsely reportingmax_files/max_total_sizesatisfied onRenameByDate,Compress(compress_remove_source = false), andCopyTruncate(min_file_size > 0vs0) instead ofRuleOutcome::Constrained. - Hook grandchild pipe deadlock & unbounded output (
#4):ProcessHookRunnerpiped child stdout and joined a blocking stderr thread after child exit; background grandchildren inheriting FDs blockedwait()until timeout, while unconstrained stdout/stderr risked memory exhaustion. - Intrusive exclusive OS lock probing (
#5):plan/--dry-runtook exclusiveflock(LOCK_EX)/ Windowsshare_mode(0)probes on every file including protected floor \(P_{\text{floor}}\) and recent files before checking sidecars,/proc, ormin_idle_age. - Recycled-PID
SIGTERMrisk indaemon stop(#6):daemon_stopsignaled any live PID found inpid_filewithout verifying executable identity, risking killing an unrelated process after an ungraceful crash and OS PID reuse. - Companion remediations (
#7–#14): unpinned GitHub Actions tags and script interpolation in workflows (#7), default-umask audit/state files and unboundedaudit.jsonlgrowth (#8), per-rule/procre-walking + redundantread_link(#9), coarse stop polling (#10), missing adversarial regression tests (#11), duplicated path normalizers (#12), repeated rule regex/glob compilation and duplicate CLI atomic writer (#13), and serialcheck-in-usestability sleeps (#14).
- Symlink-swap TOCTOU & world-readable staging (
- Root Cause Analysis (5 Whys):
- Why were TOCTOU and FD/PID hazards possible across multi-phase boundaries? Because scan, lock-probe, retention, hook, and execution phases operated over plain
PathBuf/ numericpidtokens without kernel handle pinning (O_NOFOLLOW/FILE_FLAG_OPEN_REPARSE_POINT),(dev, ino)continuity, or process image validation. - Why did daemon sweeps loop on in-place transforms and misreport quotas? Because
ScannerandActionExecutorlacked idempotency checks for already stamped/compressed outputs, andRetentionEngine::plantreated all action pipelines identically toDelete. - Why did hook execution and lock probing introduce hang/contention/O(N) latency risks? Because
ProcessHookRunnerblocked on inherited pipe EOF instead ofStdio::null()+ boundedmpsctimeout,InUseDetectorprobed OS locks eagerly before cheaper/non-intrusive layers, andcli check-in-uselooped per path. - Applied Change / Fix:
src/actions.rs&src/engine.rs: Addedopen_staged_tmp_private(0o600),open_regular_nofollow_read/open_regular_nofollow_write(O_NOFOLLOW+(dev, ino)verification on Unix;FILE_FLAG_OPEN_REPARSE_POINT+ reparse-point bit check on Windows),execute_copy_truncatepre/post identity check, pre-execute symlink re-check, plushas_compressed_extension/has_trailing_date_stampidempotency.src/scanner.rs&src/config.rs: AddedCompiledRuleMatchers/compile_rule_matchers,Scanner::compile_config/scan_rule_compiled, scanner-level in-place idempotency skip,<audit_log>.1exclusion, and unifiedcrate::config::resolve_path_lexically.src/policy.rs: Addedcompute_protected_floor_pathsand trackedremoves_file/reclaims_bytesseparately soremaining_files,remaining_bytes, andRuleOutcome::Constrainedstay exact for in-place transforms andCopyTruncate.src/hooks.rs: Switched stdout toStdio::null(), capped stderr to64 KiBviasync_channel(50 msdrain grace), isolated Unixprocess_group(0), and addedkill_hook_process_tree(SIGKILLto-pgidon timeout).src/in_use.rs&src/cli.rs: AddedLockProbe::check_os_lock_readonly(LOCK_SH | LOCK_NB/FILE_SHARE_READ),SweepLockProbesingle-passOnceLock/procsnapshot (removing redundantread_link),InUseDetector::check_batch_scoped(Layers 1/3/5 before OS locks, skippingP_floor), and batchedInUseDetector::check_paths; deleted duplicatewrite_atomic_cli_file.src/audit.rs&src/daemon.rs: Enforced0o600Unix permissions onaudit.jsonl,pid_file,state_file,stop_file, andinitconfigs; added50 MiB.1audit rotation (DEFAULT_AUDIT_ROTATE_BYTES); addedis_filecleaner_processguard indaemon_stop; loweredSTOP_POLL_SLICEto200 ms; deleted duplicatenormalize_lexical..github/workflows/ci.yml&.github/workflows/release.yml: Pinned alluses:steps to 40-char commit SHAs, replaced script${{ ... }}interpolation withenv:, and scopedcontents: writesolely topublish-release.- Result & Non-Regression Test:
- Added regression tests across
tests/actions_pipeline_test.rs,tests/hooks_pre_delete_test.rs,tests/retention_age_size_count_test.rs,tests/in_use_detection_test.rs,tests/daemon_and_cli_test.rs,tests/governance_and_docs_test.rs, and unit modules. - Verified in WSL2 (
/var/tmp/filecleaner-target-verify):cargo fmt --all -- --checkPASS,cargo clippy --all-targets -- -D warningsPASS (Linux +x86_64-pc-windows-gnu+aarch64-apple-darwin),cargo test --all-targetsPASS (112/112:62unit +50integration across 8 suites), andcargo llvm-cov --fail-under-lines 90PASS (93.09%lines,90.85%regions across8,678lines).
RCA-007 — Post-v1.0.1 Audit Edge Cases (Hook Stderr Drain, Ad-Hoc Rename Template, Foreign PID Status, and Cookbook JSON Schema) (Issue #20)¶
- Observed Symptom:
- A failing pre-delete hook that left a background grandchild holding
fd 2open did not deliver capturedstderrover the one-shot channel unless EOF completed before returning, risking lost failure diagnostics. - Malformed
rename_templatevalues (empty or invalidstrftimespecifiers such as"%Q") passedfilecleaner validateand failed only at action execution time; passing ad-hoc--rename-templatewithout--rename-by-datesilently ignored the template. - Recycled OS PIDs held by non-FileCleaner processes caused
daemon statusandclaim_pid_file(which checked onlyis_pid_alive) to treat an unrelated process as an active FileCleaner daemon. docs/en/COOKBOOK_EXAMPLES.mdanddocs/fr/EXEMPLES_RECETTES.mdshowed a flattenedcheck-in-use --jsonpayload without the real{ all_safe, busy_count, reports: [...] }envelope andkindtags.- Test coverage of
src/actions.rsstarted below90%(88.39%) due to untested multi-chunk,CopyTruncate,DryRun, collision, and error-boundary branches. - Root Cause Analysis (5 Whys):
hooks.rswaited to receive the full byte buffer on EOF instead of reading incrementally into a shared bounded buffer with a drain grace timeout;config.rscheckedmove_date_subdirinvalidate()while skippingrename_template;cli.rsgatedActionStep::RenameByDateonly on--rename-by-date;daemon_stopusedis_filecleaner_processwhiledaemon_status/claim_pid_filecheckedis_pid_alivealone; documentation JSON and code blocks were not yet cross-checked by integration tests.- Applied Change / Fix:
- Updated
src/hooks.rs(Arc<Mutex<Vec<u8>>>bounded capture up to64 KiBat UTF-8 char boundaries +STDERR_DRAIN_GRACE),src/config.rs(eagerrename_templatevalidation),src/cli.rs(rename_by_date || rename_template.is_some()),src/daemon.rs(is_live_filecleaner_pid),src/scanner.rs(lean regex reuse), fixed Cookbook JSON examples, published EN/FRHOWTO.md, and enforced doc config validation intests/governance_and_docs_test.rs. - Result & Non-Regression Test:
- Verified in WSL2 (
CARGO_TARGET_DIR=/var/tmp/filecleaner-target-plan):cargo fmt --allPASS, 3-targetcargo clippy --all-targets -- -D warningsPASS (0warnings),cargo test --all-targetsPASS (124/124tests acrosssrc/lib.rsand9integration suites includingtests/product_workflows_e2e_test.rs), andcargo llvm-cov --fail-under-lines 90PASS (94.31%line coverage across9,098lines;actions.rslifted to90.21%, all modules>= 90.21%).
RCA-008 — Windows CI Test Failures (share_mode(0) Open Write Handle, NTFS : Filename Character, and Top-Level TOML Array) (Issue #20 / PR #21)¶
- Observed Symptom:
Cross-OS Test Suite (windows-latest)failed insrc/lib.rsoncli::tests::execute_cli_covers_validate_check_in_use_init_sweep_and_daemon_branches(destinationapp_20231114.logmissing because file remained protected as busy) andscanner::tests::scanner_rejects_non_directory_root_and_applies_max_depth_size_bounds_and_rfc3339_dates(InvalidFilename/ Win32 error123).- Root Cause Analysis (5 Whys):
src/cli.rskeptf_handle(OpenOptions::new().write(true)) open when invokingexecute_cli(...); Unix permissive descriptors allowed rename anyway, whereas FileCleaner's own Windowsshare_mode(0)probe properly detected the open write handle and blocked eviction.src/scanner.rswrote sample test filenames containing:(09:00:00+00:00), which are illegal on Windows NTFS.- Inspection also revealed
tests/product_workflows_e2e_test.rsserializedVec<String>PowerShell hook arguments viatoml::to_string(&hook_args).unwrap_or_else(|_| "[]"), which silently fell back to"[]"because top-level TOML serialization requires a table. - Applied Change / Fix:
- Explicitly
drop(f_handle);insrc/cli.rsbefore runningexecute_cli(...). - Replaced colon timestamps in disk test filenames inside
src/scanner.rswith Windows-safe ISO-8601 basic timezone notation (%Y-%m-%dT%H%M%S%z,evt_2026-11-18T090000+0000.log). - Serialized
hook_argswithserde_json::to_string(&hook_args)insidetests/product_workflows_e2e_test.rsso backslash-escaped TOML string arrays preserve Windows PowerShell arguments intact. - Result & Non-Regression Test:
- Re-verified in WSL2 (
fmt, 3-targetclippy -D warnings,cargo test --all-targets124/124,cargo llvm-cov --fail-under-lines 9094.31%across9,098lines) and pushed commit to trigger full Windows/macOS/Linux GitHub Actions re-run onPR #21.
RCA-009 — Live Docker E2E Harness Portability (minio/minio Pull Denial, WSL2 Loopback & /tmp Bind-Mount Isolation, and PG17 initdb Socket Race) (Issue #32)¶
- Date / Linked Action:
2026-11-22(ACT-014/ Issue#32) - Observed Symptom:
- Executing the live 6-scenario Docker E2E harness (
scripts/e2e-dba-s3-lab.sh) inside WSL2 Ubuntu-24.04 against Docker Desktop surfaced four environment-specific failures:docker pull minio/minio:RELEASE.2025-04-22T22-12-26Zandquay.io/minio/miniofailed withpull access denied/ HTTP401.- Publishing MinIO with
-p 127.0.0.1:${MINIO_PORT}:9000causedurllib.error.URLError: timed outfrom WSL2 loopback. - Probing
pg_isready -U postgres -d labdbover the container Unix socket matched PostgreSQL 17's temporaryinitdbprocess right as it shut down (FATAL: the database system is shutting down). - Bind-mounting a
/tmptmpfsdirectory (-v /tmp/...:/wal_archive) wrote archived WAL files intodocker-desktop's isolated/tmpnamespace rather than Ubuntu-24.04's/tmp, leaving$WAL_DIRempty on the host.
- Root Cause Analysis (5 Whys):
- Upstream
minio/miniotags were gated/removed from public anonymous Docker Hub/Quay pulls, whereas pinned public multi-archpgsty/minio:RELEASE.2026-08-04T00-00-00Zremains anonymously pullable. - Docker Desktop WSL2 port forwarding binds reliably across WSL2 distros with
-p "${MINIO_PORT}:9000", whereas-p 127.0.0.1:...can bind only on the Windows loopback adapter. - The official
postgres:17-bookwormentrypoint runsinitdbwithlisten_addresses=''(Unix socket only), shuts down, and restarts with TCP listening on5432; only TCPpg_isready -h 127.0.0.1 -p 5432plusSELECT 1guarantees the post-initdbserver is live. - In WSL2 Ubuntu-24.04,
/tmpis a private per-distrotmpfsnot shared with thedocker-desktopmount namespace, whereas/var/tmpresides on the shared ext4 rootfs. - Applied Change / Fix:
scripts/e2e-dba-s3-lab.sh: Pinned defaultMINIO_IMAGEtopgsty/minio:RELEASE.2026-08-04T00-00-00Z, published MinIO via-p "${MINIO_PORT}:9000"with fail-fast health checks, switched PostgreSQL readiness to TCP (pg_isready -h 127.0.0.1 -p 5432+psql -h 127.0.0.1 -tAc "SELECT 1"), addedchmod 0644insidearchive_commandwith container-sidetouch -d, and defaultedTMP_ROOTto/var/tmp(FC_E2E_TMP_ROOT).- Result & Non-Regression Test:
- Live ignored test
cargo test --test e2e_dba_s3_docker_test -- --ignored --nocapturepassed all 6 scenarios in17.89s(4+ real 16 MiB WAL segments archived via pure-Rust LZ4 + SigV4 + verifiedx-amz-checksum-sha256against MinIO,check-in-useexit10+skip_in_use, MinIO outage & corrupt-checksum fault injection exit1with 100% local retention, 0-byte stub--fail-on-freezeexit3, and MinIO download + SHA-256audit.jsonlparity + full 253-row PostgreSQL 17 restore).
RCA-010 — Pre-Existing docs/en/HOWTO.md Double-Prefix Links Inside docs/RELEASE_NOTES_v1.0.1.md Caught by Diátaxis Link Gate (Issue #38)¶
- Date / Linked Action:
2026-11-23(ACT-017/ Issue#38) - Observed Symptom:
- Running
diataxis_check.py docs --strict --check-ste --lang enandmkdocs build --strictagainstv1.0.1surfaced two broken relative links on line 37 ofdocs/RELEASE_NOTES_v1.0.1.md:docs/en/HOWTO.mdanddocs/fr/HOWTO.mdresolved relative todocs/asdocs/docs/en/HOWTO.mdanddocs/docs/fr/HOWTO.md. - Root Cause Analysis (5 Whys):
- Why did those links resolve to
docs/docs/...? Becausedocs/RELEASE_NOTES_v1.0.1.mdlives insidedocs/yet used repository-root paths (docs/en/HOWTO.md,docs/fr/HOWTO.md) instead of relativeen/HOWTO.mdandfr/HOWTO.md. - Why was this undetected during
v1.0.1? Because prior governance tests checked Markdown LaTeX syntax, workflow SHAs, and EN/FR heading parity without resolving every Markdown relative link acrossdocs/**/*.mdor compilingmkdocs build --strict. - Applied Change / Fix:
- Fixed
docs/RELEASE_NOTES_v1.0.1.mdonmainto link cleanly toen/HOWTO.mdandfr/HOWTO.md. - Added
docs/docs/link normalization insidescripts/mkdocs_hooks.pyso the immutable historicalv1.0.1Git tag snapshot still passesmkdocs build --strictcleanly without rewriting Git tag history. - Added
test_zero_broken_relative_links_across_all_docsintests/test_diataxis_documentation.pyanddocs-ci.ymlto block future broken doc links before merge. - Result & Non-Regression Test:
diataxis_check.py docs --strict --check-ste --lang en,pytest tests/test_diataxis_documentation.py tests/test_mkdocs_publishing.py -v, and multi-versionscripts/build_versioned_docs.py(main,v1.0.1,v1.0.0) verify zero broken relative links on bothmainand immutable historical release tags.
2. Technical Dead-Ends & Abandoned Leads (IMP)¶
IMP-001 — C/C++ -sys Compression Bindings (zstd-sys, liblz4-sys, bzip2-sys, zlib-ng-sys) vs. Pure-Rust Compression Crates¶
- Context: Selecting compression libraries in
Cargo.tomlto supportgzip,lz4,brotli, andziparchive transforms across a 9-target cross-compilation release matrix (Linuxx86_64/aarch64gnu&musl, macOSx86_64/aarch64, Windowsx86_64/aarch64MSVC & GNU). - Why It Is a Dead-End:
- Crates wrapping C/C++ libraries (
*-sys) depend on externalcccross-compilers, target sysroots,cmake, ormusl-gcc/zigtoolchains duringcrossand GitHub Actions matrix builds. Cross-compilingzstd-sysorliblz4-systoaarch64-unknown-linux-muslor Windows ARM64 frequently fails on mismatched headers, linkers, or ABI flags. - Adopted Decision:
- Mandated pure-Rust compression backends only:
flate2with defaultminiz_oxide(pure Rust deflate/gzip),lz4_flex(pure Rust LZ4 frame/block),brotli(pure Rust Brotli), andzipwithdefault-features = false, features = ["deflate"](usingflate2/miniz_oxidewithoutzstd-sysorbzip2-sys). Zero C compiler toolchains are required for any target.
IMP-002 — Pushing .github/workflows/*.yml Over HTTPS gho_ OAuth Credentials¶
- Context: Repository remote configuration in GitHub initialization (
ACT-001/ Issue#1) and upcoming CI/CD release workflows. - Why It Is a Dead-End:
- GitHub CLI (
gh auth login) defaults to HTTPS credential helpers using OAuth tokens (gho_*) with'gist', 'read:org', 'repo', 'user'scopes, which lack the'workflow'scope. Anygit pushtouching.github/workflows/*.ymlis rejected by GitHub withrefusing to allow an OAuth App to create or update workflow ... without workflow scope. - Adopted Decision:
- Configured the
originremote strictly over SSH (git remote set-url origin git@github.com:jmrenouard/FileCleaner.git) immediately after repository creation, using authenticated SSH keys that possess full repository and workflow push permissions.
IMP-003 — Swarm workspace:"share" VCS Unknown Status vs. Explicit git worktree .worktrees/<role> Isolation¶
- Context: Coordinating parallel Wave 2 development across core retention (
Issue #7), actions/hooks (Issue #8), and bilingual documentation (docs/bilingual-guides-draft) inside a single Dropbox-synced Git repository on Windows. - Why It Is a Dead-End:
- Spawning swarm workers with
workspace:"share"on Windows inside a Dropbox-synced folder risks exposing anUnknownor unlinked VCS state to workers without deterministic branch provenance, complicates Windows/WSL2 path mapping, and breaks cleangit -Cintegration from the root controller. - Adopted Decision:
- Explicitly excluded
/.worktrees/in.git/info/exclude(and.gitignore) and provisioned dedicatedgit worktreedirectories (.worktrees/core,.worktrees/actions,.worktrees/docs,.worktrees/daemon) anchored directly tomain, giving each author an isolated branch and filesystem checkout while@devopsowns allgit/ghstaging, merging, and worktree cleanup from Windows PowerShell.
IMP-004 — Retaining Deprecated filetime = "0.2" Crate Alongside [lints.cargo] unused_dependencies = "allow"¶
- Context: Removing Wave 1 manifest lint suppressions in
Cargo.tomlduring Wave 3 integration (ACT-004/ Issue#12). - Why It Is a Dead-End:
src/actions.rspreserves timestamps using Rust standard librarystd::fs::File::set_times(std::fs::FileTimes, stable since Rust1.75) instead offiletime::set_file_times(which is deprecated infiletime 0.2.30). Keepingfiletime = "0.2"inCargo.tomltriggeredcargo::unused_dependencieswarnings once[lints.cargo]was removed.- Adopted Decision:
- Removed
filetime = "0.2"fromCargo.toml(andCargo.lock) and removed[lints.cargo] unused_dependencies = "allow", leaving zero unused dependencies and zero compiler/manifest warnings.
3. Current Approximations & Simplifying Assumptions (APP)¶
APP-001 — Unix Advisory flock + Linux /proc/*/fd vs. Windows share_mode(0) File-Lock Detection Semantics¶
- Target Scope: Planned
src/in_use.rsmulti-probe in-use file detection subsystem (v1.0.0 architecture). - Nature of the Approximation:
- Operating systems expose fundamentally different file-locking guarantees:
- Windows:
OpenOptionsExt::share_mode(0)performs a kernel-enforced exclusive-access probe against open handles held by external processes (even processes that did not opt into cooperative locking). - Linux:
flock(LOCK_EX | LOCK_NB)detects only cooperative advisory locks; to catch active un-flocked writers (e.g.,mysqldump,pg_dump,rsync,tar), FileCleaner additionally scans/proc/*/fdsymlink targets matching the candidate's(dev, ino)pair. - macOS / BSD (non-Linux Unix):
/proc/*/fddoes not exist in the default OS mount; detection relies onflock(LOCK_EX | LOCK_NB), sidecar lock/temp markers (.lock,.lck,.part,.tmp,.processing),min_idle_agecooldown, and the two-point(size, mtime)stability window.
- Windows:
- Justification & Impact:
- Provides high-precision, zero-external-binary (
lsof-free) lock detection across Linux, macOS, and Windows while remaining 100% pure Rust (std+libcon Unix). On non-Linux Unix systems, un-flocked active writers without sidecar files are caught bymin_idle_ageand the stability window rather than an immediate FD table scan. - Removal Condition:
- Scheduled for v1.1 enhancement (
IDEA-004) via native BSD/macOSlibproc(proc_pidinfo/PROC_PIDLISTFDS) orfanotify/ Restart Manager diagnostics without shelling out to external binaries.
APP-002 — Fixed 50 MiB Single-Generation <audit_log>.1 JSONL Audit Rotation Threshold¶
- Target Scope:
src/audit.rs(DEFAULT_AUDIT_ROTATE_BYTES),src/scanner.rs(build_internal_guard),src/daemon.rs(build_ignored_paths). - Nature of the Approximation:
AuditLogger::opendelegates toAuditLogger::open_with_max_bytes(path, DEFAULT_AUDIT_ROTATE_BYTES)with a compiled-in50 MiB(52,428,800bytes) cap and single-generation backup<audit_log>.1(overwriting.1on the next50 MiBboundary) rather than exposing new[audit]configuration keys inAuditConfigor unbounded numbered archive chains.- Justification & Impact:
- Prevents long-running
filecleaner daemoninstances from exhausting disk space with unbounded JSONL growth while preserving zero breaking changes toAuditConfig(v1.0.0schema contract) and zero external logrotate crate dependencies. Guarded identically alongside the primary audit log so sweep rules never prune<audit_log>.1. - Removal Condition:
- May be parameterized via optional
[audit].max_bytes/max_rotated_filesschema fields in a futurev1.1minor configuration extension if operators require multi-generation retention inside FileCleaner itself.
APP-003 — Pure-Rust TLS Cryptography via rustls-rustcrypto (v0.1.0-pre.0) Over ureq v3 (rustls-no-provider)¶
- Target Scope:
Cargo.toml,src/s3.rs(HttpS3Uploader),tests/governance_and_docs_test.rs. - Nature of the Approximation:
- To preserve
IMP-001(zero C/C++-sysbuild dependencies, zeroring, zeroaws-lc-sys, zeroopenssl-sys) across all 9 release cross-compilation targets (includingaarch64-unknown-linux-musl,armv7-unknown-linux-gnueabihf, andaarch64-pc-windows-msvc),HttpS3Uploaderconfiguresureqv3 (default-features = false,rustls-no-provider,rustls-webpki-roots) withrustlsv0.23 and the pure-Rustrustls-rustcryptoCryptoProvider(0.1.0-pre.0, RustCrypto implementations supporting RSA, ECDSA, Ed25519, AES-GCM, and ChaCha20-Poly1305). - Note that
Cargo.lockstill recordsringsolely as an inactive optional dependency entry ofrustls-webpki(alloc,stdfeatures only);cargo treeacross Linux, Windows, and macOS confirmsringandccare absent from the compiled build graph. - Justification & Impact:
- Guarantees deterministic single-binary cross-compilation without C cross-compilers or assembler toolchains while supporting standard TLS 1.2/1.3 endpoints including AWS S3 RSA certificates and MinIO TLS gateways. Slightly lower raw TLS throughput than hand-tuned C assembly (
aws-lc-rs) is negligible compared to WAN/LAN S3 archival I/O. - Removal Condition:
- Upgrade
rustls-rustcryptoto a stable0.1.x/1.0.xrelease once published by the RustCrypto organization, without reintroducing C/C++ build dependencies.
APP-004 — Immutable Git Tag Overlay (git archive + Dual EN/FR Quadrant Routing) for Pre-MkDocs Releases v1.0.0 & v1.0.1¶
- Target Scope:
scripts/build_versioned_docs.py,scripts/mkdocs_hooks.py,mkdocs.yml,mkdocs.fr.yml. - Nature of the Approximation:
- Release tags
v1.0.0andv1.0.1predate MkDocs Material, Diátaxis quadrant directories (docs/01-tutorials/..docs/04-explanation/,docs/fr/01-tutoriels/..docs/fr/04-explications/), and portal pages (docs/index.md,docs/fr/index.md;v1.0.0also lacksHOWTO.md). Rather than mutating immutable release tags,scripts/build_versioned_docs.pyextracts each tag viagit archive, overlays currentmkdocs.yml,mkdocs.fr.yml,scripts/mkdocs_hooks.py,docs/stylesheets/extra.css,docs/javascripts/katex.js, and fallback portal assets (docs/index.md,docs/fr/index.md,docs/assets/*.svg), building EN into<ver>/and FR into<ver>/fr/(plus per-version<ver>/versions.jsonwith"../<ver>/fr"entries and"fr"alias so Material'smikeversion picker stays inside the French sub-site). Meanwhilescripts/mkdocs_hooks.pyprunes missingnav:entries, mapsfr/to the French sub-site root, dynamically syncsextra.alternate, and routes missing quadrant or release-note links on historical snapshots to equivalent legacy guides orCHANGELOG.md. - Justification & Impact:
- Preserves cryptographic immutability of existing Git release tags (
v1.0.0,v1.0.1) while publishing cleanly isolated English (/<ver>/) and French (/<ver>/fr/) sites with version-preservingmike+extra.alternateswitchers and subpath-preserving IONOS Apache redirects (/,/fr/,/latest/,/dev/,/main/,/v1.0.1/,/v1.0.0/) undermkdocs build --strict. - Removal Condition:
- Future releases ship full native EN and FR Diátaxis quadrant trees, limiting fallback routing strictly to legacy
v1.0.xsnapshots.
4. Unimplemented Ideas & Future Roadmap (IDEA)¶
| ID | Target Release | Priority | Title | Target Module / Area | Description & Expected Value |
|---|---|---|---|---|---|
| IDEA-001 | Shipped in v1.1.0 |
High | S3 / Object-Storage Archival Sink Action (UploadS3) |
src/s3.rs, src/actions.rs, src/config.rs, src/engine.rs |
Implemented in v1.1.0 (Issues #24–#36): Pure-Rust AWS SigV4 (ureq v3 + rustls-rustcrypto), streaming single-part & multipart upload, fail-closed SHA-256 (checksum_sha256 / readback_sha256) verification before local deletion, --profile dba-postgres, and live PG17 + MinIO Docker E2E harness. |
| IDEA-002 | v1.2 |
High | Prometheus & OpenTelemetry Metrics Endpoint for Daemon Mode | src/daemon.rs, src/audit.rs |
Expose an optional lightweight HTTP /metrics endpoint in filecleaner daemon run reporting swept file counts, reclaimed bytes, backup-guard freezes, in-use skips, and hook latencies. |
| IDEA-003 | v1.2 |
Medium | Native OS Recycle Bin / Freedesktop Trash Specification Support | src/actions.rs |
Supplement configurable trash_dir quarantines with native Freedesktop .Trash-<uid> (info/*.trashinfo) on Linux and Windows Shell / macOS Trash APIs when trash_dir is omitted. |
| IDEA-004 | v1.2 |
Medium | macOS libproc FD Inspection & Windows Restart Manager (RmGetList) Attribution |
src/in_use.rs |
Enrich filecleaner check-in-use output with lock-holder PID and process executable name on macOS (proc_pidinfo) and Windows (rstrtmgr.dll RmGetList) matching Linux /proc/*/fd precision. |