Move upgrade todos down to the assertion impls
Assisted-by: GLM-5.3 via pi
diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml
index c876203..3b30e05 100644
--- a/.cargo/mutants.toml
+++ b/.cargo/mutants.toml
@@ -2,10 +2,17 @@
# Add entries as false positives are discovered.
exclude_re = [
- # Unimplemented stubs. Nothing calls upgrade or remove yet, so replacing
- # the todo!() with Ok(()) cannot be observed. Drop these when either is
- # implemented — the same point the cov-excl markers in assertions.rs go.
- "AssertionType::upgrade",
+ # Unimplemented upgrade stubs — nothing calls them in tests, so replacing
+ # the todo!() with Ok(()) cannot be observed. Drop an entry when that
+ # type's upgrade is implemented, at the same point its cov-excl markers
+ # in assertions.rs go. remove still defaults on the trait.
+ "impl AssertionType for Symlink>::upgrade",
+ "impl AssertionType for Directory>::upgrade",
+ "impl AssertionType for Git>::upgrade",
+ "impl AssertionType for Brew<R>>::upgrade",
+ "impl AssertionType for BrewBundle<R>>::upgrade",
+ "impl AssertionType for Debug>::upgrade",
+ "impl AssertionType for LuaAssertion>::upgrade",
"AssertionType::remove",
# BrewBundle's status and install exist twice, split on
diff --git a/AGENTS.md b/AGENTS.md
index 8168557..1da2902 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -90,7 +90,7 @@ Releases run on green main builds and attach a macOS aarch64 tarball plus a [Dot
`bin/coverage` measures library line coverage with grcov and gates on `COVERAGE_THRESHOLD`, which defaults to 100. The library is at 100% — keep it there rather than lowering the gate.
-Unimplemented stubs are excluded rather than counted: the `--excl-line` pattern covers `todo!` alongside `unreachable!` and the explicit `cov-excl-line` marker. The default `upgrade` and `remove` methods on `AssertionType` sit inside a `cov-excl-start`/`cov-excl-stop` pair because a function signature carries its own counter that no line pattern can match.
+Unimplemented stubs are excluded rather than counted: the `--excl-line` pattern covers `todo!` alongside `unreachable!` and the explicit `cov-excl-line` marker. An unimplemented method sits inside a `cov-excl-start`/`cov-excl-stop` pair because a function signature carries its own counter that no line pattern can match — the per-impl `upgrade` stubs and the default `remove` on `AssertionType` all do this. A trailing `// cov-excl-line` on the signature won't work either: rustfmt moves it to its own line inside the body.
Coverage regions land on their own line in two cases worth knowing, since both look like untestable code and are neither:
diff --git a/frork-cli/src/assertions.rs b/frork-cli/src/assertions.rs
index 06ee7b5..a131554 100644
--- a/frork-cli/src/assertions.rs
+++ b/frork-cli/src/assertions.rs
@@ -16,16 +16,10 @@ use crate::utils::Utils;
pub trait AssertionType: std::fmt::Display {
fn status(&self) -> Result<Status>;
fn install(&self) -> Result<()>;
-
- // Neither is implemented for any assertion type yet. They default here so
- // the stubs live in one place rather than being repeated per impl. Delete
- // the markers below along with the todo! when implementing either.
- // cov-excl-start
- fn upgrade(&self) -> Result<()> {
- todo!()
- }
+ fn upgrade(&self) -> Result<()>;
// Not yet called — will be used when `frork remove` is implemented.
+ // cov-excl-start
#[allow(dead_code)]
fn remove(&self) -> Result<()> {
todo!()
@@ -165,6 +159,12 @@ impl AssertionType for Symlink {
debug!("created: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
pub struct Directory {
@@ -201,6 +201,12 @@ impl AssertionType for Directory {
debug!("created: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
pub struct Git {
@@ -283,6 +289,12 @@ impl AssertionType for Git {
debug!("created: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
/// A seam over shelling out, so assertion types can be exercised without
@@ -378,6 +390,12 @@ impl<R: CommandRunner> AssertionType for Brew<R> {
debug!("installed: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
pub struct BrewBundle<R = SystemRunner> {
@@ -463,6 +481,12 @@ impl<R: CommandRunner> AssertionType for BrewBundle<R> {
debug!("installed: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
pub struct Debug {
@@ -511,6 +535,12 @@ impl AssertionType for Debug {
.map_err(|e| miette!("Debug install function failed: {e}"))?;
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
// --- Lua custom assertion types ---
@@ -598,6 +628,12 @@ impl AssertionType for LuaAssertion {
debug!("installed: {}", self);
Ok(())
}
+
+ // cov-excl-start
+ fn upgrade(&self) -> Result<()> {
+ todo!()
+ }
+ // cov-excl-stop
}
#[cfg(test)]