test(ast-grep): make the ast-grep 0.45.3 upgrade land green - #337
thecodedrift wants to merge 3 commits into
Conversation
… line The pin bump alone left four things behind: - AST_GREP_VERSION still said 0.45.2, so engine-version-consistency and the vendor contract's version pin both failed, and the reconciliation marker recorded the wrong engine. - The vendored rule schema is fetched from the tagged upstream, so it is regenerated. The only change is the Severity enum's order: `off` now sorts first, because `--min-severity` compares severities as an ordered type. No consumer of ours reads the order. - The severity-vocabulary pin asserted the old order in ast-grep's error text. The vocabulary is unchanged; the pin records the reorder. - The reconciliation marker test's deliberate literal, which exists so an upgrade cannot refresh it silently, is refreshed by hand.
ast-grep 0.45.3 (ast-grep/ast-grep#2909) stopped treating any comment that CONTAINS `ast-grep-ignore` as a directive; it now has to be the comment's first alphabetic text. Nothing of ours writes these, but `check` scans whatever code a project has, so the change reaches a user as a finding that appears under a prose comment, or an `unused-suppression` hint that vanishes, with nothing saying why. Measured against both binaries, swapped in place: the prose-mention, unused-hint and first-alphabetic cases all fail on 0.45.2 and pass on 0.45.3, and the two baseline cases (the directive works; a genuinely unused one is reported as a hint on the stream) fail when their fixture is broken. Not pinned, deliberately: `--min-severity`. `check` has no severity filter and `runAstGrepScan` passes no such flag, so there is no path by which it reaches a user. tree-sitter 0.27 moved nothing the existing language-alias, kind and pattern pins can see.
bd2a640 to
cb7c5e4
Compare
|
@claude /review |
|
Claude finished @thecodedrift's task in 2m 25s —— View job Review completeReview mode: incremental — read 0 prior review thread(s) before reviewing. Todo list
Scope reviewed: the 3-commit diff on Findings: none. I did not find any correctness, security, performance, or clarity issues. Specifics I checked and confirmed:
One thing I could not verify myself (not a finding, just a disclosure): the exact JSON-stream ordering asserted in the "reports a genuinely unused directive" test ( |
Stack (root → tip):
#334 moves the
@ast-grep/cli*pins to 0.45.3 and touches nothing else. This is what makes that bump correct.What the pin bump alone left broken
AST_GREP_VERSIONstill read0.45.2, failingengine-version-consistency, the vendor contract's version pin, and the reconciliation marker, which records this constant as the engine the rules are valid against. Bumped, and the marker test's deliberate literal (it exists so an upgrade cannot refresh it silently) refreshed by hand.src/generated/ast-grep-rule-schema.jsonis fetched from the tagged upstream, so it was version-bound. Regenerated for 0.45.3; the only change is theSeverityenum's order (offnow first, since--min-severitycompares severities as an ordered type). Nothing of ours reads the order.Full CLI suite after the fixes: 88 files, 1444 tests, all passing. No 0.45.3 regression found: every existing language-alias, kind,
$$$, Markdown and binding pin held unchanged under tree-sitter 0.27.New vendor-contract pins
ast-grep-vendor-contract.test.tsgains aninline ast-grep-ignore commentsblock. 0.45.3 (ast-grep/ast-grep#2909) stopped treating any comment that containsast-grep-ignoreas a directive; it must now be the comment's first alphabetic text. Nothing of ours writes those comments, butcheckscans whatever code a project has, so it reaches a user as findings appearing under prose or hints vanishing.Measured against both binaries (0.45.2 swapped into the platform package path), each case records its side of the bump:
// ast-grep-ignore/// ast-grep-ignore: no-evalabove a match suppresses itunused-suppressionhint/* */, extra spaces, and// 1.still count;// NOTE ast-grep-ignoreis prose--json=streamasruleId: unused-suppression,severity: hint,note: nullThe two baseline cases were also mutated at the fixture level (directive removed; scope changed) and fail as expected.
Not pinned, deliberately:
--min-severity.checkhas no severity filter andrunAstGrepScanpasses no such flag, so there is no path by which it reaches a user. Outline changes are not exposed by the CLI.Changeset
.changeset/ast-grep-0-45-3.mdis grown in place (stillpatch) with the two user-observable directions. Noupdate.mdledger entry: nothing installed under.taskless/migrates, and the ledger exists only for that.One aside worth knowing: the repo's own
taskless checkflagged a wrapped comment line in the new test whose text began with the token, exactly the anchor being pinned. Reflowed.Stacked on #334 — merges down into vendor/ast-grep/upgrade.