Skip to content

fix(cli): a cli test reads plugin markdown that no gate watches #972

Closed

Description

@blafourcade

Description

cli/tests/contexts/telemetry/infrastructure/task-backlog-skill-shape.integration.test.ts reads two plugin files and feeds each one's taught backlog-link.json example through the real TaskBacklogAdapter. Nothing runs it when only those plugin files change.

  • lefthook.yml's pre-push jobs cli-knip and cli-test both carry glob: "cli/**".
  • cli-ci.yml's changes job matches cli/*|kanban/*|scripts/__tests__/*|README.md, plus plugins/aidd-telemetry/* excluding prose. plugins/aidd-pm/** matches nothing.

So a change confined to the plugin files that test reads breaks it, and neither the local gate nor CI runs it.

The sibling guard scripts/__tests__/a-backlog-link-the-reader-can-read.test.js does run on such a change: scripts-tests carries glob: "{scripts,plugins,cli/src}/**". But it asserts only that each field name appears as a substring (text.includes('"backlog"')). It never parses the example. The case that falls between the two guards: the taught example stops being valid JSON, or moves, while still containing the three strings.

Affected file(s)

scripts/__tests__/a-backlog-link-the-reader-can-read.test.js

Expected behaviour

A change confined to the plugin files that teach backlog-link.json fails locally, at pre-commit, when it breaks what the reader accepts. The structural assertions belong in the guard that already runs on plugins/**: parse the taught example and require the three fields as non-empty strings.

Observed behaviour

Measured in PR #969. The taught shape moved from a fenced block in actions/01-build.md to assets/backlog-link-template.json. The scripts/ guard failed at pre-commit on the field names, which is correct. The cli/ test failed too, with expected null not to be null and no fenced json example to test — but only in CI, and only incidentally: that same push also touched scripts/__tests__/, which is in the CI filter. A push carrying the plugin change alone would have landed a red test on next.

AI tool

Claude Code

OS

macOS

Additional context

Widening either filter to plugins/** is the wrong fix: it runs the full 6800-test cli suite on every prose edit. The narrow alternative, listing the two paths the test reads, is the hand-maintained duplication that produced this — those paths just moved.

The cli/ test keeps its own job, crossing the boundary into the real adapter, which a repository script test cannot do.

Activity

  1. added theissue type on Oct 7, 2026
  2. added a commit that references this issue on Oct 7, 2026
    84dafd6
  3. blafourcade commented on Oct 7, 2026

    @blafourcade
    ContributorAuthor

    Delivered by #974, squash-merged into next as 84dafd69. A squash from a non-default base does not auto-close a Closes, so this is closed by hand.

    The structural assertions now live in scripts/__tests__/a-backlog-link-the-reader-can-read.test.js, whose glob covers plugins/**. Verified the way the Expected behaviour is written: empty written_by in a taught file, stage that file alone, run pnpm exec lefthook run pre-commit — scripts-tests exits 1.

    The fence rule took three attempts and the third is what shipped: the pattern is copied from the cli/ sibling, so the two cannot disagree about which fence they read. Selecting by content reopened this issue's own harm, measured — guard green, sibling red, nothing running the sibling on those paths.

    One case is green on both guards knowingly, and recorded in the plan: a valid decoy carrying backlog at line start above a broken taught example. Both agree, so nothing lands red on next.

    The two assertions this issue did not scope — the sibling's pinned placeholder value and its key-set equality — are #973.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions