Repository navigation
[APPS-2945] Update: build dev:verify bundles like uploads, and explain an oversized-bundle rejection - #558
[APPS-2945] Update: build dev:verify bundles like uploads, and explain an oversized-bundle rejection#558tyffical wants to merge 1 commit into
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 5b97251 | Docs | View more details | Give us feedback! |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Runtime selection and script-limit behavior are comprehensively covered; only a non-blocking test-description grammar nit remains.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Aligns dev:verify and cloud execution with each organization’s backend runtime while enforcing live action script limits.
Changes:
- Uses the resolved v1/v2 runtime for cloud bundles and execution.
- Fetches and caches runtime-specific script limits.
- Adds documentation and comprehensive coverage.
| File | Description |
|---|---|
packages/plugins/apps/src/vite/index.ts |
Wires runtime resolution and limit prefetching. |
packages/plugins/apps/src/vite/index.test.ts |
Tests runtime and prefetch integration. |
packages/plugins/apps/src/vite/dev-server.ts |
Builds and submits runtime-specific cloud actions. |
packages/plugins/apps/src/vite/dev-server.test.ts |
Covers requests, limits, caching, and failures. |
packages/plugins/apps/src/vite/dev-server.integration.test.ts |
Updates middleware integration setup. |
packages/plugins/apps/src/backend-runtime.ts |
Defines runtimes and action FQN mapping. |
packages/plugins/apps/src/backend-runtime.test.ts |
Tests action FQN mapping. |
packages/plugins/apps/src/action-script-limits.ts |
Resolves and caches live script limits. |
packages/plugins/apps/src/action-script-limits.test.ts |
Tests authentication, parsing, caching, and fallback. |
packages/plugins/apps/README.md |
Documents runtime-aware cloud execution and limits. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
4495187 to
6164a77
Compare
3ebc888 to
164b6c1
Compare
6164a77 to
a160fb7
Compare
164b6c1 to
4bcaf66
Compare
14c5415 to
e898bea
Compare
e4ce1c6 to
f5ad4cf
Compare
e898bea to
481364f
Compare
f5ad4cf to
146e2df
Compare
481364f to
e574841
Compare
146e2df to
f740f73
Compare
e574841 to
34a9189
Compare
f740f73 to
41a3a65
Compare
34a9189 to
abf34ad
Compare
41a3a65 to
1200bd8
Compare
abf34ad to
892bda9
Compare
1200bd8 to
87567b2
Compare
bd21790 to
2352fe9
Compare
e44fe4a to
141d960
Compare
9c0e2e3 to
80eb07d
Compare
141d960 to
04671dd
Compare
80eb07d to
8da4921
Compare
04671dd to
696d422
Compare
8da4921 to
e66dbb7
Compare
696d422 to
a64a6ad
Compare
e3817c8 to
3d136e8
Compare
a64a6ad to
31ea49f
Compare
dd2f262 to
4c83242
Compare
…rsized-bundle rejection Cloud execution (dev:verify, /__dd/executeActionViaCloud) builds backend functions with the shared base config's minify and keepNames settings, the ones uploads use. It also pins the production settings Vite would otherwise take from the dev server's NODE_ENV: export conditions, import.meta.env.DEV and PROD, and the JSX dev transform. So it sends the bytes a `vite build` upload writes. When Datadog rejects a bundle as an invalid `script` input (INVALID_INPUT_PARAMETER on `.script`), the dev server answers with a 413 that names the function, its size in code points and Datadog's answer, and warns once per function, instead of passing the 400 on as a 500. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4c83242 to
5b97251
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Motivation
dev:verifyshould send the bytes an upload builds: minified, and with production settings even though the dev server runs underNODE_ENV=development. (APPS-2945, design page)jsFunctionWithActionsscript with a generic 400, which the dev server passed on as a 500; the developer should learn which function is too large.Architecture
flowchart TD R["dev:verify, /__dd/executeActionViaCloud, /__dd/debugBundle"] --> B["getBaseBackendBuildConfig (minify, keepNames) + withProductionSettings"] B --> P["POST preview-async: jsFunctionWithActions, inline script"] P -->|"200"| L["GET execution-long-polling: result"] P -->|"400 INVALID_INPUT_PARAMETER on .script"| E["413 naming the function and its size; warned once per function"]withProductionSettingspins what Vite derives fromNODE_ENV: export conditions,import.meta.env.DEV/PRODandesbuild.jsxDev.Changes
7 changes across vite/build-config.ts, vite/dev-server.ts, README.md and tests
build-config.ts,build-backend-functions.tsbuild-config.tsdefaultServerConditionsto the middleware.index.ts,dev-server.tsdev-server.tsREADME.mddev:verifybundles.dev-server.integration.test.tsdev-server.test.ts,build-config.test.ts,index.test.tsQA Instructions
5b972517https://github.com/DataDog/build-plugins/actions/runs/39531211410TMPDIR=/private/tmpkeeps the manifest-tags and parameters suites passing on macOS.DD_SITE=<staging site>,DD_API_KEYandDD_APP_KEYfirst, and run the scripts fromQA_DIR.QA helper scripts
install-plugin.sh:qa-run.sh:qa-parity.sh:log-requests.mjs:capture-oversize.mjs:QA fixtures
src/getGreeting.backend.ts:src/hugeGreeting.backend.tsreturns one character of a 1,050,000-character string literal, so its minified bundle is over the limit.src/flavors.backend.ts, importing a local packagenode_modules/dd-conditional-flavor:src/markup.backend.tsx, with the scaffold's"jsx": "react-jsx"and React 19:src/App.tsxadds, sovite buildpackages both:Staging's answer at and one past the limit
The dev:verify bundle equals the upload's bytes
dev:verify against staging, including an oversized function
Local development mode makes no manifest request
Blast Radius
dev:verifyand the cloud dev-server routes send minified, production-built bundles, so cloud stack frames point into minified code, as an upload's do.Out of Scope / Follow-ups
7 items deferred
NODE_ENVdoRequest's formatted message and quotes only the.scriptlinevite builddoesn't check bundle size, so an oversized function fails only when it runsscriptlimit indev:verifyDocumentation
🤖 Generated with Claude Code