Skip to content

Redirect undo/redo tests never run the shell; correspondence text is stale #236

Open

Description

@hyperpolymath

Found on 2026-11-17 while fixing redo in #231.

Problems

  1. Tests that never run the shell. In impl/rust-cli/tests/integration_test.rs, the redirection undo/redo tests (test_redirect_undo_file_created, ..._truncated, ..._appended, test_redirect_redo_truncate) simulate the operation, the undo and the redo with plain fs::write. They never build a ShellState or call vsh::commands::undo/redo. They passed while undo of every >/>> redirection was broken for any sandbox root other than /.
  2. A confidence percentage. The header of impl/rust-cli/tests/correspondence_tests.rs says "Current confidence level: ~95%". CLAUDE.md forbids that form; the status is tested-only.
  3. Quoted Rust that does not exist. docs/LEAN4_RUST_CORRESPONDENCE.adoc, sections "Undo/Redo Correspondence" and "Composition Theorems", quote state.undo_stack.pop(), OperationType::Touch, OperationType::Rm and an undo method on ShellState, and end with "Theorem guarantees correctness" ticks.
  4. Stale test counts. The CLAUDE.md test table says 736 tests. cargo test reported 868 passed on the Fix redo: redone operations keep their undo data, and redo restores what the operation produced #231 branch at e3fd805.

What to do

  • Rewrite the four redirect tests to drive vsh::parser::parse_command(line)?.execute(&mut state) and the real undo/redo. Use an external command such as /bin/echo hi > f: the built-in echo writes through println!, which the test harness captures before it reaches the redirected file.
  • Sweep impl/rust-cli/tests/ for other tests whose body never touches the vsh crate.
  • Reword the correspondence_tests.rs header to tested-only.
  • Replace the stale sections of docs/LEAN4_RUST_CORRESPONDENCE.adoc with the real code shape and the ledger status words. The subsection "Redo, and redo followed by undo (added 2026-11-17)" shows the intended style.
  • Re-measure the test counts and update CLAUDE.md with the date.

Done means

  • Each rewritten test fails when the behaviour it names is broken. Show it for the redirect-undo tests by temporarily reverting the relative-path fix in record_for_undo (impl/rust-cli/src/redirection.rs).
  • In impl/rust-cli: cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings and cargo test pass. Commits signed.

Wider than this repository

"A test whose body never calls the crate under test" can be checked mechanically and may suit a Hypatia rule. Mention it in the PR; do not implement it here.

Notes

Activity

  1. added
    tech-debtKnown shortcut, drift, or hygiene owed - includes cleanup
    testingTests, benchmarks, fuzzing, property checks, coverage
    scope:repoConfined to this repository
    on Nov 17, 2026
  2. coderabbitai commented on Nov 17, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #231 - Fix redo: redone operations keep their undo data, and redo restores what the operation produced [open]
    #232 - Runtime holes: 13 of 15 closed, by containment through a directory handle and a fixed session root [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p2Normal - queue itpriority:p3Low - nice to havescope:repoConfined to this repositorytech-debtKnown shortcut, drift, or hygiene owed - includes cleanuptestingTests, benchmarks, fuzzing, property checks, coverage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions