Repository navigation
chore: prepare todoist react-compiler-tracker publishing - #238
Conversation
doistbot
left a comment
There was a problem hiding this comment.
This PR prepares the migration of react-compiler-tracker to the todoist GitHub owner and npm scope, adding pack/publish release workflows with source-run validation, artifact verification, and registry collision guards, plus a release runbook and test coverage — with npm publication intentionally gated until @todoist/tsconfig@2.0.2 lands and the lockfile is regenerated.
Few things worth tightening:
- The recovery-publication test asserts on the wrong mocked
npmcall (recoveryCalls[1], the dist-tagsviewlookup instead of thepublishcall at index 2), so the--tag=recoveryand--provenance=falsechecks pass trivially — retarget the assertions to the publish call or filter byargs[0] === 'publish'like the bootstrap test.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (7)
.github/scripts/release.mjs:49: The
react-compiler-tracker-v<version>tag convention and the main-or-matching-tag ref check are duplicated here and again inrelease.mjsline 90, whilerelease-source.mjsdefines the same rule intagNameandvalidateSourceRun. Extract the tag name and source-ref validation into one shared helper (or export them from one of these scripts) so the Release Please lineage stays defined in a single place..github/scripts/release.mjs:231: The stable-version regexes and this numeric split/compare block reimplement semver parsing.
semveris already installed as a transitive dev dependency (via@babel/*inpackage-lock.json); declaring it and usingsemver.valid/semver.gtremoves the hand-rolled checks and rejects malformed versions like3.0.05that the current regex accepts..github/scripts/release.mjs:278:
destinationmeans three different things depending on the command:sourceRefforverify, the dist-tag (latest/recovery) forbootstrap, and the registry forpublish. In thebootstrapbranch this positional is forwarded astag, which works but is misleading and easy to break during future edits. Parse arguments per command or use distinct names for each positional..github/scripts/release-source.mjs:69: The
['ahead', 'identical'].includes(...)main-ancestry assertion is duplicated here and invalidateSourceRun(line 24). Extract a small helper for the comparison-status check so the two source-validation paths cannot drift..github/scripts/release.test.mjs:121: The synthetic
packfixture only exercises valid package metadata, sovalidatePackage's rejection branches are never tested: an unmigrated@doist/dependency, afile:/link:/workspace:/npm:spec,"private": true, and a packedpublishConfig. A regression in any of these would let an internal, private, or locally-routed package ship without a failing test. Extend the fixture to assertpackthrows for each invalid case (or unit-testvalidatePackagedirectly)..github/scripts/release.test.mjs:104:
withRegistryis only exercised for thenpmdestination. Thegithubpath — requiredNODE_AUTH_TOKEN, the GitHub registry URL, and the${NODE_AUTH_TOKEN}auth line npm expands at runtime — has no coverage, and the missing-token guard isn't asserted anywhere. Add agithubcase withNODE_AUTH_TOKENset to verify scope/default registry routing, plus a test thatwithRegistry('github')throws when the token is absent..github/scripts/release.mjs:1: The new
.mjsrelease/test scripts are not matched by thelint-stagedpattern inpackage.json(*.{js,ts,json,md}), so the husky pre-commit hook does not run Biome on them even thoughnpm run checkdoes in CI. The backend repository standard requires pre-commit hooks to enforce the same formatting/linting checks that run in CI (https://handbook.doist.com/doc/standard-backend-repositories-). Addmjsto the lint-staged glob (e.g.,*.{js,mjs,ts,json,md}) so these files are checked locally.
| registry, | ||
| 'recovery', | ||
| ) | ||
| assert.ok(recoveryCalls[1].includes('--tag=recovery')) |
There was a problem hiding this comment.
These assertions inspect the wrong call:
recoveryCalls[1] is the dist-tags view lookup (call 0 is the spec view, call 2 is publish), so all three checks pass trivially regardless of the publish arguments. The test never verifies that the recovery publication actually uses --tag=recovery and --provenance=false. Assert against recoveryCalls[2] (or filter for the call where args[0] === 'publish', as the bootstrap test at line 252 does).
doistbot
left a comment
There was a problem hiding this comment.
This PR prepares the migration of react-compiler-tracker to the todoist GitHub owner and npm scope, adding guarded release/publication workflows and scripts while keeping the executable, package visibility, and Release Please lineage intact.
Few things worth tightening:
- The main-ancestry gate is inverted:
compare(run.head_sha, 'main')accepting onlyahead/identicalmeans a normal release tag that main has moved past will be rejected asbehind, while a commit not on reviewed main history can pass. Swap the operands (compare('main', run.head_sha)) in both the workflow and the pack CLI (line 215), and update the['behind', 'diverged']expectation in release-source.test.mjs (line 57) to match. This single check gates both retry packing and retained-artifact publication, so it's worth fixing before the release run.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (8)
.github/scripts/release.mjs:1: The new
.mjsrelease/test scripts aren't matched by thelint-stagedglob in package.json (*.{js,ts,json,md}), so the husky pre-commit hook skips Biome on them even thoughnpm run checklints them in CI. Addmjsto the glob (e.g.*.{js,mjs,ts,json,md}) so pre-commit enforces the same checks as CI..github/scripts/release.test.mjs:121: The pack fixture only exercises valid metadata, so
validatePackage's rejection branches are untested: an unmigrated@doist/dependency, afile:/link:/workspace:/npm:spec,"private": true, and a packedpublishConfig. A regression in any of these would let an internal, private, or misrouted package ship without a failing test. Extend the fixture (or unit-testvalidatePackage) to assertpackthrows for each invalid case..github/scripts/release.test.mjs:104:
withRegistryis only exercised for thenpmdestination. Thegithubpath — requiredNODE_AUTH_TOKEN, the GitHub registry URL, and the${NODE_AUTH_TOKEN}auth line npm expands at runtime — has no coverage, and the missing-token guard at release.mjs line 142 is never asserted. Add agithubcase withNODE_AUTH_TOKENset, plus a test thatwithRegistry('github')throws when the token is absent..github/scripts/release.mjs:235: The split/compare block reimplements semver comparison.
semveris already present innode_modulesas a transitive dependency (package-lock.jsonpinssemver@6.3.2), so declare it directly and usesemver.valid/semver.gthere instead. That also rejects non-normal versions such as3.0.05, which the current^\d+\.\d+\.\d+$regex accepts..github/scripts/release.mjs:50: The release tag convention and main-or-matching-tag ref check are re-declared here and again in
pack(lines 90-91), duplicatingtagName/validateSourceRunfromrelease-source.mjs(which this file already imports). The['ahead', 'identical']ancestry status is likewise duplicated betweenvalidateSourceRunand thepackCLI block inrelease-source.mjs. Export shared helpers (e.g.,tagName,isTrustedSourceRef,isOnReviewedMain) fromrelease-source.mjsand import them here so the release lineage rule has a single definition..github/scripts/release.mjs:272: The
destinationpositional is command-dependent: it issourceRefforverify(line 279), the dist-tag forbootstrap(forwarded astagat line 286), and the registry name forpublish(line 291). The shared name makes operator misuse easy to misread. Parse arguments per command or use distinct variable names (e.g.sourceRef,distTag,registry) so each branch is unambiguous..github/scripts/release.mjs:218: Derive the registry URL from
destinationinstead of accepting both independently.destinationcontrols publication flags whileregistrycontrols the endpoint, so contradictory combinations are possible—the GitHub test case already passes the npm registry URL. Removing the separate registry parameter would reduce parameter sprawl and keep endpoint selection and publication flags tied to one routing decision..github/scripts/release-source.test.mjs:92:
releaseCommitrejects draft and prerelease GitHub releases, but the mock release fixture is always finalized (draft: false,prerelease: false), soretainedSourcenever exercises those guards. Add fixture patches withdraft: trueandprerelease: trueand assertretainedSourcethrows; otherwise a regression could use a draft/prerelease release as the publish source.
| assert.ok(['main', tagName(version)].includes(run.head_branch), 'Untrusted source ref') | ||
| assert.equal(run.head_sha, tagSha, 'Run must build the exact release tag commit') | ||
| assert.ok( | ||
| ['ahead', 'identical'].includes(compare(run.head_sha, 'main').status), |
There was a problem hiding this comment.
The main-ancestry comparison is inverted.
compare(base, head) reports ahead when base has commits that head does not, so compare(run.head_sha, 'main') accepting only ahead/identical means the release commit must be ahead of (or equal to) the main tip. A normal release tag is an ancestor of main, so once any commit lands after the tag the result is behind and the documented pack.yml retry fails with "Source must be on reviewed main history". Worse, a tag/commit that is ahead of main (not in reviewed main history) would pass. Swap the operands and keep the accepted statuses: compare('main', run.head_sha) accepting ahead/identical (or accept behind/identical with the current order). The same inverted check exists in the pack CLI at line 215 and the ['behind', 'diverged'] rejection expectation in release-source.test.mjs line 57 needs updating accordingly.
|
[Posted by Jarvis] The tsconfig publication gate is resolved and the real lock/install/check/test/build all pass (78 product tests, 18 release safety tests). The C08 guard now requires readable GitHub package metadata or same-token active owner evidence for a missing first mirror. I checked the ancestry concern against the actual GitHub API: |
|
[Posted by Jarvis] Released @todoist/react-compiler-tracker@3.0.5 after merging this PR and normal release PR #234. Both required checks passed before each merge.
npm accepted the original direct publication before metadata became visible; read-only verification waited for propagation. No second publication or repack was performed. Cross-run provenance remains disabled. The manual release is complete. Future automated releases still need the protected package-release environment and npm trusted-publisher configuration; neither was configured or exercised by this release. Private-mirror consumer workflow read grants remain separate from the owner-based verification. |
[Posted by Jarvis]
Migrate the GitHub owner and package scope to
todoist, preserving thereact-compiler-trackerexecutable and Release Please tag lineage. The first new-scope release is 3.0.5, through existing release PR #234; source and manifest remain 3.0.4 here.The dependency gate is resolved:
@todoist/tsconfig@2.0.2is published on npm and its private GitHub mirror with matching integrity. This PR now includes the real registry lockfile and main's minimatch 11.0.5 patch. Node is pinned to 22.23.4 to satisfy the installed development dependency engine floor.Release Please creates the normal release record and dispatches pack-only at its exact tag. Publication reuses the retained artifact, validates the original successful run attempt, artifact ID/API digest and reviewed source ancestry, and checks both registries before any write. Missing mirrors preserve original bytes and cannot downgrade latest. Cross-run npm provenance is disabled.
The npm package is public; the GitHub mirror remains private. Missing GitHub versions require readable package metadata; first-mirror absence requires active organization-owner evidence with the same credential. First publication uses the documented local owner path. Future workflow publication requires the protected
package-releaseenvironment and npm trusted-publisher setup.Validation on Node 22.23.4 / npm 11.21.2:
Push/PR effects were rechecked: source/title checks and doistbot only; no branch publication. Merging this PR updates the normal release PR. Merging #234 creates its standard tag/release and pack artifact; registry publication is a separate authorized step. See the release runbook.