feat(CPL-323): raise jsParams limit, enforce combined 16 MB code + jsParams budget#351
Conversation
…4 KB jsParams cap Replace the standalone code-length check with a combined budget against max_code_length so code and js_params share a single 16 MB allocation. Raise Rocket json body limit from 10 MiB to 20 MiB so the 16 MB combined payload fits after JSON-encoding overhead. Update limits docs and the agent SKILL.md to describe the new shared budget. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates Lit Actions request size handling by replacing the previously documented (but unenforced) js_params limit with a single shared size budget for code + js_params, enforced in the API server before dispatching to the lit-actions runtime. It also raises Rocket’s JSON body limit and updates docs/tests to match the new combined-limit semantics.
Changes:
- Enforce a combined
code + js_paramssize check againstmax_code_lengthinexecute_js_inner. - Increase Rocket JSON body limit to allow larger Lit Action requests.
- Update limits documentation and adjust the max-length test assertion string.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lit-api-server/src/actions/client/execution.rs |
Adds combined-size enforcement and reuses serialized js_params bytes for dispatch. |
lit-api-server/Rocket.toml |
Raises the global Rocket JSON body limit from 10 MiB to 20 MiB. |
lit-api-server/src/actions/tests.rs |
Updates expected error string for max-length enforcement. |
docs/lit-actions/limits.mdx |
Documents the shared 16 MB budget for code + js_params. |
lit-static/SKILL.md |
Updates the published limit table to reflect the combined budget. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…f swallowing them Replace `.ok().unwrap_or_default()` with `.transpose()? + map_or(0, len)` so a js_params serialization failure surfaces a clear error instead of silently sending an empty payload and undercounting the combined-size check. Keeps the Option<Vec<u8>> in sync with whether globals were supplied. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI failure analysisThe
Investigation:
Treating these as flaky CI; rerunning the failed job. Will reassess if it reproduces on the next run. Copilot review feedback:
|
Summary
Replaces the 64 KB documented (but unenforced)
js_paramscap with a single 16 MB combined budget forcode + js_paramsagainstmax_code_length. The 16 MB budget is enforced server-side inexecute_js_innerby serializingjs_paramsonce and summing its length withcode.len()before dispatching to the lit-actions runtime. Rocket's JSON body limit is raised from 10 MiB to 20 MiB so a full 16 MB combined payload fits after JSON-encoding overhead. Docs (docs/lit-actions/limits.mdx,lit-static/SKILL.md) updated to describe the shared budget; the (currently disabled)max_code_lengthtest assertion updated to match the new error string.Test plan
cargo check --testsclean (verified locally)cargo fmt --checkclean (verified locally)code + js_paramsis just under 16 MB and confirm it executescode + js_paramsexceeds 16 MB and confirm the new combined-size error fires🤖 Generated with Claude Code