From c2f439f3da775c5a7c8872a499f285413ee2be46 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Mon, 15 Jun 2026 09:53:47 -0700 Subject: [PATCH 1/2] chore(ci): add cargo-affected input rules for snapshots and doc sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cargo affected run` selects tests by Rust-line coverage overlap, so it can't see files a test reads at runtime. Add `[workspace.metadata.affected]` rules so those changes still select their guarding tests: - tests/**/*.snap → the integration binary. insta snapshots are read at test time and never appear in coverage. - src/**/*.snap → the lib (`worktrunk`) and `wt` binary unit tests, which own the ~57 snapshots under src/. Routing by snapshot location is the finest granularity available without a snapshot→test map. - README.md, docs, dev/*.toml, src/cli/mod.rs, src/llm.rs, Taskfile.yaml, skills/**/*.md → the readme_sync module, which reads each at runtime via fs::read_to_string and asserts the committed copies stay in sync. The rules are read by cargo-affected's input-rules feature, which worktrunk's CI installs from cargo-affected's default branch. The `[*.metadata]` block is excluded from cargo-affected's fingerprint, so editing a rule doesn't invalidate the coverage cache. Co-Authored-By: Claude Opus 4.8 (1M context) --- Cargo.toml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 56895cf1d2..0f77b499b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,43 @@ 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 these inputs at runtime (via +# fs::read_to_string) and asserts the committed copies stay in sync: README.md, +# docs/content markdown, the dev/*.example.toml files generated from src/llm.rs +# and src/cli/mod.rs, the skill references, and Taskfile.yaml. A change to any of +# them must rerun that module, which coverage cannot link to the changed file. +[[workspace.metadata.affected.rule]] +globs = [ + "README.md", + "docs/**/*.md", + "dev/*.toml", + "src/cli/mod.rs", + "src/llm.rs", + "Taskfile.yaml", + "skills/**/*.md", +] +filterset = "test(/readme_sync/)" + [package] name = "worktrunk" version = "0.58.0" From d105ded8f27f1542b82fadad45f316a129dcd91d Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Mon, 15 Jun 2026 10:05:46 -0700 Subject: [PATCH 2/2] chore(ci): widen readme_sync rule to docs/config.toml + generated artifacts The review flagged that readme_sync also reads docs/config.toml at runtime (its title and extra.site_description feed docs/static/llms.txt), which the rule didn't cover. Enumerating every fs::read_to_string in the module found two more read-and-compared files in the same blind spot: docs/static/llms.txt and docs/static/.well-known/agent-skills/index.json, both regenerated from sources and compared against the committed copy (the test panics so CI fails on drift). Editing any of them flips the test, so all three join the rule's globs. Co-Authored-By: Claude Opus 4.8 (1M context) --- Cargo.toml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0f77b499b2..84690383a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,15 +23,21 @@ filterset = "binary_id(=worktrunk::integration)" globs = ["src/**/*.snap"] filterset = "binary_id(=worktrunk) | binary_id(=worktrunk::bin/wt)" -# tests/integration_tests/readme_sync.rs reads these inputs at runtime (via -# fs::read_to_string) and asserts the committed copies stay in sync: README.md, -# docs/content markdown, the dev/*.example.toml files generated from src/llm.rs -# and src/cli/mod.rs, the skill references, and Taskfile.yaml. A change to any of -# them must rerun that module, which coverage cannot link to the changed file. +# 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",