Skip to content

chore: upgrade pnpm to 11.9.0 - #1781

Open
panish16 wants to merge 10 commits into
bcgov:mainfrom
panish16:feat/upgrade-pnpm-v11
Open

chore: upgrade pnpm to 11.9.0#1781
panish16 wants to merge 10 commits into
bcgov:mainfrom
panish16:feat/upgrade-pnpm-v11

Conversation

@panish16

Copy link
Copy Markdown
Contributor

Fresh PR replacing #1747 (closed while testing was still in progress).

Scoped strictly to pnpm 11.9.0: version pins (pnpm_version, packageManager, pnpm/action-setup@v6), --ignore-scripts where needed, and pinning the smoke-test workflows off the floating latest-11 tag.

Note: strr-examiner-web, strr-host-pm-web, strr-platform-web, and strr-strata-web will still fail verify-build — this is the pre-existing, already-known upstream Nuxt/c12 #imports resolution bug for git-hosted layers (unrelated to pnpm, confirmed via A/B test against the pre-pnpm-11 code). Deliberately left unfixed here per @panish16's request to keep this PR pnpm-only.

@panish16
panish16 requested a review from jimmypalelil as a code owner July 31, 2026 08:33
@panish16
panish16 force-pushed the feat/upgrade-pnpm-v11 branch from 3e3324b to 1a3853c Compare August 3, 2026 18:53
Comment thread strr-examiner-web/nuxt.config.ts Fixed
Comment thread strr-examiner-web/nuxt.config.ts Fixed
Comment thread strr-host-pm-web/nuxt.config.ts Fixed
Comment thread strr-host-pm-web/nuxt.config.ts Fixed
Comment thread strr-platform-web/nuxt.config.ts Fixed
Comment thread strr-platform-web/nuxt.config.ts Fixed
Comment thread strr-strata-web/nuxt.config.ts Fixed
Comment thread strr-strata-web/nuxt.config.ts Fixed
@Jacky-Pham

Copy link
Copy Markdown
Collaborator

/gcbrun

@bcregistry-sre

Copy link
Copy Markdown
Collaborator

Temporary Url for review: https://strr-strata-hotel-dev--pr-1781-331fqimk.web.app

@bcregistry-sre

Copy link
Copy Markdown
Collaborator

Temporary Url for review: https://strr-platform-dev--pr-1781-3viy7v9o.web.app

@bcregistry-sre

Copy link
Copy Markdown
Collaborator

Temporary Url for review: https://strr-examiner-dev--pr-1781-hitdz37x.web.app

@bcregistry-sre

Copy link
Copy Markdown
Collaborator

Temporary Url for review: https://strr-hosts-dev--pr-1781-t1669sum.web.app

@panish16
panish16 force-pushed the feat/upgrade-pnpm-v11 branch from 599e7c8 to cc0934e Compare August 28, 2026 21:23
@panish16

Copy link
Copy Markdown
Contributor Author

@jimmypalelil - this PR is fully green (CI/SonarCloud/Cloud Build preview all pass) and ready to merge. If you'd like to validate on the real dev environment before merging, could you push this branch into bcgov/STRR as feature-pnpm-v11-validate? That auto-triggers a dev deploy via the existing CD pipeline. Otherwise happy to just merge as-is.

extends: [
['github:bcgov/STRR/strr-base-web', { install: true }],
// '../strr-base-web', // dev only
'../strr-base-web',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this change actually work for the deployed version?

@jimmypalelil

Copy link
Copy Markdown
Collaborator

@panish16 I had errros pushing your branch to bcgov/strr. please resolve them and then I can push. thanks

remote: error: GH013: Repository rule violations found for refs/heads/feature-pnpm-v11-validate.        
remote: Review all repository rules at https://github.com/bcgov/STRR/rules?ref=refs%2Fheads%2Ffeature-pnpm-v11-validate        
remote: 
remote: - Commit message must match a given regex pattern: ^(feat|fix|chore|docs|style|refactor|perf|test|build|ci)(\(.+\))?: (.+)        
remote:   Found 4 violations:        
remote: 
remote:   da111cfc0c35e9cf4fed6a540afce18ef89a959b        
remote:   f286c5f79de418626add8c1da7dc75b8993e6ed3        
remote:   296e59fb940a5cca97ee31e869813ab2f4701eba        
remote:   1a3853cec6e8e0cd1111c968de34ba8cd7346687        
remote: 
To github.com:bcgov/strr.git
error: failed to push some refs to 'github.com:bcgov/strr.git'
!	refs/heads/pr/panish16/1781:refs/heads/feature-pnpm-v11-validate	[remote rejected] (push declined due to repository rule violations)
Done

panish16 and others added 8 commits August 31, 2026 14:15
Pin pnpm_version to 11.9.0 in CI workflows, set packageManager field
via corepack, and add pnpm-workspace.yaml with allowBuilds for native
deps (@parcel/watcher, esbuild, sharp, unrs-resolver) required under
pnpm 11's stricter build-script gating.
pnpm 11's stricter hoisting no longer resolves tailwindcss transitively
for eslint-plugin-tailwindcss in examiner/host-pm/platform/strata,
crashing eslint entirely (Could not find tailwindcss). It was already
present in each lockfile as a transitive dep; declaring it directly
fixes resolution without changing the resolved version (3.4.19).
The git-hosted layer reference (github:bcgov/STRR/strr-base-web) is
cloned by giget into an isolated node_modules/.c12/<hash> tree with no
node_modules of its own, so its tsconfig.json (and anything depending
on generated .nuxt/tsconfig.json) can't resolve under pnpm 11's
resolution behavior. This broke nuxt prepare for all 4 downstream
apps, which in turn broke both eslint's typescript/import resolvers
(200+ spurious lint errors) and the Nuxt build itself.

Switching to a local relative-path extends avoids the git-clone
isolation entirely. Since the sibling app's own .nuxt/tsconfig.json
may not exist in a fresh checkout (CI only runs each app's own nuxt
prepare), each consuming app eagerly installs and prepares
strr-base-web if missing, before Nuxt evaluates its config.
All 4 STRR frontend CD files (examiner/host-pm/platform/strata) were
still hardcoded to pnpm_version: 10.0.0, unrelated to and never touched
by the pnpm-v11 CI migration on this branch.
Picker.vue uses raw @use 'tailwindcss/base'/'components'/'utilities'
imports, but strr-base-web never declared tailwindcss itself as a
dependency - it only worked by relying on hoisting from whichever app
extended the layer. Under pnpm v11's stricter per-package node_modules,
that resolution fails, breaking strr-host-pm-web's build/tests since
it's the only app that actually renders ConnectFormDateInput.
…spec

ConnectFeeInfo.* strings live only in strr-base-web's own locale file.
Under mountSuspended, the real @nuxtjs/i18n module doesn't merge that
layer's locale file in, so the component's auto-imported useI18n()
resolved against messages missing those keys - independent of the
test's own baseEnI18n mock, which was only ever used to compute the
expected assertion values, not to back the rendered component.

Stub useI18n via mockNuxtImport (already used elsewhere in this test
suite for other auto-imports) so the component resolves against the
same baseEnI18n messages the assertions are built from.
…re shim

Sonar flagged execSync('npx --yes pnpm install ...')/('npx --yes nuxi
prepare ...') in all 4 apps' nuxt.config.ts (typescript:S4036 - PATH
search for the executed command). Replace with pre-resolved absolute
paths: corepack (bundled next to the running node binary, so still
honours strr-base-web's own pinned packageManager version the same
way npx did) for the install step, and nuxt's own package.json 'bin'
field (the same lookup pnpm's own generated shim uses, since nuxt's
'exports' map doesn't expose './bin/nuxt.mjs' for require.resolve)
for the prepare step.

Verified locally via a simulated fresh checkout (node_modules/.nuxt
deleted) that both steps still run and the build completes.
… module

The PATH-avoidance fix from the previous commit was correct but
duplicated the same ~27 lines across all 4 apps' nuxt.config.ts,
which pushed SonarCloud's New Code duplication gate from 7.2% to
15.6%. Move the logic into strr-base-web/prepare.mjs (a plain module
with no external deps of its own, safe to import even before
strr-base-web's own node_modules exists) and have each app just call
ensureStrrBaseWebPrepared().

Verified locally via a simulated fresh checkout that both the prepare
step and the full build still succeed.
@panish16
panish16 force-pushed the feat/upgrade-pnpm-v11 branch from 599e7c8 to 6c73344 Compare August 31, 2026 21:25
@panish16

panish16 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@jimmypalelil Fixed - Should push cleanly to feature-pnpm-v11-validate now.

On the nuxt.config.ts changes, there are two separate things going on, both scoped to the 4 downstream apps (examiner/host-pm/platform/strata):

1. Layer extends: git-hosted → local relative path
Originally each app extended strr-base-web via github:bcgov/STRR/strr-base-web. That reference gets cloned by giget into an isolated node_modules/.c12/<hash> tree with no node_modules of its own, so under pnpm 11's stricter resolution its tsconfig.json (and anything relying on its generated .nuxt/tsconfig.json) can't resolve - this broke nuxt prepare for all 4 apps, which cascaded into 200+ spurious eslint resolver errors and the Nuxt build itself. Switching to a plain relative path (../strr-base-web) sidesteps the git-clone isolation entirely, since it's actually a local sibling directory in this repo either way.

2. Eager-prepare shim: PATH lookup → pre-resolved absolute paths
Since strr-base-web's own .nuxt/tsconfig.json might not exist yet in a fresh checkout (CI only runs each app's own nuxt prepare), each app eagerly installs + prepares it first if missing. The first version of this shelled out to npx pnpm install/npx nuxi prepare by bare name, which SonarCloud flagged (typescript:S4036 - PATH-dependent command resolution). Replaced with pre-resolved absolute paths: corepack (bundled next to the running node binary, so it still respects strr-base-web's own pinned packageManager version) for the install step, and nuxt's own package.json "bin" field for the prepare step. Later deduped this from 4 copies into one shared strr-base-web/prepare.mjs module (copy-pasting it into all 4 files had pushed Sonar's duplication gate over its limit).

Both are verified locally via a simulated fresh checkout (deleting strr-base-web/node_modules/.nuxt) confirming the eager-prepare still runs and the build completes, plus the full CI suite is green on the current commit. Happy to walk through any specific line if useful.

…bsent

The official CD deploy pipeline's Docker build context is scoped to
each app's own directory only (bcgov/bcregistry-sre's Dockerfile-build
does `COPY . /app` from whatever `gcloud builds submit` was invoked
with, which frontend-cd.yaml scopes to just working_directory) -
strr-base-web is never uploaded alongside it there, unlike CI/local
dev/the Cloud Build PR-preview channel, which all have the full repo
checked out. Confirmed live: a real deploy attempt failed with
`Cannot find module '../strr-base-web/prepare.mjs'` since the whole
directory doesn't exist in that build context, not just its
node_modules.

Add ensure-strr-base-web.mjs, a preinstall script (runs before pnpm
even resolves dependencies) that clones strr-base-web fresh from
GitHub main when the sibling directory is missing outright - matching
what the old git-hosted `extends` layer reference used to do at build
time regardless of local checkout contents, before an earlier commit
on this branch switched to a local relative path to fix pnpm 11's
resolution of that reference.

This can't live inside nuxt.config.ts itself: jiti (its loader)
resolves import()s ahead of the file's own runtime code executing, so
a dynamic import can't depend on a clone step run a few lines above it
in the same file - confirmed by testing an in-config version first,
which failed identically even with the file already cloned to disk by
that point.

It's necessarily identical across all 4 apps (each one's CD build
context is a fully isolated Docker build containing only that app's
own directory, so unlike its normal-case counterpart
strr-base-web/prepare.mjs, there's nothing to import it from) -
excluded from SonarCloud's copy-paste detection accordingly, following
the same sonar.cpd.exclusions pattern already used for test files.

Verified locally: the preinstall script correctly clones and the
subsequent nuxt prepare + build succeed when strr-base-web is deleted
first (simulating the CD pipeline's actual build context), and nothing
regresses in the normal case where it's already present.

Known limitation: this fetches whatever's on bcgov/STRR's main, not
this PR's own branch - correct for real dev/test/prod deploys once
this merges (main will have the matching strr-base-web changes by
then), but a manual pre-merge validation deploy of this branch alone
(e.g. jimmy's feature-pnpm-v11-validate push) would still get a stale
strr-base-web missing this PR's own fixes to it.
@panish16
panish16 force-pushed the feat/upgrade-pnpm-v11 branch from b9ad191 to ff45ad4 Compare September 1, 2026 00:05
@panish16

panish16 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@jimmypalelil Found and fixed the real cause of the deploy failure - it is related to pnpm v11, specifically a regression from this PR's own earlier fix (not a pre-existing issue).

Root cause: the official CD deploy pipeline's Docker build context only ever contains each app's own directory - strr-base-web is never uploaded alongside it (traced through frontend-cd.yaml -> frontend-deploy's Dockerfile-build -> COPY . /app). CI, local dev, and the Cloud Build PR-preview channel all happen to have the full repo checked out, so none of them hit this - only the real deploy pipeline does. This PR's earlier fix switched strr-base-web's layer extends from a git-hosted reference (which used to fetch it fresh over the network at build time, regardless of local checkout contents - this is what broke under pnpm 11's stricter resolution in the first place) to a local relative path, which assumes the sibling directory already exists locally. That assumption breaks specifically in the CD pipeline's isolated build context.

Fix: added a preinstall script (ensure-strr-base-web.mjs) to each app that clones strr-base-web fresh from bcgov/STRR main when the sibling directory is missing outright - restoring the old pipeline's actual behavior for this one case, while keeping the local-path fix for everything else.

One known limitation worth flagging: it fetches whatever's on main, not this PR's own branch. That's correct for real dev/test/prod deploys once this merges (main will have the matching strr-base-web changes by then), but a pre-merge validation deploy of this branch alone (like the feature-pnpm-v11-validate push) would still pull in a strr-base-web missing this PR's own fixes to it (the tailwindcss fix, etc.) - so the app-level pnpm-v11 fixes should validate fine, but anything specifically testing this PR's strr-base-web changes via that path won't fully reflect them until after merge.

CI and SonarCloud are both green again on the current commit. Could you retry pushing the branch to feature-pnpm-v11-validate when you get a chance, so we can confirm the actual deploy succeeds this time?

jimmy's real deploy attempt (via feature-pnpm-v11-validate on
bcgov/STRR) confirmed the preinstall script itself now runs
correctly, but failed with 'git not found on PATH' - the actual CD
build image (an Alpine-based firebase-repo image) doesn't have git
installed at all, unlike this branch's own local testing environment.

Replace the git clone with a plain HTTPS fetch of GitHub's codeload
tarball (https://codeload.github.com/bcgov/STRR/tar.gz/refs/heads/main)
plus a small hand-rolled tar reader (ustar headers + pax extended
headers for long paths, same format git archive/GitHub both produce)
using only Node builtins (fetch, zlib, fs) - no external binary
dependency at all, so it works regardless of what's installed in
whatever build image this runs in, and there's no PATH-dependent
command to trip SonarCloud typescript:S4036 in the first place.

Verified locally against the real bcgov/STRR tarball (extracted
content is byte-identical to a real git checkout, modulo line-ending
normalization from this Windows dev environment) and, pointed
temporarily at this branch's own fork/ref to include its otherwise
main-only-missing prepare.mjs, confirmed the full nuxt prepare + build
succeeds end-to-end.
@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants