Skip to content

fix(web): keep proto-ts installable after the workspace npm ci - #728

Open
MohammedAlkindi wants to merge 2 commits into
RunanywhereAI:mainfrom
MohammedAlkindi:fix/web-proto-ts-standalone-install
Open

fix(web): keep proto-ts installable after the workspace npm ci#728
MohammedAlkindi wants to merge 2 commits into
RunanywhereAI:mainfrom
MohammedAlkindi:fix/web-proto-ts-standalone-install

Conversation

@MohammedAlkindi

@MohammedAlkindi MohammedAlkindi commented Aug 17, 2026

Copy link
Copy Markdown

Description

On a clean clone, the documented Web SDK developer flow fails before any code is touched: after IDL codegen, running npm ci in bindings/web and then npm run build:ts (or typecheck) dies with 39x TS2307: Cannot find module '@bufbuild/protobuf/wire'. bindings/proto-ts is a workspace member of the bindings/web npm workspace but sits outside the workspace root, so the workspace install hoists proto-ts's dependencies into bindings/web/node_modules — a directory Node's resolution from bindings/proto-ts/src can never reach — and leaves bindings/proto-ts without its own node_modules.

This is a known trap — CI already carries the workaround: the web-typecheck job in pr-build.yml has an explicit "Install proto-ts dependencies (standalone install)" step (npm ci --workspaces=false in bindings/proto-ts) right after the workspace install, with a comment describing this exact mechanism. This PR ports that repair into the package so the documented local flow works too: a postinstall on the private @runanywhere/web-root package runs the same command, so npm ci/npm install in bindings/web leaves bindings/proto-ts able to compile itself. Today the repair exists only in workflow YAML — the root AGENTS.md ("Web SDK": cd bindings/web/, npm run build, npm run typecheck), CONTRIBUTING.md's ./run sdk web build, and bindings/web/AGENTS.md all describe the flow without it, so every fresh contributor checkout hits the TS2307 wall.

Deliberately unchanged: the web-typecheck workflow's explicit repair step. It becomes redundant (the postinstall performs the same install) but is idempotent and harmless; dropping it can be a follow-up once this has baked. @runanywhere/web-root is "private": true and never published, so the script cannot reach consumers of the published packages.

Type of Change

  • Bug fix

Testing

  • Lint passes locally
  • Added/updated tests for changes (not applicable — one-line install lifecycle change; validated by the existing suite below)

On Windows 11 (Node v24.18.0, npm 11.16.0 — CI's web-typecheck uses v24.19.0 / npm 11.17.0, so this is not version skew), with TS IDL codegen already run:

Fail-before (this change reverted; bindings/web/node_modules and bindings/proto-ts/node_modules wiped):

cd bindings/web && npm ci --no-audit --no-fund   # proto-ts/node_modules absent afterwards
npm run build:ts
# src/chat.ts(8,44): error TS2307: Cannot find module '@bufbuild/protobuf/wire' ... (x39)

Pass-after (change applied, same wipe):

cd bindings/web && npm ci --no-audit --no-fund   # postinstall restores proto-ts/node_modules (@bufbuild, typescript)
npm run build:ts                                  # exit 0
npm test                                          # 56/56 test files, 244/244 tests pass

Before the fix the same npm test run had 49 of 56 test files failing (all downstream of the missing proto-ts install). Not run here: WASM builds, browser Playwright suites, and the other SDKs' builds — this change only touches the npm install lifecycle of the private web workspace root; CI remains the authority for those.

Web SDK / Web Sample: not applicable — no runtime code changes; browser checklist items unaffected.

Labels

  • Web SDK - Changes to Web SDK (bindings/web)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed) — intentionally not touched; with this change the documented commands work as already written

Summary by CodeRabbit

  • Chores
    • Improved installation setup by automatically installing required protocol dependencies after package installation.

bindings/proto-ts is a member of the bindings/web npm workspace but sits
outside the workspace root, so 'npm ci' in bindings/web hoists its
dependencies to bindings/web/node_modules — unreachable from
bindings/proto-ts/src — and leaves bindings/proto-ts without its own
node_modules. Every documented local flow (npm run build:ts, typecheck)
then fails with TS2307 on @bufbuild/protobuf/wire. CI already repairs
this with a standalone 'npm ci --workspaces=false' in proto-ts; run the
same command as a postinstall on the private workspace root so the
documented commands work on a clean clone.
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 777df187-6a81-4491-a85b-e8c806e6971e

📥 Commits

Reviewing files that changed from the base of the PR and between 00e879f and 6f3eebc.

📒 Files selected for processing (1)
  • bindings/web/package.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The web package adds a root postinstall script. The script installs dependencies for the ../proto-ts workspace with workspace processing, auditing, and funding prompts disabled.

Changes

Web package installation

Layer / File(s) Summary
Add proto-ts postinstall wiring
bindings/web/package.json
The root postinstall script runs npm ci in ../proto-ts with workspace processing, auditing, and funding prompts disabled.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 6f3ee

This change makes the documented Web SDK install flow install the proto-ts dependencies needed for TypeScript builds; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: sanchitmonga22

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preserving proto-ts installability after the Web workspace runs npm ci.
Description check ✅ Passed The description follows the repository template. It explains the problem, solution, testing results, scope, label, and checklist status. It also identifies non-applicable testing and documentation con…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description follows the repository template. It explains the problem, solution, testing results, scope, label, and checklist status. It also identifies non-applicable testing and documentation considerations.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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