Skip to content

chore: a2ui playground deps + extractor windows fix + rspeedy build o…#2562

Merged
PupilTong merged 1 commit into
lynx-family:mainfrom
PupilTong:claude/quirky-merkle-non-a2ui
May 7, 2026
Merged

chore: a2ui playground deps + extractor windows fix + rspeedy build o…#2562
PupilTong merged 1 commit into
lynx-family:mainfrom
PupilTong:claude/quirky-merkle-non-a2ui

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented May 6, 2026

…rder

Split out from the broader a2ui refactor — these are the non-packages/genui/a2ui changes.

  • a2ui-catalog-extractor: force POSIX path separators on TypeDoc entry points so the extractor works on Windows; exit non-zero when source files match but 0 components are emitted; recognize the published bin shim as a valid entry script.
  • a2ui-playground: deps + rsbuild/lynx configs aligned with the post-refactor a2ui API; add per-package turbo.json so build:lynx runs before build; run payload-store GC on GET so the dev server can't keep stale payloads past TTL; drop @lynx-js/lynx-ui-input to keep one React major across the workspace.
  • rspeedy/core/turbo.json: declare //#build as a dep of build so the root tsc --build finishes before rspeedy's rslib build d.ts generation needs the webpack plugins' lib/*.d.ts.
  • web-platform/web-core: stop redeclaring fetch as a chunk-scope binding so BTS chunks reuse window.fetch.

Stacked on top of the broader a2ui refactor PR — the catalog.json subpath exports the playground imports here are introduced there.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error reporting when catalog configuration is incomplete
    • Fixed Windows path compatibility in TypeDoc processing
  • New Features

    • Added in-memory payload storage with dev-server support for A2UI playground
    • Added Turbo build tasks for the playground
  • Refactor

    • Simplified fetch handling in chunk loading
  • Chores

    • Updated tooling ignores and test coverage exclusions for playground output

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

🦋 Changeset detected

Latest commit: a797591

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

This PR includes changesets to release 9 packages
Name Type
@lynx-js/web-core Patch
upgrade-rspeedy Patch
@lynx-js/web-rsbuild-server-middleware Patch
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
create-rspeedy Patch
@lynx-js/web-worker-rpc Patch
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/rspeedy 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

📝 Walkthrough

Walkthrough

Removes the explicit chunk-scoped fetch binding so BTS chunks use the host window.fetch; adds cross-platform path normalization and a fail-fast guard in the A2UI catalog extractor; implements an in-memory payload store and dev-server middleware for the A2UI playground; and updates Turbo task dependencies and linter/test ignores for playground output.

Changes

Web-core Fetch Scope Refactoring

Layer / File(s) Summary
Type Definition
packages/web-platform/web-core/ts/types/BTSChunk.ts
Removed the fetch: unknown member from the BTSChunkEntry tuple type (commented out).
Core Implementation
packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts
Commented out fetch parameter in the dynamically constructed module and removed the tt.fetch argument when invoking the module initializer.
Changeset Documentation
.changeset/quirky-merkle-web-core-fetch.md
Added a patch changeset for @lynx-js/web-core describing the change to reuse host window.fetch rather than redeclaring fetch per chunk.

A2UI Catalog Extractor Robustness

Layer / File(s) Summary
Data / Inputs
packages/genui/a2ui-catalog-extractor/src/index.ts
Normalize TypeDoc entry/source file paths by replacing Windows backslashes with forward slashes for cross-platform consistency.
CLI / Guardrail
packages/genui/a2ui-catalog-extractor/src/cli.ts
Added a fail-loud guard: when source files matched but no catalogs emitted, print an explanatory error and exit with code 1 (instructions to annotate @a2uiCatalog <Name>).

A2UI Playground (Payload Store & Dev Middleware)

Layer / File(s) Summary
In-Memory Model
packages/genui/a2ui-playground/rsbuild.config.ts
Introduced StoredPayload interface, payloadStore map, and PAYLOAD_TTL_MS constant for TTL-managed payloads.
Helpers / GC
packages/genui/a2ui-playground/rsbuild.config.ts
Added gcPayloads, readJsonBody, and sendJson helpers for TTL cleanup, request parsing, and JSON responses with CORS/cache headers.
Middleware
packages/genui/a2ui-playground/rsbuild.config.ts
Implemented a2uiPayloadMiddleware to handle CORS/preflight, POST /__a2ui_payload (store payload with randomUUID), and GET /__a2ui/{id}/{field} (retrieve messages/actionMocks).
Plugin Wiring
packages/genui/a2ui-playground/rsbuild.config.ts
Added a2uiPayloadPlugin (RsbuildPlugin) to register middleware with the dev server and included it in the plugins list.
RSBuild Config
packages/genui/a2ui-playground/lynx.config.ts
Adjusted imports, removed a2uiPayloadPlugin from this config (middleware wired via rsbuild plugin), and set minify: false in output.
Dev / Build Tasks
packages/genui/a2ui-playground/turbo.json
Added a new Turbo config with tasks build:lynx, build, dev, dev:lynx, preview, and preview:lynx and their inputs/outputs and dependencies.

Build Infrastructure & Tooling Updates

Layer / File(s) Summary
Turbo Dependency
packages/rspeedy/core/turbo.json
Inserted //#build as a preceding dependency in the build task's dependsOn array.
Lint / Coverage Excludes
eslint.config.js, vitest.config.ts
Added ignore/exclude patterns (and comments) for the a2ui-playground www/** output in ESLint and Vitest coverage config.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • lynx-family/lynx-stack#1834: Prior changes that added createChunkLoading and modified BTSChunkEntry to include fetch — directly related to removing the injected fetch.
  • lynx-family/lynx-stack#2533: Modifications to the A2UI playground config and URL/asset handling (overlaps rsbuild.config.ts and playground wiring).
  • lynx-family/lynx-stack#2546: Related Turbo config edits that reintroduce //#build dependency behavior (build-task dependency changes).

Suggested reviewers

  • Sherry-hue
  • colinaaa
  • HuJean
  • upupming

Poem

🐰 I nibble code under moonlight's mesh,
Chunks freed from bindings, fetch finds window fresh.
Catalogs now shout if no names are shown,
Playgrounds keep payloads until they're blown.
Build trees rebloom — hop, review, then rest.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is truncated and incomplete (ending with 'o…'), making it unclear what the full PR objective is. Complete the full PR title to clearly convey the main changes. Consider: 'chore: a2ui playground deps + extractor windows fix + rspeedy build order'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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

✨ 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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
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: 1

Caution

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

⚠️ Outside diff range comments (1)
packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts (1)

158-167: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

loadScriptAsync silently drops readScriptAsync rejections.

If readScriptAsync rejects (e.g., fetch fails with a network error or a non-200 status), the .then() branch is never reached, callback is never invoked, and the caller hangs indefinitely with no error signal. This is a pre-existing gap, but it is worth fixing while this function is under active modification.

🛡️ Proposed fix
  loadScriptAsync: async (sourceURL, callback, templateUrl: string) => {
-   readScriptAsync(sourceURL, templateUrl).then((jsContent) => {
-     callback(
-       null,
-       createBundleInitReturnObj(
-         jsContent,
-       ),
-     );
-   });
+   readScriptAsync(sourceURL, templateUrl).then(
+     (jsContent) => {
+       callback(null, createBundleInitReturnObj(jsContent));
+     },
+     (err) => {
+       callback(err instanceof Error ? err : new Error(String(err)), undefined);
+     },
+   );
  },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts`
around lines 158 - 167, The loadScriptAsync implementation currently calls
readScriptAsync(...).then(...) and thus swallows any rejection, leaving the
callback never invoked; update loadScriptAsync (the loadScriptAsync function) to
handle failures from readScriptAsync by catching rejections (either add a .catch
or convert to async/await with try/catch) and invoke callback(error) on failure,
and still call callback(null, createBundleInitReturnObj(jsContent)) on success
so callers always receive either an error or the bundle object.
🧹 Nitpick comments (1)
packages/genui/a2ui-catalog-extractor/src/cli.ts (1)

146-160: ⚡ Quick win

Avoid success-style logging before failing on zero catalogs.

At Line 146, printGeneratedComponents runs before the new failure guard, so the CLI can print a success-style summary and then return 1. Move the zero-components check before printGeneratedComponents to keep output unambiguous.

Proposed adjustment
-  printGeneratedComponents(components);
-
-  // Fail loudly if we matched source files but emitted no components —
+  // Fail loudly if we matched source files but emitted no components —
   // this used to silently succeed on Windows when TypeDoc rejected
   // backslash entry-point paths, and downstream packages then failed
   // to import the missing `catalog.json` files.
   if (components.length === 0) {
     console.error(
       `[a2ui-catalog-extractor] Found ${uniqueSourceFiles.length} `
         + `source file(s) but emitted 0 component catalogs. Make sure `
         + `each catalog props interface is annotated with `
         + `\`@a2uiCatalog <Name>\`.`,
     );
     return 1;
   }
+
+  printGeneratedComponents(components);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/a2ui-catalog-extractor/src/cli.ts` around lines 146 - 160, The
CLI prints a success-style summary by calling
printGeneratedComponents(components) before checking for zero emitted catalogs;
move the zero-components guard (the if (components.length === 0) block that logs
using uniqueSourceFiles and returns 1) to run before calling
printGeneratedComponents so no success output is emitted when we intend to fail
— keep the same error message and return 1 behavior, just relocate that block to
precede the call to printGeneratedComponents.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/genui/a2ui-playground/rsbuild.config.ts`:
- Around line 33-47: The readJsonBody function currently buffers the entire
request with no size limit; update readJsonBody(IncomingMessage) to accept a
maxBodySize (e.g., default 1MB) and enforce it while collecting chunks: track
accumulated length on each 'data' event, and if it exceeds maxBodySize, remove
listeners, destroy the request (or call req.pause()/req.destroy()), and reject
the promise with a clear Payload Too Large error (HTTP 413) so the POST/payload
handler cannot exhaust server memory; ensure you also clean up 'end'/'error'
listeners on early termination. Reference: readJsonBody and the payload POST
handler that calls it.

---

Outside diff comments:
In
`@packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts`:
- Around line 158-167: The loadScriptAsync implementation currently calls
readScriptAsync(...).then(...) and thus swallows any rejection, leaving the
callback never invoked; update loadScriptAsync (the loadScriptAsync function) to
handle failures from readScriptAsync by catching rejections (either add a .catch
or convert to async/await with try/catch) and invoke callback(error) on failure,
and still call callback(null, createBundleInitReturnObj(jsContent)) on success
so callers always receive either an error or the bundle object.

---

Nitpick comments:
In `@packages/genui/a2ui-catalog-extractor/src/cli.ts`:
- Around line 146-160: The CLI prints a success-style summary by calling
printGeneratedComponents(components) before checking for zero emitted catalogs;
move the zero-components guard (the if (components.length === 0) block that logs
using uniqueSourceFiles and returns 1) to run before calling
printGeneratedComponents so no success output is emitted when we intend to fail
— keep the same error message and return 1 behavior, just relocate that block to
precede the call to printGeneratedComponents.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f865394d-1b34-4e43-bbea-c7fa991d0ec9

📥 Commits

Reviewing files that changed from the base of the PR and between 5f3b6eb and 76e85a2.

📒 Files selected for processing (9)
  • .changeset/quirky-merkle-web-core-fetch.md
  • packages/genui/a2ui-catalog-extractor/src/cli.ts
  • packages/genui/a2ui-catalog-extractor/src/index.ts
  • packages/genui/a2ui-playground/lynx.config.ts
  • packages/genui/a2ui-playground/rsbuild.config.ts
  • packages/genui/a2ui-playground/turbo.json
  • packages/rspeedy/core/turbo.json
  • packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts
  • packages/web-platform/web-core/ts/types/BTSChunk.ts

Comment thread packages/genui/a2ui-playground/rsbuild.config.ts
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 6, 2026

Merging this PR will not alter performance

✅ 81 untouched benchmarks
⏩ 26 skipped benchmarks1


Comparing PupilTong:claude/quirky-merkle-non-a2ui (a797591) with main (5f3b6eb)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 6, 2026

React External

#929 Bundle Size — 680.82KiB (0%).

a797591(current) vs 5f3b6eb main#913(baseline)

Bundle metrics  no changes
                 Current
#929
     Baseline
#913
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#929
     Baseline
#913
No change  Other 680.82KiB 680.82KiB

Bundle analysis reportBranch PupilTong:claude/quirky-merkle-n...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 6, 2026

React Example with Element Template

#80 Bundle Size — 198.12KiB (0%).

a797591(current) vs 5f3b6eb main#64(baseline)

Bundle metrics  Change 2 changes
                 Current
#80
     Baseline
#64
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 77(-1.28%) 78
No change  Duplicate Modules 23 23
Change  Duplicate Code 40.59%(+0.02%) 40.58%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#80
     Baseline
#64
No change  IMG 145.76KiB 145.76KiB
No change  Other 52.36KiB 52.36KiB

Bundle analysis reportBranch PupilTong:claude/quirky-merkle-n...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 6, 2026

React Example

#7814 Bundle Size — 225.52KiB (0%).

a797591(current) vs 5f3b6eb main#7798(baseline)

Bundle metrics  no changes
                 Current
#7814
     Baseline
#7798
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 180 180
No change  Duplicate Modules 69 69
No change  Duplicate Code 44.54% 44.54%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7814
     Baseline
#7798
No change  IMG 145.76KiB 145.76KiB
No change  Other 79.77KiB 79.77KiB

Bundle analysis reportBranch PupilTong:claude/quirky-merkle-n...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 6, 2026

React MTF Example

#946 Bundle Size — 196.68KiB (0%).

a797591(current) vs 5f3b6eb main#930(baseline)

Bundle metrics  no changes
                 Current
#946
     Baseline
#930
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 174 174
No change  Duplicate Modules 66 66
No change  Duplicate Code 44.05% 44.05%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#946
     Baseline
#930
No change  IMG 111.23KiB 111.23KiB
No change  Other 85.45KiB 85.45KiB

Bundle analysis reportBranch PupilTong:claude/quirky-merkle-n...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 6, 2026

Web Explorer

#9387 Bundle Size — 900.02KiB (~-0.01%).

a797591(current) vs 5f3b6eb main#9371(baseline)

Bundle metrics  Change 2 changes
                 Current
#9387
     Baseline
#9371
No change  Initial JS 44.46KiB 44.46KiB
No change  Initial CSS 2.22KiB 2.22KiB
Change  Cache Invalidation 1.53% 0%
No change  Chunks 9 9
No change  Assets 11 11
No change  Modules 228 228
No change  Duplicate Modules 11 11
Change  Duplicate Code 27.28%(-0.04%) 27.29%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#9387
     Baseline
#9371
Improvement  JS 495.88KiB (~-0.01%) 495.9KiB
No change  Other 401.92KiB 401.92KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch PupilTong:claude/quirky-merkle-n...Project dashboard


Generated by RelativeCIDocumentationReport issue

…lumbing

Independent slice of the broader a2ui refactor — these changes don't
depend on the renderer/store reshape and can land on their own.

- a2ui-catalog-extractor: force POSIX path separators on TypeDoc
  entry points so the extractor works on Windows; exit non-zero when
  source files match but 0 components are emitted; recognize the
  published bin shim as a valid entry script.
- rspeedy/core/turbo.json: declare `//#build` as a dep of `build`.
  Without it, a fresh CI checkout can race rspeedy's `rslib build`
  d.ts generation against the root `tsc --build` that produces the
  webpack plugins' `lib/*.d.ts`, intermittently failing with TS2307
  on `@lynx-js/cache-events-webpack-plugin` /
  `@lynx-js/chunk-loading-webpack-plugin`.
- web-platform/web-core: stop redeclaring `fetch` as a chunk-scope
  binding so BTS chunks reuse `window.fetch`.
- a2ui-playground: relocate the in-memory payload store from
  `lynx.config.ts` to `rsbuild.config.ts` (it belongs to the rsbuild
  dev server, not the rspeedy lynx config); run `gcPayloads()` on
  GET too so an idle dev server can't keep stale payloads past the
  30-minute TTL; add per-package `turbo.json` declaring task
  ordering and outputs.
- ci: ignore `packages/genui/a2ui-playground/www/**` in eslint and
  vitest coverage so the rspeedy/rsbuild build output isn't parsed
  as source.
@PupilTong PupilTong force-pushed the claude/quirky-merkle-non-a2ui branch from 76e85a2 to a797591 Compare May 6, 2026 13:29
Copy link
Copy Markdown
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.

♻️ Duplicate comments (1)
packages/genui/a2ui-playground/rsbuild.config.ts (1)

33-47: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Cap payload size before buffering the full request body.

readJsonBody currently accumulates the entire POST body with no byte limit, so one large request can exhaust memory before the error path runs. Reject oversized bodies early and return 413 from the POST handler.

Suggested fix
 interface StoredPayload {
   messages: unknown;
   actionMocks?: unknown;
   createdAt: number;
 }
 const payloadStore = new Map<string, StoredPayload>();
 const PAYLOAD_TTL_MS = 30 * 60 * 1000; // 30 minutes
+const MAX_PAYLOAD_BYTES = 1024 * 1024; // 1MB

 function readJsonBody(req: IncomingMessage): Promise<unknown> {
   return new Promise((resolve, reject) => {
     const chunks: Buffer[] = [];
-    req.on('data', (c: Buffer) => chunks.push(c));
-    req.on('end', () => {
+    let total = 0;
+
+    const cleanup = () => {
+      req.off('data', onData);
+      req.off('end', onEnd);
+      req.off('error', onError);
+    };
+
+    const onError = (error: Error) => {
+      cleanup();
+      reject(error);
+    };
+
+    const onData = (chunk: Buffer) => {
+      total += chunk.length;
+      if (total > MAX_PAYLOAD_BYTES) {
+        cleanup();
+        req.destroy();
+        reject(new Error('payload too large'));
+        return;
+      }
+      chunks.push(chunk);
+    };
+
+    const onEnd = () => {
+      cleanup();
       try {
         const raw = Buffer.concat(chunks).toString('utf8');
         resolve(raw ? JSON.parse(raw) : {});
       } catch (e) {
         reject(e instanceof Error ? e : new Error(String(e)));
       }
-    });
-    req.on('error', reject);
+    };
+
+    req.on('data', onData);
+    req.on('end', onEnd);
+    req.on('error', onError);
   });
 }
@@
       } catch (e) {
-        sendJson(res, 400, {
-          error: e instanceof Error ? e.message : 'bad request',
-        });
+        const message = e instanceof Error ? e.message : 'bad request';
+        sendJson(res, message === 'payload too large' ? 413 : 400, {
+          error: message,
+        });
       }

Also applies to: 99-102

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/a2ui-playground/rsbuild.config.ts` around lines 33 - 47,
readJsonBody currently buffers the entire request with no limit — add a maxBytes
cap (either a constant or parameter) and track accumulated bytes while listening
to 'data'; if the running total exceeds maxBytes immediately remove listeners,
destroy the socket or call req.pause(), and reject with a distinct error (e.g.,
PayloadTooLargeError or an Error with a recognizable code). Update the POST
handler that calls readJsonBody to catch that specific error and respond with
status 413 and an appropriate message; also apply the same capped-buffer logic
to the other equivalent JSON-body reader (the similar function at the other
location referenced in the diff) so both endpoints guard against oversized
bodies.
🧹 Nitpick comments (1)
packages/web-platform/web-core/ts/types/BTSChunk.ts (1)

35-35: 💤 Low value

LGTM — optional: remove the dead comment from the type definition.

The // fetch: unknown, comment carries no structural meaning in a TypeScript function type and will silently mislead anyone counting positional parameters. The corresponding comments in createChunkLoading.ts (// 'fetch', and // tt.fetch,) already document the removal at the implementation level. Deleting the comment here keeps the type authoritative.

♻️ Proposed cleanup
   prompt: unknown,
-  // fetch: unknown,
   XMLHttpRequest: unknown,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/web-platform/web-core/ts/types/BTSChunk.ts` at line 35, Remove the
dead inline comment "// fetch: unknown," from the BTSChunk type definition in
packages/web-platform/web-core/ts/types/BTSChunk.ts; locate the exported
BTSChunk (or the function type declaration) and delete that commented parameter
so the type signature remains authoritative and doesn't mislead about positional
parameters.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@packages/genui/a2ui-playground/rsbuild.config.ts`:
- Around line 33-47: readJsonBody currently buffers the entire request with no
limit — add a maxBytes cap (either a constant or parameter) and track
accumulated bytes while listening to 'data'; if the running total exceeds
maxBytes immediately remove listeners, destroy the socket or call req.pause(),
and reject with a distinct error (e.g., PayloadTooLargeError or an Error with a
recognizable code). Update the POST handler that calls readJsonBody to catch
that specific error and respond with status 413 and an appropriate message; also
apply the same capped-buffer logic to the other equivalent JSON-body reader (the
similar function at the other location referenced in the diff) so both endpoints
guard against oversized bodies.

---

Nitpick comments:
In `@packages/web-platform/web-core/ts/types/BTSChunk.ts`:
- Line 35: Remove the dead inline comment "// fetch: unknown," from the BTSChunk
type definition in packages/web-platform/web-core/ts/types/BTSChunk.ts; locate
the exported BTSChunk (or the function type declaration) and delete that
commented parameter so the type signature remains authoritative and doesn't
mislead about positional parameters.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3452d448-9870-4828-8a06-771f84b730a7

📥 Commits

Reviewing files that changed from the base of the PR and between 76e85a2 and a797591.

📒 Files selected for processing (11)
  • .changeset/quirky-merkle-web-core-fetch.md
  • eslint.config.js
  • packages/genui/a2ui-catalog-extractor/src/cli.ts
  • packages/genui/a2ui-catalog-extractor/src/index.ts
  • packages/genui/a2ui-playground/lynx.config.ts
  • packages/genui/a2ui-playground/rsbuild.config.ts
  • packages/genui/a2ui-playground/turbo.json
  • packages/rspeedy/core/turbo.json
  • packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts
  • packages/web-platform/web-core/ts/types/BTSChunk.ts
  • vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/web-platform/web-core/ts/client/background/background-apis/createChunkLoading.ts
  • packages/genui/a2ui-playground/turbo.json

@PupilTong PupilTong self-assigned this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants