Skip to content

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

Merged
max-sixty merged 2 commits into
mainfrom
cargo-affected-rules
Jun 15, 2026
Merged

chore(ci): add cargo-affected input rules for snapshots and doc sync#3086
max-sixty merged 2 commits into
mainfrom
cargo-affected-rules

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

cargo affected run selects 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/**/*.snapbinary_id(=worktrunk::integration). insta snapshots are read at test time and never appear in coverage.
  • src/**/*.snapbinary_id(=worktrunk) | binary_id(=worktrunk::bin/wt). The ~57 snapshots under src/ belong to the lib and wt-binary unit tests (split 35 worktrunk__* / 19 wt__*). Routing by snapshot location is the finest granularity available without a snapshot→test map.
  • README.md, docs/**/*.md, dev/*.toml, src/cli/mod.rs, src/llm.rs, Taskfile.yaml, skills/**/*.mdtest(/readme_sync/). 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; a change to any of them must rerun that module.

docs/demos/*.snap are hyphen-named demo recordings, not insta test inputs, so the snapshot globs are scoped to tests/ and src/ 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 via cargo nextest list -E.

This was written by Claude Code on behalf of max

`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 worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small gap in the readme_sync inputs — see the inline suggestion.

Comment thread Cargo.toml
…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>
@max-sixty
max-sixty merged commit 8059c7e into main Jun 15, 2026
39 checks passed
@max-sixty
max-sixty deleted the cargo-affected-rules branch June 15, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants