Skip to content

Update GetNextFinishedBuild endpoint to query based on build id#952

Merged
Enkidu93 merged 2 commits into
mainfrom
fix_datetime_milliseconds
May 28, 2026
Merged

Update GetNextFinishedBuild endpoint to query based on build id#952
Enkidu93 merged 2 commits into
mainfrom
fix_datetime_milliseconds

Conversation

@pmachapman
Copy link
Copy Markdown
Collaborator

@pmachapman pmachapman commented May 27, 2026

This PR fixes a bug I noticed where the date time values passed to the GetAllBuildsCreatedAfterAsync endpoint were missing millisecond values, and so the same build was being returned each time.

I also updated the method documentation to remove the outdated only in UTC requirement.


This change is Reviewable

@pmachapman pmachapman requested review from Enkidu93 and ddaspit May 27, 2026 02:37
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 27, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.65%. Comparing base (20bbbec) to head (24f89e3).

Files with missing lines Patch % Lines
.../DataAccess/src/SIL.DataAccess/MemoryRepository.cs 88.88% 0 Missing and 2 partials ⚠️
...c/DataAccess/src/SIL.DataAccess/MongoRepository.cs 93.33% 0 Missing and 1 partial ⚠️
...ranslation/Features/Builds/GetNextFinishedBuild.cs 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #952      +/-   ##
==========================================
+ Coverage   65.61%   65.65%   +0.04%     
==========================================
  Files         381      381              
  Lines       21703    21758      +55     
  Branches     2770     2779       +9     
==========================================
+ Hits        14241    14286      +45     
- Misses       6425     6427       +2     
- Partials     1037     1045       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

:lgtm:

@Enkidu93 reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ddaspit).

Copy link
Copy Markdown
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

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

What happens if two builds are created at the same time down to the millisecond?

@ddaspit reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).

Copy link
Copy Markdown
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

What happens if two builds are created at the same time down to the millisecond?

@ddaspit Only one would return. As it is the completion timestamp we look at, this should not occur due to the post processing job not running in parallel.

If you think this is an issue, probably the best way would be to supply an id of the last build the client received, and use >= instead. I can do this if you like?

@pmachapman made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).

@pmachapman pmachapman force-pushed the fix_datetime_milliseconds branch from 33ab8cf to 01ba6c8 Compare May 28, 2026 02:07
Copy link
Copy Markdown
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

What happens if two builds are created at the same time down to the millisecond?

Based on our discussions this morning, I have added support for specifying the ID of the last completed build. I think the original PR change is still necessary for the other endpoint that uses DateTime.

To implement this change, I needed to add sorting support to the subscriptions. I thought I would make it a little bit more flexible by adding Ascending/Descending support (even though I only need ascending for this PR).

@pmachapman made 1 comment.
Reviewable status: 2 of 15 files reviewed, all discussions resolved (waiting on ddaspit and Enkidu93).

@pmachapman pmachapman changed the title Configure nswag to specify milliseconds when serializing DateTime Update GetNextFinishedBuild endpoint to query based on build id May 28, 2026
@pmachapman pmachapman requested review from Enkidu93 and ddaspit May 28, 2026 03:03
Copy link
Copy Markdown
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

@Enkidu93 reviewed 13 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ddaspit and pmachapman).


src/Serval/src/Serval.Translation/Features/Builds/GetNextFinishedBuild.cs line 26 at r2 (raw file):

        {
            Build? build = await builds.GetAsync(id, cancellationToken);
            if (build is not null)

Just a little thing: This confused me for a moment since you end up setting it to DateTime.UtcNow again if the date is null. I wonder if

if (build is not null && build.DateFinished is not null)
     dateFinished = build.DateFinished;

would be a little clearer?

Copy link
Copy Markdown
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

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

:lgtm:

@ddaspit reviewed 13 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on pmachapman).

 - Add sort support to subscriptions
 - Add index to date finished field
 - Improve build id declarations in unit tests
@Enkidu93 Enkidu93 force-pushed the fix_datetime_milliseconds branch from 01ba6c8 to 24f89e3 Compare May 28, 2026 16:41
@Enkidu93 Enkidu93 merged commit 5ed01bb into main May 28, 2026
1 of 2 checks passed
@Enkidu93 Enkidu93 deleted the fix_datetime_milliseconds branch May 28, 2026 17: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.

4 participants