fix(ci): unbreak eslint and the multi-semantic-release git fixtures - #407
Conversation
…er's git setup The fixture helper inherited three things from whoever ran the tests, and each of them broke the suite — 25 of the integration tests fail on a machine that is set up the way most are today: - git exports `GIT_DIR`/`GIT_INDEX_FILE` and friends to its hooks, and they take precedence over `cwd`. Run the tests from a git hook — the `lint-staged` `vitest related`, for instance — and every git call in this helper operates on the repository being committed to instead of the fixture, up to and including replacing its index with a fixture's contents. Scrub those variables for every invocation. - the bare remote is created with the local `init.defaultBranch`, so for anyone not defaulting to `master` its HEAD points at a branch that is never pushed, and semantic-release fails with "couldn't find remote ref HEAD". Create it with `--initial-branch=master`, the branch `gitInit` makes. - `tag.gpgsign = true` in a global config turns the plain `git tag <name> <sha>` semantic-release runs into a signed tag, which needs a message it does not pass: "fatal: no tag message?". The helper already disables `commit.gpgsign`; disable `tag.gpgsign` too. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqVjBDe8SkgMK7LpDpgjJ7
`pnpm run lint:eslint` fails on a clean checkout of main with nine errors, so the Lint job is red on every pull request: - six `eslint-disable` comments no longer match a reported problem (`vitest/require-mock-type-parameters`, `@typescript-eslint/naming-convention`), which `reportUnusedDisableDirectives` reports as errors — delete them; - `release-notes-preset-compat.test.ts` calls `generateNotes` from `@semantic-release/release-notes-generator`, which ships no type declarations, so the call and its result are typed as `error` and trip `no-unsafe-call`/`no-unsafe-assignment` — declare the module alongside the other untyped semantic-release modules; - the same file's JSDoc mentions the package name unquoted, which reads as an inline tag — quote it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqVjBDe8SkgMK7LpDpgjJ7
|
Warning Review limit reached
Next review available in: 40 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions! 🙏 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
+ Coverage 86.67% 87.48% +0.81%
==========================================
Files 47 26 -21
Lines 1426 983 -443
Branches 387 279 -108
==========================================
- Hits 1236 860 -376
+ Misses 178 113 -65
+ Partials 12 10 -2
🚀 New features to boost your workflow:
|
Two independent breakages found while chasing the red pipelines on #403/#404/#405. Both are on
maintoday, neither comes from those branches.1.
lint:eslintfails on a clean checkout (commit 2)pnpm run lint:eslintreports nine errors on plainmain, so the Lint (eslint, types, attw) job is red on every pull request:eslint-disablecomments no longer match a reported problem —vitest/require-mock-type-parametersinrc.test.ts,rc-unmocked.test.tsandsemantic-release-clean-package-json/__tests__/index.test.ts,@typescript-eslint/naming-conventioninbin/cli.test.ts. WithreportUnusedDisableDirectivesthose are errors. Deleted.release-notes-preset-compat.test.tscallsgenerateNotesfrom@semantic-release/release-notes-generator, which ships no type declarations, so the call and its result are typed aserrorand tripno-unsafe-call/no-unsafe-assignment. Declared the module next to the other untyped semantic-release modules insrc/types/semantic-release.d.ts.jsdoc/escape-inline-tags). Quoted.After this,
pnpm run lint:eslintandpnpm run lint:typesboth pass repo-wide.2. The git fixtures inherit the developer's git setup (commit 1)
25 of
multi-semantic-release's integration tests fail locally on a machine configured the way most are today. Three separate causes, all in__tests__/helpers/git.ts:GIT_DIRand friends. Git exportsGIT_DIR,GIT_INDEX_FILE,GIT_OBJECT_DIRECTORYandGIT_WORK_TREEto its hooks, and they take precedence overcwd— for the helper's own calls and for the semantic-release runs the tests spawn. Run the suite from a hook, which the repo's ownlint-stagedconfig does (vitest relatedon a changed test file), and the fixtures operate on the repository being committed to.This is not theoretical: it happened to me while preparing this branch. The pre-commit hook ran these tests, a fixture's
git add/git commitwent to the real index, and the commit that came out deleted 389 files — the whole repository — because the tree it committed was a fixture's. I reset it; nothing was pushed. The helper now drops those variables at import.Verified both ways, with
GIT_DIR/GIT_INDEX_FILE/GIT_WORK_TREEpointed at a scratch repo:and the commit of this very change went through the real pre-commit hook without disturbing the index.
The remote's default branch.
gitInitRemoterunsgit init --bare, so the remote's HEAD follows the developer'sinit.defaultBranch. For anyone not onmasterthat HEAD names a branch which is never pushed, and semantic-release dies withgit fetch --tags→ "couldn't find remote ref HEAD". Now created with--initial-branch=master, matching whatgitInitmakes.Tag signing.
tag.gpgsign = truein a global config turns the plaingit tag <name> <sha>semantic-release runs into a signed tag, which needs a message it does not pass: "fatal: no tag message?". The helper already disabledcommit.gpgsign; it now disablestag.gpgsigntoo.With all three,
multi-semantic-release.test.tsandbin/cli.test.tsgo from 25 failures to 29/29 passing locally.Not fixed here
bin/cli.test.tsruns right at the 5 s per-test timeout on a loaded machine and times out intermittently; it passes on its own. Worth a longertestTimeout, but that is a separate call.prettier --checkfails on three files insemantic-release-pnpmthat nothing here touches. CI does not run prettier, so it is not blocking.🤖 Generated with Claude Code
https://claude.ai/code/session_01MqVjBDe8SkgMK7LpDpgjJ7