Skip to content

ci: assert Next.js webpack build for @cofhe/sdk/web (#467) - #471

Open
kutluhaneth46 wants to merge 1 commit into
FhenixProtocol:masterfrom
kutluhaneth46:cursor/next-turbopack-tfhe-ignore-88c1
Open

kutluhaneth46 wants to merge 1 commit into
FhenixProtocol:masterfrom
kutluhaneth46:cursor/next-turbopack-tfhe-ignore-88c1

Conversation

@kutluhaneth46

@kutluhaneth46 kutluhaneth46 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bugbot (and @nftpoetrist on #467) correctly flagged that /* webpackIgnore: true */ on the lazy import('tfhe') / proof-worker URL unblocks Turbopack but breaks runtime: the browser gets a bare tfhe specifier and no bundled .wasm / worker asset.

That approach is reverted. There is no SDK-side Turbopack fix today — the hang comes from tfhe's wasm-bindgen-rayon worker graph (vercel/next.js#100131); upstream #100182 turns the hang into a build error, not a working Turbopack build. The supported workaround remains next build --webpack / next dev --webpack.

This PR now:

Refs #467. No longer claims to Fix #467 in the SDK itself.

Test plan

  • Reverted webpackIgnore on web/index.ts, zkProve.worker.ts, workerManager.ts
  • Removed the misleading docs/changeset that claimed an SDK Turbopack fix
  • CI Test (Next.js webpack) green on this PR

Note

Low Risk
Adds CI and a local smoke script only; no runtime or SDK packaging changes in this diff.

Overview
Adds a CI guard for the supported Next.js 16 workaround when apps import @cofhe/sdk/web: default Turbopack builds can hang on tfhe’s wasm worker graph (#467), so consumers rely on next build --webpack.

A new check:next-webpack script spins up a minimal Next 16 App Router app (client component importing @cofhe/sdk/web), runs next build --webpack with a 3-minute timeout, and tears down the temp project. The Test (Next.js webpack) workflow job builds @cofhe/sdk first, then runs that check on every PR/push.

This does not change SDK bundling behavior in the diff—it only keeps the documented workaround from regressing silently.

Reviewed by Cursor Bugbot for commit 89fc6de. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 12d08b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5f93159. Configure here.

Comment thread packages/sdk/web/index.ts Outdated
// Turbopack build hangs while trying to analyse/bundle `tfhe` just because
// `@cofhe/sdk/web` was imported — even though tfhe is only needed at
// encrypt time. See FhenixProtocol/cofhesdk#467.
const mod = await import(/* webpackIgnore: true */ 'tfhe');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

webpackIgnore breaks runtime module loading

High Severity

webpackIgnore leaves the lazy tfhe import and the proof-worker URL as native specifiers. In a Next.js client bundle the browser cannot resolve the bare tfhe package or find zkProve.worker.js beside the emitted chunk, so initTfhe and worker proving fail when encryption runs.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5f93159. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — webpackIgnore was the wrong fix. Confirmed it leaves a bare tfhe specifier (and skips emitting the worker/wasm), so encrypt fails in the browser even though Turbopack next build finishes.

Reverted that approach in 89fc6de. The hang is the known Turbopack + wasm-bindgen-rayon cycle (vercel/next.js#100131); workable path is next build --webpack (docs in #470). This PR now only adds a CI smoke that asserts the webpack workaround stays green.

@kutluhaneth46 kutluhaneth46 changed the title fix(sdk/web): stop Next.js Turbopack builds hanging on tfhe ci: assert Next.js webpack build for @cofhe/sdk/web (#467) Oct 28, 2026
@kutluhaneth46

Copy link
Copy Markdown
Contributor Author

Addressed Bugbot: dropped webpackIgnore (runtime-breaking). PR pivoted to a next build --webpack CI smoke complementary to the docs in #470. See reply on the review thread for details.

Turbopack still hangs on tfhe's wasm-bindgen-rayon worker graph
(vercel/next.js#100131). Keep the supported next build --webpack
workaround covered in CI for FhenixProtocol#467.
@kutluhaneth46
kutluhaneth46 force-pushed the cursor/next-turbopack-tfhe-ignore-88c1 branch from 89fc6de to 12d08b5 Compare November 7, 2026 08:34

This branch has not been deployed

No deployments
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.

@cofhe/sdk/web: next build hangs under Turbopack (Next.js default), webpack works

1 participant