Changelog¶
All notable changes to FileCleaner are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]¶
[1.1.0] - 2026-11-22¶
Added¶
- Pure-Rust S3 / S3-Compatible Archival Sink (
IDEA-001, Issues#24,#26,#28): - Added non-terminal
ActionStep::UploadS3(upload_s3),S3VerifyMode(checksum_sha256default,readback_sha256),S3Config(global[s3]and per-rule[rules.s3]resolved viaConfig::effective_s3),FileCleanerError::S3Upload(exit1), and static validation invariantsINV-CFG-08/10/13/14(src/config.rs,src/error.rs). - Implemented
src/s3.rs(S3Uploader,HttpS3Uploader,RedactedSecret) on a 100% pure-Rust stack (ureqv3default-features = false,rustlsv0.23default-features = false,rustls-rustcrypto,hmac,base64) preservingIMP-001(zero C/C++*-sys,ring,aws-lc-*, oropenssl-*across all 9 release targets). - Enforced AWS Signature Version 4 (
AWS4-HMAC-SHA256), streaming single-partPutObjectand S3 Multipart Upload (CreateMultipartUpload/UploadPart/CompleteMultipartUploadwith HTTP-200<Error>inspection and automaticAbortMultipartUpload), non-overwriteHeadObjectpreflight, bounded5xxretries, and fail-closed SHA-256 verification (HeadObjectx-amz-checksum-mode: ENABLEDwith composite<b64>-<N>matching, or streamingGetObjectreadback_sha256) before any localDelete,Trash, orMoveexecutes. - Integrated
UploadS3intoActionExecutor::execute_pipeline_with_s3(src/actions.rs) with TOCTOU-safeopen_regular_nofollow_read, zero-I/O dry-run URI projection,SweepEngine::run_config_with_s3(src/engine.rs), structured JSONLsha256&details(s3_uri,etag,verify_mode,parts_uploaded,verified_size), and loopback integration suite (tests/s3_archival_sink_test.rs). - DBA PostgreSQL WAL & Base-Backup Retention Profile (Issue
#30): - Added
filecleaner init --profile dba-postgres(TOML and YAML,dry_run = true) insrc/cli.rs. - Shipped validated production examples
examples/dba-postgres-wal-s3.tomlandexamples/dba-postgres-wal-s3.yaml, plus executable PITR/standby-replica boundary pre-delete hookexamples/hooks/verify_pg_wal_safe.sh(export LC_ALL=C, exit42veto on held/protected/non-WAL artifacts, fail-closed exit1on malformed markers). - Added end-to-end DBA workflow verification (
howto_workflow_5_dba_postgres_wal_and_base_backups_s3_archival_and_pitr_guards) intests/product_workflows_e2e_test.rs. - Reproducible Live Docker E2E Verification Harness (Issue
#32): - Delivered
scripts/e2e-dba-s3-lab.shandtests/e2e_dba_s3_docker_test.rsexercising all 6 DBA PostgreSQL 17 (postgres:17-bookworm, compatible withjmrenouard/multi-db-docker-env) + pinned MinIO (pgsty/minio:RELEASE.2026-08-04T00-00-00Z) scenarios live, including real 16 MiB WAL archival, active-writercheck-in-useexit10, MinIO outage and corrupt-checksum fault injection, 0-byte stub--fail-on-freezeexit3, and MinIO download + SHA-256audit.jsonlparity + full 253-row PostgreSQL 17 restore. - Synchronized Bilingual EN/FR Documentation & Governance (Issues
#34,#36): - Updated
docs/en/SPECIFICATIONS.md,docs/fr/SPECIFICATIONS.md,docs/en/COOKBOOK_EXAMPLES.md,docs/fr/EXEMPLES_RECETTES.md(Recipe 5),docs/en/USER_GUIDE.md,docs/fr/GUIDE_UTILISATEUR.md,docs/en/HOWTO.md,docs/fr/HOWTO.md,README.md, andREADME.fr.mdwith automated heading parity across all 5 EN/FR pairs intests/governance_and_docs_test.rs. - Marked
IDEA-001shipped indocs/RCA_REGISTER.md(APP-003,RCA-009) and loggedACT-010..ACT-016indocs/ACTION_LOGBOOK.md.
[1.0.1] - 2026-11-20¶
Added & Hardened¶
- Multi-Arch Docker Hub Container Packaging & CI Publishing (
Dockerfile,.dockerignore,.github/workflows/docker-publish.yml): Added hardened multi-stage Alpine/Debian-slim container (rust:1.100.0-bookwormbuilder -> non-rootdebian:bookworm-slimruntime UID/GID10001fcuser:fcgroup,HEALTHCHECK,VOLUMEmountpoints, bundledexamples/) and SHA-pinned Buildx workflow publishingjmrenouard/filecleaner(latest,v1.0.1,1.0.1) acrosslinux/amd64andlinux/arm64on release publication or manual dispatch. - Enterprise Release Notes (
docs/RELEASE_NOTES_v1.0.1.md) & Bilingual Sync: UpdatedREADME.md,README.fr.md, and EN/FR guides withv1.0.1binary archives and Docker Hub Quickstart commands.
Post-v1.0.1 Audit, Coverage & Documentation (Issue #20)¶
- Hook Stderr Drain Protection (
src/hooks.rs): Replaced unbounded/channel stderr forwarding with a boundedArc<Mutex<Vec<u8>>>buffer (MAX_HOOK_STDERR_BYTES = 64 KiB, UTF-8 char-boundary safe truncation) and bounded EOF drain grace (STDERR_DRAIN_GRACE) so failing hooks that spawn lingering background grandchildren still preserve their diagnosticstderrwithout blocking. - Template Validation & Ad-Hoc Rename Flag (
src/config.rs,src/cli.rs): Validated non-emptyrule.rename_templatestrftimeformats eagerly insideConfig::validate(), and automatically activatedActionStep::RenameByDatewhen--rename-templateis passed without--rename-by-datein ad-hoc CLI sweeps. - Process Identity Guard (
src/daemon.rs): Verifiedis_live_filecleaner_pid(pid)(is_pid_alive(pid) && is_filecleaner_process(pid)) in bothdaemon_statusandclaim_pid_file, treating recycled non-FileCleaner PIDs as stale rather than active daemons. - Bilingual 5-Minute HOWTO & Schema Alignment (
docs/en/HOWTO.md,docs/fr/HOWTO.md,docs/): Added beginner-friendly EN/FR quick-start HOWTO guides with automated heading parity and config validation tests, added cross-links across READMEs/User Guides/Cookbooks, and corrected thecheck-in-use --jsonwrapper schema example (all_safe,busy_count,reports). - Expanded Verification & Coverage (
tests/product_workflows_e2e_test.rs): Added end-to-end HOWTO workflow tests and targeted unit/integration coverage lifting the workspace to124passing tests (64unit +60integration across9suites) and94.31%line coverage (>= 90.21%persrc/*.rsmodule).
Security¶
- Symlink-Swap TOCTOU Hardening & Private Staging (
src/actions.rs,src/engine.rs): Added non-following regular-file opens (O_NOFOLLOWplus(st_dev, st_ino)verification on Unix;FILE_FLAG_OPEN_REPARSE_POINTplus reparse-point attribute validation on Windows),0o600private.fc-tmpstaging creation,copy_truncatepre/post inode continuity checks, and pre-execute symlink verification before running live action pipelines. - Private
0o600Runtime Files & Audit Rotation (src/audit.rs,src/daemon.rs,src/cli.rs,src/scanner.rs): Enforced0o600Unix permissions onaudit.jsonl,pid_file,state_file,stop_file, andfilecleaner initoutputs, plus50 MiBsingle-generation<audit_log>.1audit log rotation (DEFAULT_AUDIT_ROTATE_BYTES) with.1excluded from candidate scanning and daemon watching. - Hook Isolation & Pipe Deadlock Prevention (
src/hooks.rs): Switched hook childstdouttoStdio::null(), capped capturedstderrat64 KiBvia a boundedsync_channelwith50 msdrain grace (preventing background grandchildren from deadlocking pipe EOF), isolated Unix children inprocess_group(0), and terminated full process groups on timeout (SIGKILL). - Daemon
stopPID Identity Guard (src/daemon.rs): Verified that any live PID referenced bypid_filebelongs to afilecleanerprocess (is_filecleaner_processvia/procon Linux,pson non-Linux Unix, orQueryFullProcessImageNameWon Windows) before writingstop_fileor sendingSIGTERM. - GitHub Actions Supply-Chain Hardening (
.github/workflows/ci.yml,.github/workflows/release.yml): Pinned everyuses:action to an immutable 40-character commit SHA, moved${{ ... }}matrix/ref values intoenv:out ofrun:scripts, and restrictedcontents: writestrictly topublish-release.
Fixed¶
- Idempotent Multi-Sweep
Compress&RenameByDate(src/actions.rs,src/scanner.rs): Prevented repeated daemon sweeps from looping into_date_dateor.gz.gzon rules without terminal removal steps (has_compressed_extension,has_trailing_date_stamp). - Accurate Quota Accounting for In-Place Actions (
src/policy.rs): Distinguished file-removing (Delete,Trash,Move,CopyTruncatewithmin_file_size > 0) and byte-reclaiming actions inRetentionEngine::plansoremaining_files,remaining_bytes, andRuleOutcome::Constrainedremain exact forRenameByDate,Compress(compress_remove_source = false), andCopyTruncate.
Performance¶
- Non-Intrusive & Read-Only In-Use Probing (
src/in_use.rs,src/engine.rs,src/cli.rs): Used non-exclusiveLOCK_SH | LOCK_NB/FILE_SHARE_READlock probing during dry-run/plan, evaluated sidecars,/proc/*/fd, andmin_idle_age+ protected floor \(P_{\text{floor}}\) prior to OS lock probes, cached/procinode snapshots once per sweep viaSweepLockProbe(removing redundantread_linkcalls), batchedfilecleaner check-in-use <PATH...>viaInUseDetector::check_paths, precompiled rule regex/glob matchers once per sweep/daemon run (CompiledRuleMatchers), and reduced daemonSTOP_POLL_SLICEto200 ms.
Changed¶
- Lean Code Deduplication (
src/config.rs,src/scanner.rs,src/daemon.rs,src/cli.rs): Unified lexical path normalization oncrate::config::resolve_path_lexically, consolidated rule matcher compilation incompile_rule_matchers, and reuseddaemon::write_atomic_bytes_with_modefromcli.rswith zero newCargo.tomldependencies.
[1.0.0] - 2026-11-20¶
Added¶
- Fail-Closed 6-Phase Retention Engine (
Scan -> InUseProbe -> BackupGuard -> RetentionEval -> PreHook -> Execute) - Deterministic newest-first ordering with normalized POSIX relative-path tie-breaking.
TimeBasissupport formodified(mtime),created(birthtime, fail-closed without silent fallback on unsupported filesystems), andfilename_date(regex+chronostrftime, fail-closed skip on unparseable names).- Glob (
globset) and Rustregexinclude/exclude filters,min_file_size/max_file_sizebounds,recursive+max_depth, and safefollow_symlinks = falsedefault. -
Flexible retention caps (
max_files,max_age,max_total_size) withCombineMode::{Any, All},EvictionOrder::{OldestFirst, LargestFirst}, human-readable SI/IEC byte sizes (B..PB/PiB), and compound durations (ms,s,m,h,d,w). -
Backup Safety Guardrails (
backup_guard) - Minimum valid backup threshold (
min_valid_backup_bytes, aliasmin_valid_size) filtering out corrupt/0-byte stubs prior to floor or freshness checks. - Protected newest valid backup floor (
min_keep_files) strictly excluded from eviction (E ∩ P_floor = ∅). - Dead-man's-switch staleness freezes (
require_newer_within,freeze_if_newest_older_than,freeze_on_empty_valid). -
Non-destructive constraint conflict resolution (
RuleOutcome::Constrained) ensuring safety floors and active locks always win, with optional strict exit code3via--strict-constraintsand--fail-on-freeze. -
6-Layer In-Use File Detection Matrix (
in_use&check-in-use) - Sidecar and partial-transfer suffix detection (
.lock,.lck,.part,.tmp,.processing, configurable). - Unix cooperative
flock(LOCK_EX | LOCK_NB)viaO_RDONLYwithout alteringmtime. - Linux
/proc/*/fdopen file descriptor(st_dev, st_ino)scan with non-blocking diagnostic logging for unprivilegedEACCES/EPERM. - Windows kernel-enforced
OpenOptionsExt::share_mode(0)probe. -
Minimum idle age cooldown (
min_idle_age, including future-skew protection) and batched two-point(size, mtime)stability verification (stability_window). -
Shell-Injection-Free Pre-Delete Lifecycle Hooks (
pre_delete_hook) - Direct process execution via
Command::new(argv, neversh -corcmd /C) with token interpolation ({path},{name},{size},{mtime_iso},{rule}) andFILECLEANER_*environment variables. -
Configurable wall-clock
timeoutwith process termination/reaping, graceful per-file skip exit code (skip_exit_code = 42default), and failure policies (abort_file,abort_rule,warn_and_continue). -
Atomic Lifecycle Pipeline & Pure-Rust Compression (
actions) - Sequential
WorkingTargetcomposition acrossrename_by_date,compress,move,copy_truncate(explicit opt-in with validation advisory),trash, anddelete. - 100% pure-Rust compression codecs (
gzipviaflate2/miniz_oxide,lz4vialz4_flex,brotli,zippure-Rustdeflate) preserving originalatime/mtimevia Rust stdlibstd::fs::FileTimes(File::set_times). - Crash-safe
.fc-tmpstaging +sync_all()+ atomicrename, plus cross-filesystem (EXDEV) dual-read SHA-256 integrity verification before source unlink. -
Strict
plan/--dry-runparity with zero filesystem mutations or.fc-tmpartifacts. -
CLI, Daemon Mode & Structured Audit Logging
- Complete CLI (
clapv4):run(aliasclean),plan(supporting both--configand ad-hoc--dirmode),check-in-use <PATH...>,validate [PATH],init(--profile backups|logs|spool), anddaemon {run, status, stop, service-template}with deterministic exit codes (0,1,2,3,4,10) and--jsonsupport. - Daemon scheduling across
interval,notify(debounced filesystem watcher), andhybridmodes, atomicpid_fileand live JSONstate_file, cooperativestop_file+SIGINT/SIGTERMmid-file-safe shutdown, bounded--max-sweeps, and OS service templates forsystemd,launchd, and Windows Task Scheduler. -
Synchronous UTF-8 JSONL structured audit logging (
[audit].log_path/--audit-log). -
9-Target Cross-Platform Portability & Bilingual Documentation
- Zero C/C++
-sysdependencies, supporting Linux (x86_64/aarch64gnu&musl, plusarmv7-unknown-linux-gnueabihf), Windows (x86_64/aarch64MSVC), and macOS (aarch64/x86_64Darwin), verified with95passing tests (57unit +38integration across8suites),0Clippy warnings, and92.85%line coverage across8,082lines (cargo llvm-cov --fail-under-lines 90). - Synchronized bilingual English & French documentation:
README.md/README.fr.md,docs/en/SPECIFICATIONS.md/docs/fr/SPECIFICATIONS.md,docs/en/USER_GUIDE.md/docs/fr/GUIDE_UTILISATEUR.md,docs/en/COOKBOOK_EXAMPLES.md/docs/fr/EXEMPLES_RECETTES.md, custom SVG/PNG branding (docs/assets/*), and engineering governance registers (docs/ACTION_LOGBOOK.md,docs/RCA_REGISTER.md).