Skip to content

Record elapsed time for synthetic test results - #423

Merged
bslobodin merged 1 commit into
mainfrom
fix/synthetic-test-duration
Aug 12, 2026
Merged

Record elapsed time for synthetic test results#423
bslobodin merged 1 commit into
mainfrom
fix/synthetic-test-duration

Conversation

@bslobodin

@bslobodin bslobodin commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • set missing LazySingleExample durations from its elapsed start and finish timestamps, including class resolution and file loading time
  • preserve durations measured by Minitest and emit synthetic durations as floating-point values
  • retain a 0.0 exporter fallback so any remaining timeless result cannot invalidate the batch

LazySingleExample synthesizes results for load errors and stale queue entries. Those results bypass Minitest's timing path, leaving time nil; Monorail requires test_duration to be a non-nullable double, so one such result can reject the exported batch.

Test plan

  • shadowenv exec -- bundle exec rake test TEST_FILES='test/minitest/queue/lazy_single_example_test.rb test/minitest/queue/test_data_test.rb'
  • 15 tests, 48 assertions, 0 failures
  • verified eight-second load-error and stale-skip durations, preservation of a normal 0.12 duration, and the 0.0 exporter fallback

@bslobodin bslobodin self-assigned this Aug 12, 2026
@bslobodin
bslobodin marked this pull request as ready for review August 12, 2026 12:10
@bslobodin
bslobodin force-pushed the fix/synthetic-test-duration branch from 975c5bb to 142e9ee Compare August 12, 2026 12:23
@bslobodin bslobodin changed the title Give synthetic test results a zero duration Record elapsed time for synthetic test results Aug 12, 2026
@bslobodin
bslobodin force-pushed the fix/synthetic-test-duration branch from 142e9ee to 362323e Compare August 12, 2026 12:24
@bslobodin
bslobodin marked this pull request as draft August 12, 2026 12:24
@bslobodin
bslobodin force-pushed the fix/synthetic-test-duration branch from 362323e to 394a435 Compare August 12, 2026 12:28
@bslobodin
bslobodin marked this pull request as ready for review August 12, 2026 12:28
A result built by LazySingleExample#build_error_result or
#build_stale_skip_result does not run through Minitest's normal timing path,
so its #time stays nil. TestData passes that straight through as
test_duration, which the shopify_build_test_results Monorail schema declares
as a non-nullable double.

The exporter therefore rejects the whole event
("at .test_duration expected type double, got null") and the test result is
dropped silently: the producing build only sees an HTTP 400 inside a 207 and
carries on. One unresolvable test class costs every affected shard's results,
so a single stale queue entry loses tens of rows at a time.

Populate missing result times from LazySingleExample's existing start and
finish timestamps. This records class resolution and file loading work while
preserving the duration Minitest assigns when the runnable executes.

Co-authored-by: Boris Slobodin <boris.slobodin@shopify.com>
Assisted-By: devx/d2514402-869f-427f-956d-3ae0f06cb475
@bslobodin
bslobodin force-pushed the fix/synthetic-test-duration branch from 394a435 to be59f49 Compare August 12, 2026 12:33
@bslobodin
bslobodin merged commit 9c5dff6 into main Aug 12, 2026
49 of 50 checks passed
@bslobodin
bslobodin deleted the fix/synthetic-test-duration branch August 12, 2026 14:14
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