You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 34b9baa
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): give every ast-grep rule a .tests/ so one rule can't fail them all
Migration 0005 created a rule's `.tests/` only as a side effect of moving a
test file into it, so an sg rule with no test at version 3 — or one whose
filename lacked the `-YYYYMMDD-test.yml` suffix the migration attributes by —
arrived at version 5 with no tests directory. Assembly named it in
`testConfigs` anyway, and ast-grep 0.41.0 aborts the whole invocation on a
`testDir` it cannot read (exit 6), which `--filter` does not scope away:
`taskless test` on any rule died naming a rule the author never touched.
0005 now ensures `rules/sg/<id>/.tests/`, gitkeeped when empty so the repair
survives a commit. `assembleSgConfig` separately omits a `testDir` that is not
on disk, which rescues a project a nightly already stamped at version 5 — those
never re-run the migration — and a rule directory made by hand. Neither turns a
missing test into a pass; verify and test still report it.
Fixes#150
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cyga14bww8rmazH2XrF8ms
Stop a rule with no tests from failing every other rule's ast-grep test run.
6
+
7
+
Migration `0005` created a rule's `.tests/` only as a side effect of moving a test file into it, so an ast-grep rule that had no test at version 3 — or one whose test file did not match the `<id>-YYYYMMDD-test.yml` shape the migration can attribute to a rule — arrived in the new layout with no tests directory at all. Assembly then named that directory as a `testConfigs` entry anyway, and ast-grep 0.41.0 treats a `testDir` it cannot read as fatal to the whole invocation rather than to the one rule: `taskless test` on _any_ rule died with `Cannot read rule directory .taskless/rules/sg/<other-id>/.tests` and exit 6, naming a rule the author had never touched. `--filter` does not scope that away, so there was no way to run one rule's tests around it.
8
+
9
+
`0005` now gives every `rules/sg/<id>/` a `.tests/`, holding a committed `.gitkeep` when it would otherwise be empty — git does not track empty directories, so without one the repair would not survive a commit and the failure would come back in CI. Assembly separately omits any `testDir` that is not on disk, which is what rescues a project a nightly already stamped at version 5: migrations short-circuit once the manifest is at the latest version, so those installs never re-run the amended `0005`, and the same state is reachable at any version by creating a rule directory by hand. Neither change turns a missing test into a pass — `verify` still reports "No test file found" and `test` still reports "Skipped: no test file found", both reading the rule directory rather than the generated config.
0 commit comments