Commit 55628e0
feat(rust-cli): secure_delete + audit_log real impls + typed-error refactor + 15-25 prop-tests (#72)
- secure_delete (commands::secure_deletion::secure_delete) lifted to a public,
documented primitive: 3-pass overwrite (urandom / zeros / 0xFF) with fsync
between passes + unlink. Uses /dev/urandom on Unix, falls back to a
hash-mixed PRNG elsewhere. CoW / FTL / snapshot limitations documented at
the module-level rustdoc.
- audit_log: added AuditLog::default_path() and AuditLog::with_default_path()
honouring XDG_STATE_HOME / $HOME per the XDG Base Directory spec
(XDG_STATE_HOME/valence-shell/audit.log or
$HOME/.local/state/valence-shell/audit.log).
- Replaced all six `unreachable!()` calls in src/commands.rs with typed
`CommandError` (`#[non_exhaustive]`) variants — InternalUnreachableInverseArm,
InternalUnreachableIrreversible, InternalUnreachableExplainPathArm — plus a
contextual anyhow::bail! for the &str-returning hardware-erase dispatch.
Future regressions in upstream filtering now surface as recoverable errors
rather than aborting the shell.
- Added impl/rust-cli/tests/secure_audit_prop_tests.rs with 20 property tests
covering:
- mkdir/rmdir reversibility (Lean: FilesystemModel.mkdir_rmdir_reversible)
- touch/rm reversibility
- writeFileReversible
- copyFile_reversible
- obliterate_not_injective (no inverse exists)
- inverse round-trip well-formedness for all reversible OperationTypes
- secure_delete unlink behaviour + EISDIR + ENOENT + edge sizes (0, 1)
- audit-log append-only / order-preservation / filter-by-type
- audit-entry JSON round-trip
- XDG default-path resolution
- Implemented the two security_tests.rs stubs
(security_gdpr_secure_deletion, security_audit_trail_immutability) which
previously held TODO markers.
Echo-types audit: filesystem-reversibility properties exercised here are L3
(echo-layer) shape per the prior estate sweep. The implementation does not
yet *import* echo-types directly — recorded as relevant-but-not-yet-imported
per the cross-doc directive.
Local verification:
- cargo build --lib : clean
- cargo test --workspace : 757 passed / 0 failed (the 21 test-binaries all
return "0 failed", including the new 20 prop-tests and the 2 unstubbed
security_tests).
- cargo clippy --workspace --tests : pre-existing absurd_extreme_comparisons
errors in confirmation.rs and e2e_script_execution.rs persist (verified
against main via stash). Zero new clippy warnings on changed files.
Closes the practice-gap #1 + #2 from #45. Refs #41 Phase 1, #43 prop-test expansion.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9626ac1 commit 55628e0
5 files changed
Lines changed: 741 additions & 72 deletions
File tree
- impl/rust-cli
- src
- commands
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
138 | 173 | | |
139 | 174 | | |
140 | 175 | | |
| |||
316 | 351 | | |
317 | 352 | | |
318 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
319 | 384 | | |
320 | 385 | | |
321 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
18 | 52 | | |
19 | 53 | | |
20 | 54 | | |
| |||
949 | 983 | | |
950 | 984 | | |
951 | 985 | | |
952 | | - | |
953 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
954 | 991 | | |
955 | 992 | | |
956 | | - | |
957 | | - | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
958 | 998 | | |
959 | 999 | | |
960 | 1000 | | |
| |||
1435 | 1475 | | |
1436 | 1476 | | |
1437 | 1477 | | |
1438 | | - | |
1439 | | - | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
1440 | 1483 | | |
1441 | 1484 | | |
1442 | | - | |
1443 | | - | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1444 | 1490 | | |
1445 | 1491 | | |
1446 | 1492 | | |
| |||
1952 | 1998 | | |
1953 | 1999 | | |
1954 | 2000 | | |
1955 | | - | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
1956 | 2010 | | |
1957 | 2011 | | |
1958 | 2012 | | |
| |||
2074 | 2128 | | |
2075 | 2129 | | |
2076 | 2130 | | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
2077 | 2134 | | |
2078 | 2135 | | |
2079 | 2136 | | |
2080 | | - | |
| 2137 | + | |
2081 | 2138 | | |
2082 | 2139 | | |
2083 | 2140 | | |
| |||
0 commit comments