Skip to content

ci: stamp nightly versions before building the package - #12880

Merged
michaelbromley merged 2 commits into
masterfrom
chore/nightly-version-ordering
Sep 21, 2026
Merged

michaelbromley merged 2 commits into
masterfrom
chore/nightly-version-ordering

Conversation

@michaelbromley

Copy link
Copy Markdown
Member

First of the follow-ups recorded when the pnpm workspace landed (#12854).

The problem

workspace:* is resolved at publish time against the linked package's manifest. For typeorm that link points at build/package, because the manifest sets publishConfig.directory. The nightly job rewrote the version in build/package/package.json after the build, so from that point on the built manifest disagreed with its source and any workspace:* resolution picked up the nightly version.

Nothing is broken today, because the only workspace dependency on typeorm is a devDependency of a package CI does not publish. It stops being inert the moment that package is published from CI, or a package uses workspace:* in a field consumers install from.

The change

Stamp the nightly version on the source manifests before anything is built, instead of rewriting the built output afterwards. The built manifest is then correct from the moment it is produced, source and build agree for the rest of the job, and the substitution is no longer sensitive to step ordering.

This also removes the separate codemod stamping step, since both manifests are handled in one place.

The guard

Consistent ordering does not stop someone putting workspace:* in dependencies or peerDependencies later, which is the case that would actually reach users. scripts/check-publishable-manifests.mjs fails the build if a workspace specifier appears in dependencies, peerDependencies or optionalDependencies of any non-private package. devDependencies are left alone: they are metadata in a published package and nothing installs them.

It runs in the lint job, so it fails on the pull request that introduces the problem rather than at 02:00 in a publish run.

Verification

Both paths were simulated locally against a real build.

Nightly: source and built manifests both read 1.1.1-nightly.20260918, and packing @typeorm/legacy-naming-strategies substitutes devDependencies.typeorm: 1.1.1-nightly.20260918, which is the exact version being published in the same run.

Release, with no stamping: 1.1.1 in the source manifest, 1.1.1 in the built manifest, 1.1.1 in the substitution.

The guard was checked in both directions: it passes on the current tree, and planting peerDependencies.typeorm: workspace:* in @typeorm/legacy-naming-strategies fails it with the offending field named.

Unrelated, but found while reading the publish logs

The scheduled publish has failed every day since at least 13 September, before this change and before #12854.

  • Publish typeorm succeeds. Publish @typeorm/codemod fails with ENEEDAUTH, so Trusted Publishing appears to be configured for typeorm but not for the scoped packages. npm agrees: typeorm has dev: 1.1.1-nightly.20260918, @typeorm/codemod has only latest: 1.0.3 and no dev tag at all.
  • The v0 job fails earlier, at npm install -g npm@latest: npm 12 requires node ^22.22.2 || ^24.15.0 || >=26, and that matrix entry pins node 20.

Neither is addressed here. The first needs configuration on npmjs.com rather than a repository change; the second is a fix on the v0 branch.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Unsafe peer dependencies pass checks 🐞 Bug ≡ Correctness
Description
check:manifests runs only in the conditional lint job, whose path filter omits manifests outside
the core and codemod packages. A peer-dependency-only edit to the publishable legacy naming package
triggers its dedicated tests but neither lint nor a lockfile change, allowing a workspace:* peer
range to bypass the intended guard.
Code

.github/workflows/tests.yml[116]

+      - run: pnpm run check:manifests
Evidence
The checker explicitly rejects workspace ranges in peer dependencies, but it is invoked only by the
lint job. The lint filter includes core source and the codemod tree, while the legacy package has
a separate change filter and test job; its current peer dependency is not represented in the
lockfile importer, so changing only that range need not activate the lockfile-based lint trigger.

.github/workflows/tests.yml[25-63]
.github/workflows/tests.yml[86-116]
.github/workflows/tests.yml[146-166]
scripts/check-publishable-manifests.mjs[11-35]
packages/legacy-naming-strategies/package.json[49-53]
pnpm-lock.yaml[100-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The manifest checker is attached to a path-filtered lint job, but that filter does not include every publishable package manifest or the checker script itself. Peer dependency changes can therefore bypass the new validation.
## Fix Focus Areas
- .github/workflows/tests.yml[25-63]
- .github/workflows/tests.yml[104-116]
## Recommended Fix
Add `packages/*/package.json` and `scripts/check-publishable-manifests.mjs` to the `lint` path filter, or move `check:manifests` into a job that runs whenever either path changes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'typeorm-legacy-naming-strategies'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

@michaelbromley
michaelbromley merged commit f279fd1 into master Sep 21, 2026
47 checks passed
@michaelbromley
michaelbromley deleted the chore/nightly-version-ordering branch September 21, 2026 08:36
@github-actions github-actions Bot added this to the 2.0.next milestone Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants