mirror of
https://github.com/max-sixty/worktrunk.git
synced 2026-09-14 20:00:38 +08:00
c93b494bd0
The `worktrunk-bin` AUR package installs fish completions from a heredoc
in `.github/aur/PKGBUILD` that hand-copies what
`fish_completion_content("wt")` produces — makepkg runs no Rust, so
there is no way to call the generator from there. The PKGBUILD's own
`TODO` notes the duplication ("a bit hacky, but short enough that copy &
paste is OK for the moment"), but nothing checks it. The two copies are
identical today; if the generator changes, the next release ships a
stale completion to AUR users and the only symptom is someone's
tab-completion quietly producing nothing.
This adds a unit test next to the existing `fish_completion_content`
snapshots asserting the PKGBUILD still contains the generated string
verbatim, printing the replacement text on failure. It's a real surface:
the docs point at the official Arch package now, but `worktrunk-bin` was
deliberately kept publishing (#2052) and at least one user tracks it for
newer releases than the official package carries.
`.github/aur/PKGBUILD` is read at test time and so never appears in
coverage, which means a PKGBUILD-only edit maps to no test and would
slip through `cargo affected run`. It gets a
`workspace.metadata.affected.rule` for that — the same treatment
`readme_sync`'s runtime-read inputs already have.
`.gitattributes` pins the PKGBUILD to an LF checkout, because a byte
comparison against a `\n`-emitting generator is only meaningful if the
file on disk is LF everywhere. Git for Windows defaults to
`core.autocrlf=true` and the path carried no `text`/`eol` attribute, so
Windows checked it out CRLF and the assertion could never match — which
is how the first push went red on `affected tests (windows, advisory)`.
Pinning is right independently of the test (makepkg reads the file as a
shell script), it's the same mechanism `templates/* text eol=lf` already
uses, and unlike `readme_sync`'s `#![cfg(not(windows))]` it leaves
Windows actually running the drift check. The stored blob is already LF,
so nothing renormalizes; a Windows clone predating the attribute needs
the file re-checked out once (`git rm --cached .github/aur/PKGBUILD &&
git checkout -- .github/aur/PKGBUILD`), and CI checks out fresh.
**One thing I could not verify here:** `cargo-nextest` isn't reachable
from the CI agent sandbox (`tend: cargo-nextest came from the runner
home and is unavailable`), so I couldn't run `cargo nextest list -E
'test(/aur_pkgbuild/)'` to confirm the new filterset selects the test.
The expression mirrors the existing `test(/readme_sync/)` rule exactly,
and the repo's own nextest run will exercise it.
<details><summary>Verification</summary>
Run on Linux only — the sandbox has no Windows or macOS host, so the
cross-platform claim rests on CI (`test (windows)` and `full-tests
(windows-2025, windows)`), not on these:
```
cargo test --bin wt aur_pkgbuild # passes
cargo test --bin wt configure_shell # 33 passed
cargo fmt --check # clean
cargo clippy --bin wt --all-features # clean
```
Drift is actually caught: with `--exclusive` deleted from the PKGBUILD's
`complete` line, the test fails and prints the correct replacement body.
The CRLF mechanism behind the Windows failure, reproduced on Linux
against a scratch repo with `core.autocrlf=true`:
```
without .gitattributes entry: CR count = 29
with .gitattributes entry: CR count = 0
```
</details>
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
48 lines
2.9 KiB
Plaintext
48 lines
2.9 KiB
Plaintext
# Collapse auto-generated files in GitHub PR diffs. These are regenerated by
|
|
# `test_docs_are_in_sync` in tests/integration_tests/readme_sync.rs — edits
|
|
# belong in the primary source (src/cli/mod.rs for command pages,
|
|
# docs/src/content/docs/*.md for everything else).
|
|
skills/worktrunk/reference/*.md linguist-generated=true
|
|
# Skill-only files and the top-level README symlink are primary sources — edited
|
|
# directly, not regenerated from docs/src/content/docs/. Exempt them so real edits stay
|
|
# visible in PR diffs.
|
|
skills/worktrunk/reference/README.md linguist-generated=false
|
|
skills/worktrunk/reference/shell-integration.md linguist-generated=false
|
|
skills/worktrunk/reference/troubleshooting.md linguist-generated=false
|
|
# The plugin skills tree is a real-file mirror of repo-root skills/, rewritten by
|
|
# `test_docs_are_in_sync`'s `sync_plugin_skills_mirror` stage. Nothing here is
|
|
# primary, including its copies of the skill-only pages exempted above.
|
|
plugins/worktrunk/skills/** linguist-generated=true
|
|
docs/public/*.md linguist-generated=true
|
|
docs/public/llms.txt linguist-generated=true
|
|
docs/public/.well-known/agent-skills/index.json linguist-generated=true
|
|
docs/src/generated/terminal-styles.json linguist-generated=true
|
|
# Rendered from the USER_CONFIG and PROJECT_CONFIG blocks in src/cli/mod.rs by
|
|
# `test_config_source_generates_example_toml` and
|
|
# `test_project_config_source_generates_example_toml`.
|
|
dev/*.example.toml linguist-generated=true
|
|
# The command pages under docs/src/content/docs/ are generated from src/cli/mod.rs
|
|
# too, but deliberately stay visible: they are the one rendered copy of the help
|
|
# text a reviewer reads. The rest of that directory is hand-written.
|
|
|
|
# Shell templates are embedded into the binary at compile time (askama); a
|
|
# CRLF checkout would leak \r into the shell code Windows-built binaries emit.
|
|
templates/* text eol=lf
|
|
# makepkg reads the PKGBUILD as a shell script, and a CRLF checkout also breaks
|
|
# `test_aur_pkgbuild_ships_the_current_fish_completion`, which matches the
|
|
# file's heredoc byte-for-byte against `fish_completion_content("wt")`.
|
|
.github/aur/PKGBUILD text eol=lf
|
|
# cmd.exe resolves a `goto` label by seeking through the batch file, and an
|
|
# LF-only batch file can fail that search ("The system cannot find the batch
|
|
# label specified"). The hook shim is only ever run by cmd.exe, so pin its
|
|
# checkout to CRLF regardless of the platform cloning it.
|
|
plugins/worktrunk/hooks/*.cmd text eol=crlf
|
|
# A fixture's object store and index are git's own binary formats, but git only
|
|
# calls a file binary when it finds a NUL in the first 8000 bytes, and a small
|
|
# enough zlib object may have none. Those diff as text, so `git diff` writes raw
|
|
# deflate into its output and any tool that decodes that output as a string
|
|
# fails on it — which is how `cargo affected` came to abort before running a
|
|
# test. The rest of `_git/` (HEAD, config, refs) is text worth reading.
|
|
tests/fixtures/*/_git/objects/** binary
|
|
tests/fixtures/*/_git/index binary
|