Skip to content

fix(cli): suppress harmless startup warnings via pnpm patches#7820

Merged
paulbalaji merged 5 commits intomainfrom
fix/cli-suppress-harmless-warnings
Jan 19, 2026
Merged

fix(cli): suppress harmless startup warnings via pnpm patches#7820
paulbalaji merged 5 commits intomainfrom
fix/cli-suppress-harmless-warnings

Conversation

@paulbalaji
Copy link
Collaborator

@paulbalaji paulbalaji commented Jan 16, 2026

Summary

  • Suppressed the bigint: Failed to load bindings warning from bigint-buffer
  • Suppressed the DeprecationWarning: .data is not a valid RequestInit property warning from node-fetch

Applied to all three bundled packages: cli, rebalancer, and warp-monitor.

Approach

Uses pnpm patches to fix warnings at the source, rather than runtime suppression:

  1. patches/bigint-buffer@1.1.5.patch - Silences the console.warn when native bindings fail to load
  2. patches/node-fetch@3.3.2.patch - Removes the .data deprecation warning (gaxios compatibility)

This approach:

  • Won't suppress future warnings that might be important
  • Doesn't require --no-warnings shebang flag
  • Doesn't need hacky console.warn overrides
  • Uses the same patching mechanism already in use for other dependencies

Details

Two harmless warnings were appearing during startup:

  1. bigint-buffer native bindings warning

    • Source: @solana/spl-token@solana/buffer-layout-utilsbigint-buffer@1.1.5
    • Cause: Native C++ bindings aren't compiled during install
    • Impact: None - falls back to pure JS implementation
  2. node-fetch DeprecationWarning

    • Source: @hyperlane-xyz/aleo-sdknode-fetch@3.3.2
    • Cause: gaxios passes data instead of body to fetch options
    • Impact: None - the code still works correctly

Test plan

  • Run hyperlane --help and verify no warnings appear
  • Run rebalancer bundle and verify no warnings appear
  • Run warp-monitor bundle and verify no warnings appear

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Applied source-level patches to silence harmless startup warnings so users no longer need runtime flags or console overrides to suppress them.
  • Bug Fixes
    • Fixed CLI post-build error handling to fail cleanly instead of attempting on-the-fly file modifications.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

🦋 Changeset detected

Latest commit: 92fc03e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@hyperlane-xyz/cli Patch
@hyperlane-xyz/rebalancer Patch
@hyperlane-xyz/warp-monitor Patch
@hyperlane-xyz/infra Patch
@hyperlane-xyz/aleo-sdk Patch
@hyperlane-xyz/starknet-core Patch
@hyperlane-xyz/ccip-server Patch
@hyperlane-xyz/cosmos-sdk Patch
@hyperlane-xyz/cosmos-types Patch
@hyperlane-xyz/eslint-config Patch
@hyperlane-xyz/github-proxy Patch
@hyperlane-xyz/helloworld Patch
@hyperlane-xyz/http-registry-server Patch
@hyperlane-xyz/radix-sdk Patch
@hyperlane-xyz/sdk Patch
@hyperlane-xyz/tsconfig Patch
@hyperlane-xyz/utils Patch
@hyperlane-xyz/widgets Patch
@hyperlane-xyz/deploy-sdk Patch
@hyperlane-xyz/provider-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Suppressed two warnings that appear during startup in bundled packages:

1. bigint-buffer native bindings warning - comes from @solana/spl-token
   dependency chain, harmless as it falls back to pure JS implementation

2. node-fetch DeprecationWarning about .data property - comes from
   node-fetch@3.3.2 via aleo-sdk

The fix moves warning suppression to the bundle header (before module
loading) using --no-warnings shebang flag and an early console.warn
override.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@paulbalaji paulbalaji force-pushed the fix/cli-suppress-harmless-warnings branch from d9c252b to cce9252 Compare January 16, 2026 23:43
@paulbalaji paulbalaji marked this pull request as ready for review January 16, 2026 23:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Runtime CLI warning suppressions for bigint-buffer and node-fetch were removed and replaced by source-level patches and package.json patchedDependencies entries; CLI side-effect import that applied the runtime workaround was deleted.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/suppress-cli-warnings.md, .changeset/fix-cli-post-bundle-error-handler.md
New changelog entries: one documenting suppression-of-warnings patches; one documenting CLI post-bundle error-handler fix.
Package manifest
package.json
Added patchedDependencies entries for bigint-buffer@1.1.5 and node-fetch@3.3.2 (structure extended to include these patches).
Dependency patches
patches/bigint-buffer@1.1.5.patch, patches/node-fetch@3.3.2.patch
Patch files silence native-binding "bigint" warning and .data deprecation warning by making warning paths no-ops or removing console warnings.
CLI runtime cleanup
typescript/cli/env.ts, typescript/cli/cli.ts
Removed in-file console.warn override and removed env.ts side-effect import from cli.ts.
Post-bundle script behavior
typescript/cli/scripts/ncc.post-bundle.mjs
Removed automatic auto-fix rewrite on error; script now exits with code 1 on failure instead of attempting to patch output file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • antigremlin
  • ltyu
  • Mo-Hussain
  • xeno097

Poem

A wee patch here, a hush-hush there,
No more console bleats to fill the air.
We fixed the source, let runtime be free,
Boots off the warnings — smooth as can be. 🐸✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(cli): suppress harmless startup warnings via pnpm patches' accurately captures the main objective of the changeset, which involves suppressing two harmless warnings using pnpm patches across CLI packages.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cli-suppress-harmless-warnings

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 markdownlint-cli2 (0.18.1)
.changeset/fix-cli-post-bundle-error-handler.md

markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding: .changeset/fix-cli-post-bundle-error-handler.md
Linting: 1 file(s)
Summary: 0 error(s)
Error: EACCES: permission denied, open '/markdownlint-cli2-results.json'
at async open (node:internal/fs/promises:640:25)
at async Object.writeFile (node:internal/fs/promises:1214:14)
at async Promise.all (index 0)
at async outputSummary (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:877:5)
at async main (file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.mjs:1053:25)
at async file:///usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2-bin.mjs:12:22 {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/markdownlint-cli2-results.json'
}


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
typescript/cli/scripts/ncc.post-bundle.mjs (1)

69-77: This catch block is broken - leftover code that'll cause a mess.

There's a real problem here. The catch block references variables that don't exist:

  • content is scoped to the try block and not accessible here
  • dirnameDef and shebang are undefined (the constants are DIRNAME_SHIM and SHEBANG)

If an error occurs (file not found, permission issue, etc.), this will throw a ReferenceError instead of handling it gracefully. Looks like some old code got left behind during the refactor.

🐛 Proposed fix - clean up the catch block
   } catch (error) {
     console.error('✖ Failed to patch CLI executable:', error);
-    if (!content.includes(dirnameDef)) {
-      const [, executable] = content.split(shebang);
-      const newContent = `${shebang}\n${dirnameDef}\n${executable}`;
-      await writeFile(outputFile, newContent, 'utf8');
-      console.log('Adding missing __dirname definition to cli executable');
-    }
+    process.exit(1);
   }

This matches how the rebalancer and warp-monitor scripts handle errors.

🧹 Nitpick comments (1)
typescript/rebalancer/scripts/ncc.post-bundle.mjs (1)

10-33: Identical to the warp-monitor version - works the same way.

This is the second copy of this shim logic. The implementation is correct.

If you ever get tired of maintaining the same onion layers in multiple swamps, consider extracting this DIRNAME_SHIM and the patching logic to a shared build utility. But that's a "someday" thing - these are separate packages with separate build scripts, so keeping them isolated isn't unreasonable.

@paulbalaji paulbalaji enabled auto-merge January 16, 2026 23:49
@antigremlin
Copy link
Contributor

I wish there was a better way of doing this

Replaced --no-warnings shebang flag and console.warn override with
pnpm patches that fix the warnings at the source:

- bigint-buffer@1.1.5: silence native bindings fallback warning
- node-fetch@3.3.2: silence .data deprecation warning (gaxios compat)

This approach won't suppress future warnings and is cleaner than
runtime workarounds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@paulbalaji paulbalaji changed the title fix(cli): suppress harmless startup warnings fix(cli,rebalancer,warp-monitor): suppress startup warnings via pnpm patches Jan 19, 2026
@paulbalaji paulbalaji changed the title fix(cli,rebalancer,warp-monitor): suppress startup warnings via pnpm patches fix(cli): suppress startup warnings via pnpm patches Jan 19, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
typescript/cli/scripts/ncc.post-bundle.mjs (1)

55-61: Fix undefined identifiers in the error handler.

Right now Line 57–60 uses dirnameDef, shebang, outputFile, and content without definitions, so the catch path throws and hides the real error.

🐛 Suggested fix
 async function patchCliExecutable() {
-  try {
-    let content = await readFile(OUTPUT_FILE, 'utf8');
+  let content = '';
+  try {
+    content = await readFile(OUTPUT_FILE, 'utf8');
@@
   } catch (error) {
     console.error('✖ Failed to patch CLI executable:', error);
-    if (!content.includes(dirnameDef)) {
-      const [, executable] = content.split(shebang);
-      const newContent = `${shebang}\n${dirnameDef}\n${executable}`;
-      await writeFile(outputFile, newContent, 'utf8');
+    if (content && !content.includes(DIRNAME_SHIM)) {
+      const [, executable = content] = content.split(SHEBANG);
+      const newContent = `${SHEBANG}\n${DIRNAME_SHIM}\n${executable}`;
+      await writeFile(OUTPUT_FILE, newContent, 'utf8');
       console.log('Adding missing __dirname definition to cli executable');
     }
   }
 }

@paulbalaji paulbalaji changed the title fix(cli): suppress startup warnings via pnpm patches fix(cli): suppress harmless startup warnings via pnpm patches Jan 19, 2026
@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 19, 2026

♻️ Rebalancer Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-rebalancer:pr-7820
gcr.io/abacus-labs-dev/hyperlane-rebalancer:a658a07-20260119-140328

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 19, 2026

🕵️ Warp Monitor Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-warp-monitor:pr-7820
gcr.io/abacus-labs-dev/hyperlane-warp-monitor:a658a07-20260119-140328

Copy link
Collaborator Author

@paulbalaji paulbalaji left a comment

Choose a reason for hiding this comment

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

nuke env.ts + extraneous comments

paulbalaji and others added 2 commits January 19, 2026 14:15
- Deleted env.ts (only contained outdated comments)
- Removed import of env.js from cli.ts
- Removed explanatory comments from ncc.post-bundle.mjs files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The catch block referenced undefined variables (content, dirnameDef, shebang, outputFile) that would throw a ReferenceError if the try block failed, masking the real error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@antigremlin antigremlin left a comment

Choose a reason for hiding this comment

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

Very nice!

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 19, 2026

🐳 Monorepo Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-monorepo:pr-7820
gcr.io/abacus-labs-dev/hyperlane-monorepo:92fc03e-20260119-142043

@paulbalaji paulbalaji added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit 223fd7f Jan 19, 2026
99 checks passed
@paulbalaji paulbalaji deleted the fix/cli-suppress-harmless-warnings branch January 19, 2026 14:40
@github-project-automation github-project-automation bot moved this from In Review to Done in Hyperlane Tasks Jan 19, 2026
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (4b89208) to head (92fc03e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7820   +/-   ##
=======================================
  Coverage   77.02%   77.02%           
=======================================
  Files         117      117           
  Lines        2651     2651           
  Branches      244      244           
=======================================
  Hits         2042     2042           
  Misses        593      593           
  Partials       16       16           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 71.86% <ø> (ø)
isms 81.10% <ø> (ø)
token 86.67% <ø> (ø)
middlewares 84.98% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants