Skip to content

chore(librarian): use frozen lockfile and workspace for generator build - #9407

Closed
bshaffer wants to merge 2 commits into
consolidate-pnpm-lockfiles-pnpm-10from
librarian-frozen-lockfile-followup
Closed

bshaffer wants to merge 2 commits into
consolidate-pnpm-lockfiles-pnpm-10from
librarian-frozen-lockfile-followup

Conversation

@bshaffer

@bshaffer bshaffer commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Use pnpm install --frozen-lockfile --ignore-scripts in librarian.yaml once the next gapic-generator tag is released after #9381 and the package and checksum in librarian.yaml are updated to match

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the build step in librarian.yaml to use pnpm install with --frozen-lockfile and --ignore-scripts. The reviewer notes that the package URL and checksum still point to the older v5.3.0 release and suggests verifying if a newer version is required for this command.

Comment thread librarian.yaml
checksum: 4bc54d399b22c845fd4555f9435b7971153a2e3fafca32402658390711828f63
build:
- pnpm install --ignore-workspace --no-frozen-lockfile --config.auto-install-peers=true
- pnpm install --frozen-lockfile --ignore-scripts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The pull request description indicates that pnpm install --frozen-lockfile --ignore-scripts should be used once the next gapic-generator tag is released. However, the package URL (line 25) and checksum (line 26) are still pointing to the older v5.3.0 release. Before flagging this version as invalid or outdated, please verify the version against other active repositories in the organization (e.g., google-cloud-go) to ensure consistency. If a newer version is indeed active and required for this command, please update the package version and checksum accordingly.

References
  1. When validating tool versions (such as protoc) in configuration files like librarian.yaml, verify the version against other active repositories in the organization (e.g., google-cloud-go) before flagging it as invalid.

@bshaffer

Copy link
Copy Markdown
Contributor Author

Keeping this open as the tracker for restoring a reproducible generator build, but the target line has changed.

The generator is staying standalone, not joining the root pnpm workspace (rationale in #9381). So --ignore-workspace needs to stay; the only thing blocking --frozen-lockfile is the pinned gapic-generator-v5.3.0 tarball, whose nested lockfile is lockfileVersion: '6.0' and unreadable by pnpm 10.

Sequence to close this out:

  1. Merge chore(generator): remove Bazel from gapic-generator-typescript #9413 — regenerates the nested lockfile at 9.0
  2. Cut a new gapic-generator-* tag and repin package: / checksum: here
  3. Flip to pnpm install --ignore-workspace --frozen-lockfile --config.auto-install-peers=true

Step 3 before step 2 will fail with ERR_PNPM_LOCKFILE_BREAKING_CHANGE.

Also note --ignore-scripts isn't safe here as written — pnpm run compile on the next line needs the install to have completed normally.

bshaffer added a commit that referenced this pull request Sep 22, 2026
pnpm 7.33 reads the pinned generator tarball's lockfileVersion 6.0, so
--frozen-lockfile still works. Defer the pnpm 10 bump until a new
generator tag ships a 9.0 lockfile (#9407).
@bshaffer bshaffer closed this Sep 22, 2026
@bshaffer
bshaffer deleted the librarian-frozen-lockfile-followup branch September 22, 2026 23:31
bshaffer added a commit that referenced this pull request Sep 23, 2026
…workspace (#9418)

Stacked on #9413 — base is `chore/generator-remove-bazel`, so the diff
here is consolidation only. GitHub retargets to `main` when #9413
merges.

Makes `gapic-generator-typescript` a root workspace member: adds
`core/generator/*` to `pnpm-workspace.yaml`, deletes the nested
`pnpm-lock.yaml`, and drops the non-root `pnpm.overrides`.

### The cost: two casts in `generator.ts`

The nested `pnpm.overrides.protobufjs: ^8.6.6` was doing real work.
Without it the generator ends up with two protobufjs trees — its own v8,
plus v7 pulled in by `proto3-json-serializer@4.0.2` — and `tsc` fails:

```
generator.ts(133,9): error TS2345: Argument of type '…protobufjs@8.8.0…Type'
  is not assignable to parameter of type 'protobuf.Type'.
generator.ts(142,9): error TS2352: Conversion of type 'Message<{}>' to type
  'Message<object>' may be a mistake…
```

So this PR adds a documented `SerializerType` alias and two `as unknown
as` casts.

> [!WARNING]
> A root-level `pnpm.overrides` for protobufjs is **not** an
alternative. 2cc19a6 tried it and broke all 18 `units` shards by forcing
v8 onto google-gax; reverted in 05c2a62.

### The real fix

`proto3-json-serializer` is **our own package** —
`core/packages/proto3-json-serializer-nodejs`, currently `4.0.2` with
`"protobufjs": "^7.5.4"`. Teaching it to accept protobufjs v8 and
publishing that would delete these casts and unblock a v8 migration for
google-gax too. Worth doing before or instead of this PR.

### Not included

`librarian.yaml` still builds the pinned `gapic-generator-v5.3.0`
tarball with `--ignore-workspace --frozen-lockfile`, which keeps working
because that tag still ships a nested lockfile. It only needs to change
once a tag is cut *after* this merges — see #9407.

### Verified

`pnpm install --frozen-lockfile --filter @google-cloud/gapic-generator`
→ `compile` → `test`: **188 passing**.
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.

1 participant