[APPS-2792] Add: local-execution resilience tests - #496
Conversation
441fc4e to
bfed8d6
Compare
bfed8d6 to
586cdec
Compare
|
586cdec to
3b7dbea
Compare
|
@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.
🟡 Changes recommended
The process-exit test relies on Jest-buffered output that may be lost during immediate termination.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Friend, this PR adds resilience tests documenting known limitations of in-process local execution.
Changes:
- Tests CPU-bound timeout starvation and
process.exit()behavior. - Adds a child-process Jest fixture.
- Extracts shared local-execution fixtures.
File summaries
| File | Description |
|---|---|
local-execution.test.ts |
Reuses shared fixtures and strengthens cleanup. |
local-execution.resilience.test.ts |
Adds resilience tests. |
local-execution.process-exit.fixture.ts |
Exercises process termination safely. |
local-execution.fixtures.ts |
Centralizes test data. |
Review details
Suppressed comments (1)
packages/plugins/apps/src/vite/local-execution.process-exit.fixture.ts:24
- The inline resolver construction hides fixture setup inside the execution under test. Create a named resolver first and pass it to
executeScriptLocallyso setup and execution remain separate.
moduleResolverFor(func, {
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 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. 🚀 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". |
3b7dbea to
bc57444
Compare
570d957 to
e762309
Compare
…des (Milestone 7) process.exit() inside a customer function can't be tested in-process without killing the Jest worker running the assertion. Spawns local-execution.process-exit.fixture.ts as its own Jest process so the process.exit() call runs through the real executeScriptLocally/ runScriptLocally code path instead of a hand-rolled emulation of it.
func/stubExecuteAction were declared identically in three files, including the spawned-process fixture. The fixture already imports mockLogger/ moduleResolverFor from a shared helpers module today, proving the spawned process only isolates process.exit() from the parent Jest worker -- module resolution works the same as any other file. Centralizing removes the duplication without touching that isolation.
…iling Doc comments over ~5 lines and block comments over ~3 lines were restating context better captured concisely; trimmed each to its single most important WHY.
The spawned process.exit() test re-ran globalSetup.ts's real yarn install + git setup on every invocation, eating into its own timeout budget for no benefit since it never touches the fixtures directory that setup is for — overridden via --globalSetup to a no-op. Also: resolve the jest config path through the existing ROOT constant instead of a fragile relative traversal, tighten the busy-loop test's margin, and dedupe a comment repeated in two eslint-disable justifications.
e762309 to
1b96d9c
Compare
Motivation
domains/chaos-engineeringtargets Datadog-owned Kubernetes clusters — a mismatch for this in-process, customer-dev-server model.Architecture
process.exit()test can't callrunScriptLocallydirectly in the main Jest process — exiting would kill the whole test run.Changes
3 changes across 4 files
Promise.racetimeout never fires — it can only settle once the loop finishes on its own.process.exit()inside the customer function terminates the whole process immediately, bypassingrunScriptLocally'stry/finallycleanup — spawns a dedicated fixture as its own Jest process (sinceprocess.exit()can't safely run inside this Jest process) so the observed behavior is the realexecuteScriptLocally/runScriptLocallycode path, not a hand-rolled emulation of it.func/stubExecuteActionfixture data — previously declared separately in this file, the resilience test, and the spawned fixture — into a new shared module, since the fixture already proves shared imports work fine in its spawned process (it already importsmockLogger/moduleResolverForfrom a shared helpers module).local-execution.test.ts.QA Instructions
yarn workspace @dd/tests test:unit packages/plugins/apps/src/vite/local-execution.resilience.test.ts # Expected: 2 passed ✅ VERIFIEDyarn workspace @dd/apps-plugin run typecheck # Expected: clean exit ✅ VERIFIEDBlast Radius
Out of Scope / Follow-ups
1 item deferred
worker_threads) to close the confirmed sync-hang andprocess.exit()gapsDocumentation