Skip to content

[SDTEST-3827] Abort full discovery when no tests are skippable#75

Merged
anmarchenko merged 1 commit into
mainfrom
anmarchenko/abort-discovery-no-skippables
Jun 5, 2026
Merged

[SDTEST-3827] Abort full discovery when no tests are skippable#75
anmarchenko merged 1 commit into
mainfrom
anmarchenko/abort-discovery-no-skippables

Conversation

@anmarchenko
Copy link
Copy Markdown
Member

@anmarchenko anmarchenko commented Jun 5, 2026

What

Abort long-running full test discovery when TIA/test skipping is enabled but Datadog returns no TIA-skippable tests for the run. In that case planning falls back to fast test-file discovery. If full discovery completes successfully before that cancellation takes effect, its results are still used.

Why

Full discovery is only needed to map TIA-skippable tests onto local test files. When the skippable set is empty, continuing full discovery adds planning latency without changing which tests should run.

E2E testing

Run ddtest plan in a repository with TIA/test skipping enabled where the skippable-tests response is empty. Verify the planner logs No TIA-skippable tests found for this run, cancelling full test discovery, writes the plan from fast-discovered test files, and still completes successfully.

@anmarchenko anmarchenko marked this pull request as ready for review June 5, 2026 10:56
@anmarchenko anmarchenko requested a review from a team as a code owner June 5, 2026 10:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4da31442b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

skippedTests = tp.fetchTestsToSkip(tiaSkippingEnabled)
tp.planReport.SkippableTestsCount = skippedTests.Count()

if tiaSkippingEnabled && len(skippedTests.tiaSkippableTests) == 0 {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep full discovery when disabled tests are skippable

When TIA is enabled but Datadog returns zero TIA-skippable tests, this cancels full discovery even if fetchTestsToSkip just populated skippedTests.disabledTests from Test Management. In that scenario (Test Management enabled with disabled tests but no TIA skips), a still-running full discovery is aborted and the planner falls back to fast file discovery, so recordFullDiscoveryResults never calls skippableTests.Contains to mark disabled tests as skipped or drop fully skipped files. Please gate this on the combined skip set (or on len(skippedTests.disabledTests) == 0) rather than TIA-only skips.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

@anmarchenko anmarchenko Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test suite is supposed to have a very small number of disabled tests, it is not useful to run long tests discovery process to be able to find the test suites that would be fully disabled - the chances of this happening are close to zero.

TIA is another story - for some commits we are going to skip a lot of tests, up to 100% - so if we skip tests, we always want to run tests discovery.

@anmarchenko anmarchenko changed the title Abort full discovery when no tests are skippable [SDTEST-3827] Abort full discovery when no tests are skippable Jun 5, 2026
@anmarchenko
Copy link
Copy Markdown
Member Author

E2E Test Report: SUCCESS

Tested by: Shepherd Agent (autonomous QA for Datadog Test Optimization)

Test Environment

  • Method: Local Shepherd/crook testing with mockdog
  • PR: [SDTEST-3827] Abort full discovery when no tests are skippable #75
  • Branch tested: anmarchenko/abort-discovery-no-skippables
  • Revision tested: f4da31442b10569e52c4327cd6cdf71b3b8dd025
  • Feature under test: Abort full test discovery when TIA/test skipping is enabled but the skippable-tests response is empty.

Results

Check Status
Sidekiq Minitest ddtest-plan with TIA enabled and empty skippables Passed
RuboCop RSpec ddtest-plan, scoped to spec/rubocop/version_spec.rb Passed
Quotes Rails Minitest/Rails ddtest-plan, scoped to test/models/quote_test.rb Passed
Sidekiq fixed 3-runner split after cancellation Passed
Full discovery cancellation log emitted Passed
Planner fell back to fast-discovered test files Passed
.testoptimization/tests-discovery/tests.json absent from stashed plans Passed
Live monitor saw no discovery JSON while planning Passed

Verification Details

All successful runs used mockdog scenarios where TIA/test skipping was enabled and the skippable-tests endpoint returned an empty list ({"data":[]}).

Observed planner evidence:

  • Logged No TIA-skippable tests found for this run, cancelling full test discovery.
  • Logged full discovery cancellation (context canceled for Minitest, signal: killed for RSpec).
  • Logged fallback to fast test file discovery.
  • Completed planning successfully and wrote runner outputs.

Stashed output checks:

  • crook-data/runs/20260605-130851/rubocop/.testoptimization/tests-discovery/tests.json: absent
  • crook-data/runs/20260605-130935/quotes-rails/.testoptimization/tests-discovery/tests.json: absent
  • crook-data/runs/20260605-131106/sidekiq/.testoptimization/tests-discovery/tests.json: absent
  • crook-data/runs/20260605-131349/sidekiq/.testoptimization/tests-discovery/tests.json: absent

Plan outputs:

  • RuboCop scoped RSpec plan: 1 fast-discovered file, 1 planned file, 1 runner.
  • Quotes Rails scoped Minitest/Rails plan: 1 fast-discovered file, 1 planned file, 1 runner.
  • Sidekiq fixed runner edge case: 36 fast-discovered files split evenly across 3 runners (12/12/12).
  • Sidekiq monitored run: crook exit 0; live monitor result seen=no for .testoptimization/tests-discovery/tests.json.

Issues Found

  • One exploratory rubocop ddtest run completed planning correctly, then failed during actual RSpec execution because the selected RuboCop spec failed under that run environment. This was not treated as a ddtest planner regression; I reran RuboCop with the new planner-only preset and verified the PR behavior successfully.
  • Added missing planner-only commands for additional Ruby playgrounds (rubocop, feedbin, quotes-rails, vagrant) so planner-only ddtest PR verification can be run without executing test workers.

Datadog UI Verification

Not applicable for this verification pass. These were local mockdog-backed planner runs; no Datadog UI data was expected. Backend interactions were verified through mockdog HTTP caches and debug logs.

Test Methodology

  1. Built and injected the ddtest PR branch using --dep ddtest=anmarchenko/abort-discovery-no-skippables.
  2. Used mockdog scenarios with TIA/test skipping enabled and empty skippable-tests responses.
  3. Ran planner-only checks across Minitest, Rails/Minitest, and RSpec playgrounds.
  4. Verified cancellation logs, fast-discovery fallback, successful plan completion, runner file outputs, and absence of the full-discovery JSON file.
  5. Ran one live monitor while planning to confirm .testoptimization/tests-discovery/tests.json never appeared.

This E2E test was performed by Shepherd - autonomous QA agent for Datadog Test Optimization.

@anmarchenko anmarchenko merged commit cdffc15 into main Jun 5, 2026
4 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/abort-discovery-no-skippables branch June 5, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants