Repository navigation
test(execution): demonstrate pause and continue through public APIs - #481
roschaefer wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
7592601 to
3b6ce60
Compare
Repository tests currently change the parent test process's working directory and serialize through a global mutex. That leaves other test threads exposed to the changed directory, and command code can still read the developer's Git configuration. Run repository scenarios in separate processes so their directories, environment and process-wide library state cannot interfere. Branched from current main (`657525c`), independently of #478–#481. Production command behavior and the library API are unchanged. ```text cargo test (parallel test threads; original directory/environment) | +-- exact repository test A | temporary home + fresh repository A | library calls and assertions run here | +-- exact repository test B temporary home + fresh repository B library calls and assertions run here ``` The existing `with_repository` helper reruns its named test in the same test executable, filtered with `--exact`. The selected child executes the scenario closure directly against the library. Each fixture has a fresh repository on main with a local Git identity; the child has its own HOME/XDG configuration directory, disables global/system Git configuration and removes inherited Git repository/configuration overrides. There is no directory mutex. The parent owns cleanup and receives child stdout/stderr and failures. Normal test filtering and diagram output with `--nocapture` remain available: ```sh cargo test --lib fetch::tests:: -- --nocapture --test-threads=8 ``` Keep setup and assertions inside the fixture closure because the named test is re-entered in the child. Pure unit tests run directly in the parent harness. This isolates tests; concurrent library operations in one process still need a separate production refactor to use explicit repository paths. Regression tests check: - The fixture's PID differs from its parent's, with its own home and repository; the parent's directory/home remain unchanged. - Inherited GIT_DIR, index and configuration overrides do not affect the fixture. - An intentional assertion failure inside a repository scenario fails its parent test and preserves the diagnostic. The development guide explains the fixture contract and how to replay tests. Validation: all 62 workspace Rust tests pass with eight test threads, including the three isolation regressions. Workspace clippy with warnings denied, formatting and diff checks pass. All implementation changes are under cfg(test); the CLI integration suite was not rerun.
3b6ce60 to
e16c5c0
Compare
8132ae3 to
c2c9c7e
Compare
c2c9c7e to
45fc0b2
Compare
1189ba4 to
2e2baca
Compare
Separate Rust fixture histories can drift from the scenarios exercised by Bats and Scrut. Reuse the existing push-ahead recipe through Bash while keeping both setup and library execution inside the isolated test child. Its parent owns temporary files, including nested Git setup directories. Keep the push-specific fixture beside its scenario so other integration test crates can reuse the process harness without unused setup helpers. Forward child output so public API walkthroughs remain visible with `--nocapture`. Rebased onto main after #488 merged. #481 reuses this harness for pause/continue scenarios. Validation: the external push test, formatting and diff checks pass after rebasing. The previous full validation also passed workspace tests, Clippy, and inherited Git overrides with a symlinked TMPDIR.
Make the in-memory continuation boundaries visible with one-splice pull and push scenarios. Compare repository diagrams against actual refs and contents so readers can see what has happened when each call returns and what continuation changes.
Run library operations in child processes so inherited Git settings and working directory changes cannot leak between public API scenarios.
45fc0b2 to
2a674f7
Compare
The retained execution APIs can pause and continue in one process, but readers need small examples that expose the Git state at each checkpoint. Add two public API scenarios and a walkthrough with diagrams checked against actual refs and file contents.
Pull pauses after download while HEAD and local contents remain unchanged, then continues to merge. Push pauses with a prepared commit while the upstream remains unchanged, then publishes that exact commit. Both scenarios verify that continuing a completed operation returns
Complete(0)without changing the result.Reuse the isolated child-process harness merged in #489. Each scenario has its own working directory and Git configuration. Continuation retains the same Rust execution value; repository inputs must remain unchanged while paused.
Replay:
cargo test --test pause_continue -- --nocapture.Validation after rebasing onto main: both pause/continue scenarios, the push observer test, workspace Clippy with warnings denied, formatting and diff checks pass. The resulting files are unchanged by the rebase. Previous validation also passed workspace tests, inherited Git overrides with a symlinked TMPDIR, the contributing documentation's four Scrut cases, and the documentation production build and link validation.