Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

chore(ci): add cargo-affected input rules for snapshots and doc sync (#3086)

Maximilian Roos8059c7e18f20
diff --git a/Cargo.toml b/Cargo.toml
index 56895cf1d..84690383a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,49 @@ members = ["tests/helpers/wt-perf", "tests/helpers/mock-stub"]
# Include mock-stub and wt-perf so `cargo test` builds their binaries
default-members = [".", "tests/helpers/mock-stub", "tests/helpers/wt-perf"]
+# cargo-affected input→test rules. cargo-affected selects tests by Rust-line
+# coverage overlap, so a file a test reads at *runtime* (never recorded in
+# coverage) maps to no test and would slip through `cargo affected run`. Each
+# rule force-selects the owning tests when a matching path changes. `[*.metadata]`
+# is excluded from cargo-affected's fingerprint, so editing a rule is
+# cache-neutral. See https://github.com/max-sixty/cargo-affected#input-rules.
+
+# insta `.snap` snapshots are read at test time and never appear in coverage, so
+# a snapshot edit maps to no test. Route each snapshot to the binary that owns
+# it — the finest granularity available without a snapshot→test map. Integration
+# snapshots live under tests/; unit-test snapshots under src/, split across the
+# lib (`worktrunk`) and the `wt` binary (`worktrunk::bin/wt`).
+[[workspace.metadata.affected.rule]]
+globs = ["tests/**/*.snap"]
+filterset = "binary_id(=worktrunk::integration)"
+
+[[workspace.metadata.affected.rule]]
+globs = ["src/**/*.snap"]
+filterset = "binary_id(=worktrunk) | binary_id(=worktrunk::bin/wt)"
+
+# tests/integration_tests/readme_sync.rs reads each of these at runtime (via
+# fs::read_to_string) and asserts the committed copies stay in sync — both the
+# sources (README.md, docs/content markdown, docs/config.toml's site title and
+# description, src/cli/mod.rs, src/llm.rs, the skill references, Taskfile.yaml)
+# and the generated artifacts it regenerates and compares against (the
+# dev/*.example.toml files, docs/static/llms.txt, the agent-skills index.json).
+# Editing any of them flips the test, but coverage can't link a runtime-read
+# file to it.
+[[workspace.metadata.affected.rule]]
+globs = [
+ "README.md",
+ "docs/**/*.md",
+ "docs/config.toml",
+ "docs/static/llms.txt",
+ "docs/static/.well-known/agent-skills/index.json",
+ "dev/*.toml",
+ "src/cli/mod.rs",
+ "src/llm.rs",
+ "Taskfile.yaml",
+ "skills/**/*.md",
+]
+filterset = "test(/readme_sync/)"
+
[package]
name = "worktrunk"
version = "0.58.0"