chore(ci): add cargo-affected input rules for snapshots and doc sync - #3086
Merged
Conversation
`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) <noreply@anthropic.com>
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
One small gap in the readme_sync inputs — see the inline suggestion.
…ifacts 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) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cargo affected runselects tests by Rust-line coverage overlap, so a file a test reads at runtime (never recorded in coverage) maps to no test and slips through. This adds[workspace.metadata.affected]rules so those inputs still select their guarding tests.Rules
tests/**/*.snap→binary_id(=worktrunk::integration). insta snapshots are read at test time and never appear in coverage.src/**/*.snap→binary_id(=worktrunk) | binary_id(=worktrunk::bin/wt). The ~57 snapshots undersrc/belong to the lib andwt-binary unit tests (split 35worktrunk__*/ 19wt__*). Routing by snapshot location is the finest granularity available without a snapshot→test map.docs/**/*.md,dev/*.toml,src/cli/mod.rs,src/llm.rs,Taskfile.yaml,skills/**/*.md→test(/readme_sync/).tests/integration_tests/readme_sync.rsreads each of these at runtime viafs::read_to_stringand asserts the committed copies stay in sync; a change to any of them must rerun that module.docs/demos/*.snapare hyphen-named demo recordings, not insta test inputs, so the snapshot globs are scoped totests/andsrc/to leave them out.Notes
The rules are read by cargo-affected's input-rules feature (max-sixty/cargo-affected#53, released in 0.3.0); worktrunk's CI installs cargo-affected from its default branch, so this takes effect immediately. The
[*.metadata]block is excluded from cargo-affected's fingerprint, so editing a rule is cache-neutral (no coverage re-collect). Each filterset was verified to resolve against the current suite viacargo nextest list -E.