Skip to content

feat: Re.Pack DevTools plugin with agent tools for runtime debugging - #1510

Open
dannyhw wants to merge 4 commits into
feat/rozenite-tester-appsfrom
feat/repack-devtools-plugin
Open

dannyhw wants to merge 4 commits into
feat/rozenite-tester-appsfrom
feat/repack-devtools-plugin

Conversation

@dannyhw

@dannyhw dannyhw commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1509.

Summary

Adds packages/repack-devtools-plugin (@callstack/repack-devtools-plugin), a private, workspace-only Rozenite plugin. It makes Re.Pack runtime and dev-server state inspectable in DevTools and by fully automated agents. The aim is to reproduce issues and find root causes without a human driving the app.

What it records

  • ScriptManager: every script with normalized locator, status, resolve/load timings, download vs cache, error stage/code/native message, and an event log.
  • Module Federation: v2 instances, remotes, module cache, share scopes with every registered/loaded version, plus MF 2 runtime events through an observe-only runtime plugin. v1 share scopes are read from __webpack_require__.S.
  • Uncaught JS errors (chained to LogBox).
  • Dev server: per-platform compilation status, errors, warnings, assets and changed files, plus a request log that keeps failed response bodies.

Diagnostics (get-overview, severity-sorted, each with a ref to the details):

  • failed or stuck scripts
  • chunk 404s with similarly named emitted assets
  • duplicate singletons
  • requiredVersion mismatches
  • non-semver shared versions (catalog:/workspace:)
  • unreachable remote dev servers
  • failed compilations
  • /symbolicate 400s with the reason

How to reach it

  • 4 DevTools panels: Scripts, Federation, Dev Server, Errors & symbolication.
  • 16 agent tools, rozenite agent callstack/repack-devtools <tool>. Besides reads, they include actions to reproduce issues headlessly: load-script, prefetch-script, invalidate-scripts, load-remote, symbolicate, clear, reload. Typed descriptors are exported from /sdk for @rozenite/agent-sdk.
  • withRepackDevTools(config) adds GET /repack-devtools/state, /compilation?platform= and POST /clear to any dev server, including MF mini-app servers. These work with curl even when the bundle doesn't build.

Tester apps
All four depend on the plugin from the workspace. Everything is behind WITH_ROZENITE=true, as in #1509. tester-federation-v2's host also registers the runtime plugin via runtimePlugins in development.

Agent skills (.agents/skills, symlinked into .claude/skills):

  • repack-debug-runtime: setup, tool and endpoint reference, playbooks per failure type, and gotchas found while testing on device.
  • repack-reproduce-issue: the issue → tester repro → evidence → root cause → fix → regression test loop.

The design doc is in agent_context/repack-devtools-oct2026.

Notes

  • Build: rozenite build emits the CommonJS entry with moduleResolution: node10, which TypeScript 7 removed. scripts/rozenite.mjs runs the CLI with TypeScript 5 (typescript-5 alias) as tsc. The package's own typescript stays at the workspace version. Pinning TS 5 directly gave react-native a different pnpm peer variant, so the MF host bundled two React Native copies and crashed (Tried to register two views with the same name DebuggingOverlay).
  • @swc/helpers devDependency: the testers' SWC loader transforms the linked package's dist (it isn't under node_modules), as with @callstack/repack.
  • Pre-existing issue surfaced: the plugin flags that tester-federation-v2 shares react-native-safe-area-context and react-native-screens with version catalog:testers (copied from package.json). MF logs "does not satisfy the requirement" for these. Not fixed here.

Test plan

  • pnpm --filter @callstack/repack-devtools-plugin test: 38 unit tests covering the ScriptManager reducer, error parsing, stack parsing and symbolication alignment, semver/federation diagnostics, the collector, request diagnostics, the middlewares against a real HTTP server, and the config wrapper.
  • Plugin typecheck, pnpm lint:ci, pnpm build.
  • tester-app pnpm test: 17/17. No new tsc errors in the testers vs. base.
  • Android emulator, tester-app:
    • get-overview reports boot-recorded chunk loads and the /symbolicate 400 from app start.
    • load-script with a bogus chunk produced a RequestFailure record plus a 404 diagnostic pointing at src_asyncChunks_Async_local_tsx.chunk.bundle.
    • symbolicate maps frames correctly. This caught and fixed an off-by-one: Re.Pack's symbolicator drops non-http frames.
  • Android emulator, tester-federation-v2:
    • get-federation shows instances, remotes and share scopes, and the runtime plugin is active.
    • load-remote MiniApp/MiniAppNavigator loads the container and chunks through ScriptManager.
    • With the mini-app server stopped, the overview names the unreachable manifest URL and get-dev-server --origin explains it.
  • Panels render in the Rozenite DevTools UI.
  • iOS not exercised on a device.

Add a private, workspace-only Rozenite plugin (packages/repack-devtools-plugin)
that records ScriptManager activity, Module Federation runtime state and
events, uncaught errors, dev-server compilations and requests, and turns them
into diagnostics.

- Panels for scripts, federation, dev server and errors/symbolication
- 16 `rozenite agent callstack/repack-devtools` tools, including actions to
  reproduce issues headlessly (load-script, load-remote, invalidate-scripts,
  symbolicate, reload)
- `withRepackDevTools` adds a compilation collector and
  `/repack-devtools/state` endpoints to any Re.Pack dev server
- MF 2 runtime plugin export for recording from container start-up

Wire it into all tester apps behind WITH_ROZENITE=true and add the
repack-debug-runtime and repack-reproduce-issue skills describing how to use
it to reproduce and root-cause issues.
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
repack-website Ready Ready Preview Oct 22, 2026 4:29pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a6e2806

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

@dannyhw
dannyhw added this pull request to stack #1511 October 22, 2026 13:24
Comment thread packages/repack-devtools-plugin/src/__tests__/bundler.test.ts Fixed
…ults

Add agent tools to check retry, dedup and cache behaviour and to test
failure handling without changing app code:

- list-script-calls: every loadScript/prefetchScript/invalidateScripts
  call with outcome, duration, whether resolvers ran and whether it
  reused a stored attempt (the #1506 signature). The tracer returns a
  derived promise so unhandled rejections are still reported.
- get-script-manager: stored promises with their state, resolvers,
  hook taps and cache; flags stored rejected promises.
- inject-script-fault: fail or delay the resolve/load stage through
  ScriptManager hooks.
- inject-server-fault / list-faults / clear-faults: make any dev server
  wrapped with withRepackDevTools (MF remotes included) answer with an
  error status, a delay or a dropped connection; also available as
  GET|POST|DELETE /repack-devtools/faults.

The request log now records connections closed before a response
(status 0) and marks faulted responses. The MF runtime plugin records
the manifest HTTP status, since MF parses error pages as JSON and only
reports a parse error.
…nostics

Panels:
- Detail boxes no longer collapse over the next section and scroll
  into view when opened from a table row.
- Table cells keep long ids, URLs and messages on one line (full value
  on hover) instead of breaking every few characters; times, sizes and
  durations do not wrap; tables scroll sideways in narrow panels
  instead of clipping columns.
- Diagnostics show identical messages once and only the first three
  until expanded.
- Dev server: requests come before build output, warnings/errors and
  assets are collapsible, platforms that were never built show
  "not requested".
- The symbolication result scrolls into view; the federation load box
  is hidden without an MF runtime.

Data:
- Strip ANSI colour codes from /symbolicate code frames.
- Report a shared-package problem once when instances share a scope.
- Group MF load failures per URL and downgrade them to warnings when a
  later load of the same URL succeeded.

This branch was successfully deployed

1 active deployment
Preview — a6e2806f Deployed Oct 22, 2026 by vercel[bot]
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.

2 participants