Skip to content

✅ debugger: complete entry-snapshot capture-decision tests#4670

Merged
watson merged 1 commit into
mainfrom
watson/fix-test-todo
May 28, 2026
Merged

✅ debugger: complete entry-snapshot capture-decision tests#4670
watson merged 1 commit into
mainfrom
watson/fix-test-todo

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented May 25, 2026

Motivation

The api.spec.ts test "should capture entry snapshot only for ENTRY evaluation with no condition" had a // TODO: Validate that this test is actually correct comment. On inspection the test's assertions were correct but its name was misleading — it actually verifies that both entry and return captures are produced, not "entry snapshot only". While clarifying this, I also noticed that the shouldCaptureEntrySnapshot decision matrix was not exhaustively covered: the EXIT + no-condition case had no test, even though it exercises the !probe.condition branch of the OR in api.ts.

Changes

Test-only changes to packages/debugger/src/domain/api.spec.ts:

  • Renamed "should capture entry snapshot only for ENTRY evaluation with no condition""should capture both entry and return snapshots for ENTRY evaluation" and removed the TODO comment. The assertions and probe configuration are unchanged.
  • Added a new test "should capture both entry and return snapshots for EXIT evaluation with no condition" placed next to its EXIT + condition counterpart so the pair is easy to compare.

The three capture-decision tests now form a self-consistent triple covering every behaviorally-distinct configuration of shouldCaptureEntrySnapshot = probe.captureSnapshot && (probe.evaluateAt === 'ENTRY' || !probe.condition):

evaluateAt condition Entry captured?
ENTRY irrelevant (short-circuits) yes
EXIT none yes
EXIT present no

A regression that collapsed the OR to just evaluateAt === 'ENTRY' would now be caught by the new test, where the previous test set would not have noticed.

Test instructions

yarn test:unit --spec packages/debugger/src/domain/api.spec.ts

All 36 tests should pass.

Checklist

  • Tested locally
  • Tested on staging — N/A, test-only change with no runtime impact
  • Added unit tests for this change.
  • Added e2e/integration tests for this change. — N/A, unit-test-only change
  • Updated documentation and/or relevant AGENTS.md file — N/A

@watson watson requested review from a team as code owners May 25, 2026 08:49
Copy link
Copy Markdown
Collaborator Author

watson commented May 25, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented May 25, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 173.69 KiB 173.69 KiB 0 B 0.00%
Rum Profiler 8.08 KiB 8.08 KiB 0 B 0.00%
Rum Recorder 21.23 KiB 21.23 KiB 0 B 0.00%
Logs 55.47 KiB 55.47 KiB 0 B 0.00%
Rum Slim 131.39 KiB 131.39 KiB 0 B 0.00%
Worker 22.99 KiB 22.99 KiB 0 B 0.00%

🔗 RealWorld

@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented May 25, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 76.72% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0d403d5 | Docs | Datadog PR Page | Give us feedback!

The "should capture entry snapshot only for ENTRY evaluation with no
condition" test was misleadingly named — it actually asserts that both
entry and return captures are produced — and had a TODO flagging the
discrepancy. Rename it to reflect what it tests, and add the missing
EXIT + no-condition case so the `shouldCaptureEntrySnapshot` decision
is covered in all three behaviorally-distinct configurations:

- ENTRY (condition irrelevant) → both entry and return captured
- EXIT + no condition          → both entry and return captured
- EXIT + condition             → return only

A regression collapsing the `evaluateAt === 'ENTRY' || !probe.condition`
OR to just one of its terms would now be caught.
@watson watson force-pushed the watson/fix-test-todo branch from 11658b2 to 0d403d5 Compare May 28, 2026 11:59
@watson
Copy link
Copy Markdown
Collaborator Author

watson commented May 28, 2026

CI had stalled for some reason. Had to push to trigger a new build

@watson watson merged commit efdbccf into main May 28, 2026
31 checks passed
@watson watson deleted the watson/fix-test-todo branch May 28, 2026 12:18
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants