diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-03 13:30:35 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-03 13:30:35 -0500 |
| commit | 36e57f15e2cc191172016c50d45b5bf5d71933e5 (patch) | |
| tree | 609d8df5c28713ee7fadf2e3ba2bfb8feb14d800 /scripts/tests/sync-language-bundle.bats | |
| parent | 586c8f69b2f1e0498be7f8abecfd348aae12e5dd (diff) | |
| download | rulesets-36e57f15e2cc191172016c50d45b5bf5d71933e5.tar.gz rulesets-36e57f15e2cc191172016c50d45b5bf5d71933e5.zip | |
fix(language-bundle): don't re-drop the coverage fragment once adopted
The startup bundle sync re-dropped from-rulesets-coverage-makefile.txt into a project's inbox on every run, even after the project had adopted the targets. inbox_drop only treated the fragment as adopted if coverage-makefile.txt still sat at the project root or waited in the inbox. But install-lang tells users the opposite: copy the targets into your Makefile, then delete the fragment. So a project that followed the documented path got the drop re-suggested forever (deleted three sessions running in one case).
I guarded the drop so a project Makefile that already defines the distinctive coverage-summary target counts as adopted. The check lives at the call site, keeping inbox_drop generic. Added two bats cases: targets-in-Makefile suppresses the drop, an unrelated Makefile still gets it.
Diffstat (limited to 'scripts/tests/sync-language-bundle.bats')
| -rw-r--r-- | scripts/tests/sync-language-bundle.bats | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/tests/sync-language-bundle.bats b/scripts/tests/sync-language-bundle.bats index 5e3b912..1871444 100644 --- a/scripts/tests/sync-language-bundle.bats +++ b/scripts/tests/sync-language-bundle.bats @@ -182,6 +182,30 @@ install_team_overlay() { [[ "$output" != *"inbox"* ]] } +@test "sync: targets copied into the project Makefile count as adopted, no re-drop" { + # The documented adoption path (install-lang: "copy its targets into your + # Makefile") leaves no fragment at root and no inbox copy. A project that did + # this and deleted the fragment must not get the drop re-suggested every run. + install_bundle elisp "$PROJ" + mkdir -p "$PROJ/.ai/inbox" + printf 'coverage:\n\t@true\ncoverage-summary:\n\t@true\n' > "$PROJ/Makefile" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ ! -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ] + [[ "$output" != *"inbox"* ]] +} + +@test "sync: a project Makefile without the coverage-summary target still gets the drop" { + # Guard against over-broad detection: an unrelated Makefile must not suppress + # a genuinely-unadopted fragment. + install_bundle elisp "$PROJ" + mkdir -p "$PROJ/.ai/inbox" + printf 'build:\n\t@true\ntest:\n\t@true\n' > "$PROJ/Makefile" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ] +} + # --- Surface-only: settings.json --- @test "sync: drifted settings.json is surfaced, NOT modified, exit 3" { |
