[APPS-2792] Add: dev:verify mode-aware routing for local execution (build-plugins half) - #490
Draft
tyffical wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Friend, this PR adds mode-aware cloud verification routing to the Vite development server.
Changes:
- Adds the
dev-verifymode constant. - Routes the standard execution endpoint through cloud execution in verification mode.
- Adds coverage for the new routing behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
constants.ts |
Defines the verification mode. |
dev-server.ts |
Implements mode-aware routing. |
dev-server.test.ts |
Tests cloud routing in verification mode. |
index.ts |
Passes Vite’s resolved mode to the middleware. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment was marked as resolved.
This comment was marked as resolved.
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 24, 2026 16:53
063d85e to
8edc949
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 24, 2026 16:57
6822e55 to
c37ab18
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 24, 2026 18:47
8edc949 to
c38e390
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
2 times, most recently
from
August 24, 2026 19:16
e979af2 to
e30cf71
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 24, 2026 19:24
2c6aa37 to
a048f65
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 24, 2026 19:29
e30cf71 to
2626d97
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 24, 2026 20:07
a048f65 to
5193ab7
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 24, 2026 20:13
2626d97 to
7ec3cae
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 25, 2026 00:24
5193ab7 to
8d94ddf
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 25, 2026 00:30
7ec3cae to
44b7d0c
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 25, 2026 01:13
8d94ddf to
51f9d73
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 25, 2026 01:17
44b7d0c to
6f4c565
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 25, 2026 04:41
51f9d73 to
ceeece1
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 25, 2026 15:30
6f4c565 to
cb7626e
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 25, 2026 17:23
8d82135 to
737ac66
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 25, 2026 18:39
cb7626e to
5196d11
Compare
🎉 All green!❄️ No new flaky tests detected 🔗 Commit SHA: 5e15df7 | Docs | View more details | Give us feedback! |
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 26, 2026 01:46
6720f6b to
07cca79
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 26, 2026 01:47
5196d11 to
5ec8c6e
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
2 times, most recently
from
August 26, 2026 02:35
ea84a47 to
4fd59b3
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
2 times, most recently
from
August 26, 2026 02:38
dee5a1b to
95dd7ba
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 26, 2026 04:32
4fd59b3 to
cb79658
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 26, 2026 04:34
95dd7ba to
9a46a92
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 26, 2026 16:15
cb79658 to
affa16b
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 26, 2026 16:19
9a46a92 to
bd96b5c
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 26, 2026 17:31
affa16b to
fbad040
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 26, 2026 17:32
bd96b5c to
af51e6d
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 26, 2026 18:09
fbad040 to
085afa1
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 26, 2026 18:13
af51e6d to
9914c9e
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 27, 2026 06:05
085afa1 to
64e9169
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 27, 2026 06:07
9914c9e to
68a703a
Compare
tyffical
force-pushed
the
tiffany.trinh/apps-2792-runtime-network-guard
branch
from
August 27, 2026 06:15
64e9169 to
aff9ee7
Compare
… mode Reads Vite's own --mode value server-side (server.config.mode, not import.meta.env.MODE, which breaks Jest's ts-jest transform) so 'npm run dev:verify' can exercise the real cloud execution path without the client-side transport needing to know which mode it's running in.
tyffical
force-pushed
the
tiffany.trinh/apps-2792-dev-verify-cli
branch
from
August 27, 2026 06:16
68a703a to
5e15df7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
/__dd/executeActionlocal,/__dd/executeActionViaCloudcloud) that [APPS-2792] Add: wire local execution into the real dev server #481 introduced.npm run dev:verifydoesn't exist — pre-publish parity checking against the real cloud/Deno round trip requires a manual curl to/__dd/executeActionViaCloud. This PR makes the dev server itself mode-aware so a realdev:verifycommand (added to the scaffold template in a separate web-ui PR) can route through the same/__dd/executeActionURL the frontend already calls, without the frontend needing to know which mode it's in.dev-server-transport.ts) mode-aware viaimport.meta.env.MODE. Verified directly against this repo's actual Jest setup (ts-jest,"module": "preserve") thatimport.metahas no CommonJS equivalent — introducing it breaksts-jest's transform withSyntaxError: Cannot use 'import.meta' outside a modulefor any file that imports it, including the existingexecute-backend-function.test.ts. Routing server-side, keyed off Vite's own resolved--mode, avoids this entirely and keeps the client transport unchanged.Architecture
/__dd/executeActionViaClouditself is untouched and still directly reachable — this PR only adds a second way to reach the same cloud behavior, gated by mode, at the URL the client already calls by default.Changes
DEV_VERIFY_MODEconstant ('dev-verify') — the Vite--modevaluedev:verifywill use.createDevServerMiddlewaretakes a new optionalmode?: stringparameter. Whenreq.url === '/__dd/executeAction'andmode === DEV_VERIFY_MODE, delegates to the same cloud-execution logic/__dd/executeActionViaClouduses (including the existing "auth not configured" 400 guard) instead of running locally.configureServer(server)now passesserver.config.mode(Vite's own resolved mode, read via the plugin API — noimport.meta.envinvolved) through tocreateDevServerMiddleware.mode: DEV_VERIFY_MODEand POSTing to/__dd/executeActionhits the realpreview-asyncround trip (vianock) and never callsloadModule— confirming it takes the cloud path, not the local one, for the exact same URL the client always calls.QA Instructions
yarn test:unit packages/plugins/apps/src/vite/dev-server.test.ts # Expected: Test Suites: 1 passed / Tests: 28 passed ✅ VERIFIEDyarn test:unit packages/plugins/apps # Expected: Test Suites: 25 passed / Tests: 343 passed ✅ VERIFIEDyarn workspace @dd/apps-plugin run typecheck # Expected: no output, clean exit ✅ VERIFIEDManual QA against a real scaffolded app (invoking
vite dev --mode dev-verifydirectly, ahead of the web-ui half'sdev:verifyscript landing), per the Testing and QA Guide:Confirmed it's genuinely routing to the cloud, not local in-process execution: the customer function's own
console.logdid not print in the local terminal (unlike the same call under defaultnpm run dev, where it does), and the server log shows the real round trip —Bundling backend function...→Executing action via cloud...→Calling Datadog API: https://api.datad0g.com/api/v2/app-builder/queries/preview-async→Query execution started with receipt: ...→Long-poll attempt 1/10...→Long-poll response, done: true.Blast Radius
npm run dev(default mode) —modedefaults toundefined/'development', which never equalsDEV_VERIFY_MODE, so the existing local-execution branch is unchanged./__dd/executeActionViaCloudis untouched.--modeflag, which the web-ui template'sdev:verifyscript will set — nothing customer-authored).Out of Scope / Follow-ups
dev:verifyscript (vite dev --mode dev-verify) and a minimal example backend function to the create-apps templatedev:verifycommanddev:verifyin the publish flow beforedatadog-apps publishdatadog-appsCLIDocumentation