Skip to content

Commit e15ec72

Browse files
Jonathan D.A. Jewellclaude
andcommitted
fix: close 10 proof holes, fix 6 priority bugs, remove dead code, harden sandbox
Proof holes (41→31): - Lean 4: proved append_truncate_reversible, truncate_to_zero_is_write_empty - Coq: restructured mkdir_two_dirs_reversible with well_formed precondition - Agda: replaced 8 postulates with proofs (rmdir-mkdir, createFile-deleteFile, writeFile properties, file-isolation, captureRestore) - Discovered: reverse-direction reversibility requires defaultPerms constraint Bug fixes (Priority 1): - Append redirection (>>) truncated files instead of appending (external.rs) - 2> tokenization: file2>out incorrectly split as [file] [2>] [out] (parser.rs) - Logical operator precedence: a && b || c parsed right-to-left (parser.rs) - Shift overflow panic on $((1 << 64)) (arith.rs) - Version mismatch: 1.0.0→0.9.0, 256 proofs→200+ theorems (main.rs) Security fix (Priority 2): - Path traversal: resolve_path("../../etc/passwd") could escape sandbox (state.rs) Dead code removed: - QuotedWord::with_quote_type, RedirectSetup::get_file - JobTable::get_job_mut, JobTable::cleanup_done_jobs Tests: 541 passing, 0 failures, 14 ignored Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5802dc9 commit e15ec72

23 files changed

Lines changed: 609 additions & 234 deletions

.github/workflows/echidna-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
TOTAL=$((LEAN_HOLES + COQ_HOLES + AGDA_HOLES))
9696
echo "Total proof holes: $TOTAL (Lean: $LEAN_HOLES, Coq: $COQ_HOLES, Agda: $AGDA_HOLES)"
9797
echo ""
98-
if [ "$TOTAL" -gt 45 ]; then
99-
echo "WARNING: Proof holes increased beyond baseline (41). Investigate."
98+
if [ "$TOTAL" -gt 35 ]; then
99+
echo "WARNING: Proof holes increased beyond baseline (31). Investigate."
100100
exit 1
101101
fi

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: PLMP-1.0-or-later
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# RSR-compliant .gitignore
33

44
# OS & Editor
@@ -55,6 +55,14 @@ __pycache__/
5555
/.stack-work/
5656
/dist-newstyle/
5757

58+
# Proof system artifacts
59+
*.vo
60+
*.vok
61+
*.vos
62+
*.glob
63+
*.agdai
64+
.lake/
65+
5866
# Chapel
5967
*.chpl.tmp.*
6068

@@ -68,6 +76,7 @@ secrets/
6876
# Test/Coverage
6977
/coverage/
7078
htmlcov/
79+
*.proptest-regressions
7180

7281
# Logs
7382
*.log

.machine_readable/ECOSYSTEM.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
(reason . "Both implement MAA framework primitives")))
2828

2929
(what-this-is
30-
"Formally verified shell with ~200+ theorems across 6 proof systems (41 proof holes remain — see docs/PROOF_HOLES_AUDIT.md)"
30+
"Formally verified shell with ~200+ theorems across 6 proof systems (31 proof holes remain — see docs/PROOF_HOLES_AUDIT.md)"
3131
"Advanced research prototype with working shell features (v0.9.0, ~65% complete)"
3232
"Functional shell with pipelines, redirections, variables, job control, process substitution"
3333
"Implementation of MAA (Mutually Assured Accountability) framework"

.machine_readable/STATE.scm

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
(rust-cli
4343
(status . "working-prototype")
4444
(completion . 75)
45-
(details . "v0.9.0 - Working shell with 525 tests passing (15 ignored). 15,720 lines across 30 source files. Features: pipelines, redirections, process substitution, arithmetic, here docs, job control, glob expansion, quote processing, test/[[ conditionals, variables. Dead code: lean_ffi.rs, daemon_client.rs. Redo bug FIXED (multi-redo now works). Glob POSIX hidden file behavior FIXED."))
45+
(details . "v0.9.0 - Working shell with 541 tests passing (14 ignored). Features: pipelines, redirections, process substitution, arithmetic, here docs, job control, glob expansion, quote processing, test/[[ conditionals, variables. Bugs fixed: redo, glob hidden files, append truncation, 2> tokenization, logical op precedence, shift overflow, path traversal sandbox escape, version mismatch. Dead code removed: lean_ffi.rs, daemon_client.rs, 4 unused methods."))
4646

4747
(elixir-impl
4848
(status . "stale")
@@ -99,12 +99,11 @@
9999
(blockers-and-issues
100100
(critical
101101
"NO mechanized Lean → Rust correspondence (manual testing only, 85% confidence)"
102-
"41 proof holes across 17 proof files (28 gaps, 3 axioms, 10 structural — see docs/PROOF_HOLES_AUDIT.md)"
102+
"31 proof holes across 17 proof files (26 gaps, 3 axioms, 2 structural — see docs/PROOF_HOLES_AUDIT.md). 10 holes closed in 2026-02-12 proof session."
103103
"NOT production-ready — research prototype only")
104104

105105
(high
106106
"47/58 commits authored as Test <test@example.com> (Sonnet damage)"
107-
"Dead code: lean_ffi.rs (library doesn't exist), daemon_client.rs (no daemon)"
108107
"No Echidna integration for automated verification")
109108

110109
(medium
@@ -133,18 +132,25 @@
133132
"Fixed 4 pre-existing doctest failures (imports, PATH-dependent tests)"
134133
"Downgraded version from 1.0.0 to 0.9.0 (honest)"
135134
"Rewrote STATE.scm from inflated 1114-line mess to honest assessment"
136-
"Rewrote ECOSYSTEM.scm with accurate status"))
135+
"Rewrote ECOSYSTEM.scm with accurate status"
136+
"Fixed append redirection truncation (>> used File::create instead of OpenOptions::append)"
137+
"Fixed 2> tokenization (file2>out split wrong; now only treats 2> as redirect at token start)"
138+
"Fixed logical operator precedence (position→rposition for left-to-right associativity)"
139+
"Fixed shift overflow panic ($((1 << 64)) now returns error instead of panicking)"
140+
"Fixed path traversal sandbox escape (resolve_path now normalizes .. and clamps to root)"
141+
"Fixed version/proof count in main.rs (1.0.0→0.9.0, 256→200+)"
142+
"Removed dead code: with_quote_type, get_file, get_job_mut, cleanup_done_jobs"
143+
"Closed 10 proof holes across Lean 4, Coq, Agda (41→31)"))
137144

138145
(critical-next-actions
139146
(immediate
140-
"Close 54 proof holes or document which are intentional axioms"
141-
"Remove dead code (lean_ffi.rs, daemon_client.rs)"
147+
"Close remaining 31 proof holes or document which are intentional axioms"
142148
"Fix git author on future commits (not Test <test@example.com>)")
143149

144150
(this-week
145151
"Set up Echidna property-based validation pipeline"
146152
"Begin mechanized Lean → Rust correspondence (even partial)"
147-
"Audit Sonnet's v1.0.0 mega-commit for correctness")
153+
"Rewrite POSIX_COMPLIANCE.md to reflect actual implementation state")
148154

149155
(this-month
150156
"Achieve 95%+ correspondence confidence via property testing"

CLAUDE.md

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,27 @@ The Rust CLI is a functional interactive shell with these features:
5656
| Extended | 55 | Advanced features |
5757
| Integration | 35 | End-to-end |
5858
| Integration (extra) | 10 | Edge cases |
59+
| Lean4 proptest correspondence | 16 | Property-based Lean validation |
5960
| Parameter expansion | 67 | Variable/parameter tests |
6061
| Property correspondence | 15 | Property-based Lean validation |
6162
| Property | 28 | General property tests |
6263
| Security | 15 | Injection, traversal, validation |
6364
| Doctests | 52 | Inline examples |
64-
| **Total passing** | **525** | **0 failures** |
65-
| Ignored (stress) | 15 | Run manually with `--ignored` |
65+
| **Total passing** | **541** | **0 failures** |
66+
| Ignored (stress+1) | 14 | Run manually with `--ignored` |
6667

6768
### Codebase Metrics
6869

6970
- 15,720 lines of Rust across 30 source files
7071
- ~200+ formal theorems across 6 proof systems
71-
- 41 proof holes across 17 proof files (28 gaps, 3 axioms, 10 structural)
72+
- 31 proof holes across 17 proof files (26 gaps, 3 axioms, 2 structural)
7273

7374
## Critical Issues
7475

7576
### Critical Priority
7677

7778
1. **No mechanized Lean -> Rust correspondence** — testing only, ~85% confidence
78-
2. **28 real proof gaps** across 17 files (plus 3 axioms, 10 structural — see `docs/PROOF_HOLES_AUDIT.md`)
79+
2. **26 real proof gaps** across 17 files (plus 3 axioms, 2 structural — see `docs/PROOF_HOLES_AUDIT.md`)
7980
3. **NOT production-ready** — research prototype only
8081

8182
### High Priority
@@ -113,6 +114,18 @@ The Rust CLI is a functional interactive shell with these features:
113114
- **Redo bug**: `record_operation()` cleared redo stack, breaking multi-step redo. Added `record_redo_operation()` in `state.rs`
114115
- **Glob POSIX compliance**: `expand_glob` now uses `require_literal_leading_dot: true` (hidden files not matched by `*`)
115116
- **4 doctest fixes**: Missing imports, PATH-dependent assertions
117+
- **Append redirection truncation**: `>>` used `File::create()` (truncates!) instead of `OpenOptions::append()` in `external.rs`
118+
- **`2>` tokenization**: `file2>out` incorrectly split as `file [2>] out` instead of `file2 [>] out` — now only treats `2>` as error redirect when `2` starts a new token
119+
- **Logical operator precedence**: `a && b || c` parsed as `a && (b || c)` — fixed to left-to-right `(a && b) || c` via `rposition`
120+
- **Shift overflow panic**: `$((1 << 64))` panicked — now returns error for shift counts >= 64
121+
- **Path traversal**: `resolve_path("../../etc/passwd")` could escape sandbox — now normalizes `..` components and clamps to root
122+
- **Version mismatch**: `main.rs` reported version 1.0.0 and "256 proofs" — fixed to 0.9.0 and "200+ theorems"
123+
124+
### Dead Code Removed
125+
- `QuotedWord::with_quote_type()` — never called (parser.rs)
126+
- `RedirectSetup::get_file()` — never called (redirection.rs)
127+
- `JobTable::get_job_mut()` — never called (job.rs)
128+
- `JobTable::cleanup_done_jobs()` — never called (job.rs)
116129

117130
### Documentation Fixes
118131
- Downgraded version from 1.0.0 to 0.9.0 (honest)
@@ -207,20 +220,21 @@ vsh::parser::expand_variables(&input, &state);
207220

208221
### Immediate Priorities
209222

210-
1. **Close 28 proof gaps** (prioritized in `docs/PROOF_HOLES_AUDIT.md`)
211-
2. **Remove dead code**: `lean_ffi.rs`, `daemon_client.rs`
212-
3. **Fix git author** on future commits (currently `Test <test@example.com>`)
223+
1. **Close remaining 31 proof gaps** (prioritized in `docs/PROOF_HOLES_AUDIT.md`)
224+
2. **Fix git author** on future commits (currently `Test <test@example.com>`)
225+
3. **Rewrite `docs/POSIX_COMPLIANCE.md`** — severely outdated (see POSIX audit notes below)
213226

214227
### This Week
215228

216229
1. Set up Echidna property-based validation pipeline
217230
2. Begin mechanized Lean -> Rust correspondence (even partial)
218-
3. Audit Sonnet's mega-commit for correctness beyond test files
231+
3. Implement `2>&1` fd duplication (currently a TODO no-op in `external.rs`)
219232

220233
### This Month
221234

222235
1. Achieve 95%+ correspondence confidence via property testing
223-
2. Complete POSIX compliance for implemented features
236+
2. Implement control structures (`if`/`then`/`else`/`fi`, `while`/`for`, `case`)
237+
3. Implement `echo` builtin and word splitting (`$IFS`)
224238
3. Begin Idris2 extraction path for v2.0
225239

226240
### What NOT to Do
@@ -271,8 +285,28 @@ PMPL-1.0-or-later (Palimpsest License)
271285

272286
---
273287

274-
**Last Updated**: 2026-02-12 (Opus honest audit and fixes)
288+
## POSIX Compliance Audit Notes (2026-02-12)
289+
290+
`docs/POSIX_COMPLIANCE.md` is **severely outdated** — it claims nothing beyond filesystem
291+
syscalls is implemented, but the shell actually has: command parsing with full AST, pipelines,
292+
redirections (7 of 8 types), variables with parameter expansion, glob/brace expansion,
293+
command/process substitution, arithmetic expansion, quote processing, job control basics,
294+
test/[/[[ builtins, logical operators, and here documents. Milestones 1-8 from the roadmap
295+
are substantially complete.
296+
297+
**Most critical missing POSIX features** (ranked by impact):
298+
1. Control structures (if/then/else/fi, while/for, case) — blocks all script execution
299+
2. Functions — no func() { ... } syntax
300+
3. echo builtin — delegates to external /usr/bin/echo
301+
4. 2>&1 fd duplication — falls back to Stdio::inherit() (TODO in external.rs:382)
302+
5. Word splitting ($IFS) — unquoted variable expansions not split
303+
6. Tilde expansion — only works for ~/ in cd command
304+
7. read builtin, set/unset/readonly, source/., eval, semicolons as separators
305+
306+
---
307+
308+
**Last Updated**: 2026-02-12 (Opus source audit, bug fixes, dead code removal)
275309
**Version**: 0.9.0
276310
**Status**: Advanced research prototype — NOT production-ready
277-
**Tests**: 525 passing, 0 failures, 15 ignored
311+
**Tests**: 541 passing, 0 failures, 14 ignored
278312
**Completion**: ~65%

0 commit comments

Comments
 (0)