Repository navigation
fix(core): log response bodies for forbidden PUT requests - #1433
Conversation
@lerna-lite/changed
@lerna-lite/cli
@lerna-lite/core
@lerna-lite/diff
@lerna-lite/exec
@lerna-lite/init
@lerna-lite/list
@lerna-lite/listable
@lerna-lite/npmlog
@lerna-lite/profiler
@lerna-lite/publish
@lerna-lite/run
@lerna-lite/version
@lerna-lite/watch
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1433 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 169 169
Lines 6062 6072 +10
Branches 1583 1589 +6
=========================================
+ Hits 6062 6072 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🎉 This pull request is included in version 5.6.4 📦 |
|
This gave me a chuckle @ghiscoding - my debugging patch actually landing in the original project wasn't on my bingo card 😂 Props for doing it, hopefully can help other projects now! |
|
@Nick-Lucas I like to peek around projects who use Lerna-Lite, especially for large projects like yours 😉 Side note, I'll add your project to my list of "Who's using Lerna-Lite", I was just waiting for your first release (making sure you're keeping Lerna-Lite hehe). Thanks for using it 🚀 |
## Summary This bumps `@lerna-lite/cli` and `@lerna-lite/publish` from `^5.6.3` to `^5.6.4` in the catalog. It also deletes `patches/@[email protected]`, because 5.6.4 ships the same change upstream. 5.6.4 includes two release-relevant fixes: - [lerna-lite#1433](lerna-lite/lerna-lite#1433) upstreams our 403 PUT response-body logger, with output truncated at 4,000 characters. The upstream PR names #7669 as its origin. - [lerna-lite#1422](lerna-lite/lerna-lite#1422) retries provenance signing, up to 3 times, when Sigstore returns `TLOG_CREATE_ENTRY_ERROR` with a 409. That error ended the second attempt of the 2026-10-28 canary run ([40729427954](https://github.com/trpc/trpc/actions/runs/40729427954)). The orphaned `@lerna-lite/{cli,core,init,version}@5.6.3` entries were a self-referencing cycle that pnpm did not prune, so I removed them from the lockfile by hand. `pnpm install --frozen-lockfile` and `pnpm install --lockfile-only` both leave the lockfile unchanged. ## Verification - `pnpm lerna publish --force-publish --canary --preid canary --dist-tag canary --yes --dry-run` on lerna-lite 5.6.4 prints `lerna-lite success published 7 packages [dry-run]`. - In the installed 5.6.4, `dist/command.js` contains `logForbiddenPutBody`, and `dist/lib/npm-publish.js` contains `isTlogConflictError`. Stacked below #7736. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Chores** * Updated the Lerna Lite CLI and publish tooling to version 5.6.4. * **Changes** * Certain failed publish requests no longer include raw response data in error logs. This reduces diagnostic detail in those cases. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Charon <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
@Nick-Lucas I forgot to mention, I added many extras in Lerna-Lite that Lerna doesn't have, some of them might be useful to your project. I know you're using Extra Features Summary (as shown in readme)
Cheers and ⭐ the project if you like it. Thanks again |
|
Ah some of those may indeed be useful @ghiscoding! What caught my eye was the --staged support which OG Lerna didn't seem to have still. That at least gave us a fallback in-case npm couldn't fix our publishing issues and we had some security issue to patch urgently. Nice to be on a more focused package too, we never really used much of what lerna was offering. Awesome work <3 |
…ished types (trpc#7748) ## Why Prompted by [ghiscoding's list of lerna-lite extras](lerna-lite/lerna-lite#1433 (comment)). Comparing our releases before and after the lerna-lite switch turned up these problems: - **`main` CI is red.** Since the `v11.22.1` release commit, `pnpm install --frozen-lockfile` fails with `ERR_PNPM_OUTDATED_LOCKFILE` ([run](https://github.com/trpc/trpc/actions/runs/40786499219)). Unrelated PRs fail for the same reason, e.g. trpc#7747 fails 3 jobs. - Each release bumps the `@trpc/*` versions in every `package.json`, but `pnpm-lock.yaml` still records the old ones. - Old lerna re-synced the lockfile and put it in every release commit (`v11.17.0`–`v11.21.0`). lerna-lite doesn't, so the switch broke this. - **Canaries point at the last stable release.** `@trpc/client@canary` has peer `@trpc/server: 11.21.1`, so installing the canaries together fails with `ERESOLVE`. Cause: our `prepack` hook (`scripts/version.ts`) strips the prerelease suffix from every `@trpc/*` pin. - **`npx @trpc/upgrade` and `trpc-openapi` don't run.** Since `11.19.0`, `bin` points at `.js` files, but tsdown 0.23.0 builds `.mjs`. npm skips the missing links. - **Our type declarations break consumers who type-check them** (`skipLibCheck: false`): - Every `@trpc/client` user needs `@types/ws`, because client imports `Encoder` from the server's ws adapter. - The server ws adapter's types are broken against `@types/ws` 8.18, which added ESM types. - `next` deep imports don't resolve for ESM consumers using `nodenext`. - The server adapters import `next`, `fastify`, `express`, `ws` and `aws-lambda` types without declaring them. - `@trpc/openapi/heyapi`'s CJS types fail on TypeScript 5.7, because `@hey-api/openapi-ts` is ESM-only. - **Nothing caught this, because the build fails silently.** An unresolved type becomes `any` and the build still passes. ## What - **Release tooling** - `lerna.json`: `syncWorkspaceLock` re-syncs the lockfile in the release commit, as old lerna did. - `lerna.json`: `exact` keeps lerna-lite's version bumps exact, as old lerna did. Without it the bumps become `^11.x.y`, then `version.ts` re-pins them and the lockfile is stale again. - `pnpm-lock.yaml`: fix the 15 stale workspace specifiers, which turns `main` green. - `scripts/version.ts`: pin each `@trpc/*` dep to that package's real version. Stable releases are unchanged (openapi keeps `-alpha` on stable deps). Canaries now depend on each other. - **Bins:** `@trpc/upgrade` and `@trpc/openapi` point at `dist/*.mjs`. - **Declarations** (runtime JS is byte-identical): - client: import `Encoder` from `@trpc/server/unstable-core-do-not-import`, which now re-exports it from the ws-free `wsEncoder`. - server ws adapter: import `WebSocket` and `WebSocketServer` from `ws` by name, which works with both old and new `@types/ws`. - server and next: add `.js` to type-only deep imports from `next`. Runtime imports are unchanged. - openapi: raise the `typescript` peer from `>=5.7.2 <7` to `>=5.8.2 <7`. 5.8.2 is the first release that lets the CJS types reference the ESM-only `@hey-api/openapi-ts`. - server: add optional peers `next`, `fastify`, `@types/express`, `@types/ws` and `@types/aws-lambda`. Ranges are `*`: npm rejects an installed optional peer that is outside its range, so narrower ranges would break existing users' installs. - **New CI job `verify-packed`** (`scripts/verify-packed.ts`): packs every package, then checks it the way a consumer would. - Every `bin`, `exports` and `types` target is in the tarball, and every `bin` has a shebang. - No `catalog:` or `workspace:` specifiers end up in dependencies. - The tarballs install together with npm, which enforces peers. - Every entry point type-checks with `skipLibCheck: false`, under `nodenext` (ESM and CJS) and `bundler`. Core consumers (server and client, no optional peers) are tested on TypeScript 5.7, 6 and 7. Full consumers (everything) are tested on 5.8.2 and 6. - Includes assertions on the types that silently became `any` before, plus the hey-api types. ## Links None. No docs or example changes. ## Alternatives considered - **lerna-lite's `stripPackageKeys`** (tried, then dropped). lerna-lite strips the keys *before* it runs our root `prepublish` build. - Stripping `scripts` meant turbo found no `build` tasks, so the tarballs shipped with no `dist/`. - Stripping `devDependencies` removed turbo's build-order edges. Client's declarations were then built before server's, and types became `any`. - **`--allow-peer-dependencies-update`:** wouldn't fix canaries, because the `prepack` hook overwrites what lerna writes. - **Narrow optional peer ranges** (e.g. `fastify@^5`): rejected, because existing users on other versions would get install errors. - **hey-api on TypeScript 5.7:** inline `import()` types with `resolution-mode: "import"` keep 5.7 working, but cost lint exceptions and harder-to-read source. Raising openapi's floor is simpler; it's an alpha package. - **Not done here:** - lerna-lite dropped old lerna's `sha-` canary version prefix (lerna/lerna#1118). A SHA that is all digits with a leading zero is invalid semver, which happens about once every 690 commits. This should be fixed upstream. - `--generate-release-notes`. ## Testing - **Old lerna vs this PR, same sources.** Both were published for real to throwaway local registries (verdaccio), stable and canary. - The release commits are line-for-line identical, lockfile included. - All tarball contents are identical. Only `catalog:` specifiers differ: old lerna publishes them literally, which is why `@trpc/[email protected]` on npm depends on `typescript: "catalog:ts-api"`. - **Release dry runs** of `release.yml`'s exact commands, built from scratch: - patch `11.22.1 → 11.22.2` and minor `→ 11.23.0` both bump correctly, and openapi keeps `-alpha`. - `pnpm install --frozen-lockfile` passes on the synced lockfile. The unsynced lockfile fails with `ERR_PNPM_OUTDATED_LOCKFILE`. - **Canary dry run:** every `@trpc/*` pin, peers included, is the canary version. The published canaries fail `npm install` with `ERESOLVE`; these install. - **`verify-packed`** on this branch: all pass, with no exceptions. On the commit before the fixes it fails: both missing bins, the `ws` leak on TypeScript 5.7, 6 and 7, and the `next` imports. - **Runtime JS:** all 122 files are byte-identical to the published `11.22.1`. - **Bins:** installed from the packed tarballs, `upgrade --help` and `trpc-openapi --help` both run. - **Repo checks:** `pnpm typecheck-packages` passes. Tests: 1346 of 1349 pass. - The 2 `openapi` CLI tests timed out under load and pass when run alone. - `httpSubscriptionLink.memory` also fails locally on the unchanged code (local Node 26; it passes in CI on Node 24). - **Nothing was published:** npm dist-tags are unchanged, and no tags were pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Chores** * Package releases now use exact version numbers and synchronize the workspace lockfile. Internal package dependencies are pinned to their recorded versions; dependencies without a recorded version are left unchanged, with a warning. * Added automated checks that validate package installation and verify exported entry points and types across module-resolution scenarios. * Updated package metadata and type references for compatibility with current tooling and framework versions. * Marked common adapter integrations as optional peer dependencies. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Alex / KATT <[email protected]>
Description
Log raw Buffer response bodies when a PUT request fails with HTTP 403, exposing proxy or registry error details previously missing from the output.
Limit the body to 4,000 characters, mark truncated responses, and include the diagnostic in the saved debug log.
Motivation and Context
The tRPC project patched Lerna-Lite to reveal response bodies behind otherwise uninformative "403 Forbidden" publish failures. This brings that diagnostic upstream with bounded output and regression coverage.
Origin: trpc/trpc#7669
How Has This Been Tested?
packages/core/src/__tests__/command.spec.tspassed.git diff --checkpassed.Types of changes
Checklist:
The full test suite was not run; the affected command test file passed.