Skip to content

SF-3736 Add Serval builds tab#3719

Open
marksvc wants to merge 1 commit intomasterfrom
task/serval-builds
Open

SF-3736 Add Serval builds tab#3719
marksvc wants to merge 1 commit intomasterfrom
task/serval-builds

Conversation

@marksvc
Copy link
Collaborator

@marksvc marksvc commented Mar 2, 2026

Currently, the Serval Administration area has a Draft Jobs tab which shows a list of Serval builds. It does this by fetching and correlating EventMetric records on the frontend. More information for a build is then obtained by looking up Serval build information, user information, etc.

This PR is a step toward replacing the functionality of the Draft Jobs tab. This PR adds a Serval Builds tab which shows a list of Serval builds. It does this by fetching Serval build data on the backend, and augmenting the data on the backend with details from EventMetric records and project and user metadata. The information is received by the frontend to render to the user.

The Serval Builds tab is designed to be a suitable replacement for the Draft Jobs tab. However, the Draft Jobs tab is still present so the Serval Builds tab can get some vetting first.

image

This change is Reviewable


Open with Devin

@marksvc marksvc self-assigned this Mar 2, 2026
@marksvc marksvc marked this pull request as ready for review March 2, 2026 18:34
Comment on lines +1033 to +1047
foreach (TranslationBuild translationBuild in translationBuilds)
{
ServalBuildReportDto report = await BuildReportAsync(
translationBuild,
engineToProject,
eventsByProject,
projectSnapshots,
cancellationToken
);
if (report.DraftGenerationRequestId != null)
{
matchedRequestIds.Add(report.DraftGenerationRequestId);
}
reports.Add(report);
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Select Note

This foreach loop immediately
maps its iteration variable to another variable
- consider mapping the sequence explicitly using '.Select(...)'.

Copilot Autofix

AI about 3 hours ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional findings.

Open in Devin Review

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 69.37500% with 294 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.04%. Comparing base (bdd850d) to head (c35df22).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...p/serval-administration/serval-builds.component.ts 41.33% 145 Missing and 4 partials ⚠️
...SIL.XForge.Scripture/Services/MachineApiService.cs 82.89% 53 Missing and 19 partials ⚠️
...orge.Scripture/Controllers/MachineApiController.cs 0.00% 22 Missing ⚠️
.../app/serval-administration/draft-jobs.component.ts 10.52% 17 Missing ⚠️
.../serval-administration/serval-builds-statistics.ts 90.65% 3 Missing and 7 partials ⚠️
...c/app/serval-administration/serval-build-report.ts 82.05% 7 Missing ⚠️
...slate/draft-generation/draft-generation.service.ts 46.15% 7 Missing ⚠️
...serval-administration/draft-jobs-export.service.ts 60.00% 4 Missing ⚠️
...ure/Services/MachineServiceCollectionExtensions.cs 42.85% 4 Missing ⚠️
...p/src/app/machine-api/remote-translation-engine.ts 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3719      +/-   ##
==========================================
- Coverage   81.32%   81.04%   -0.29%     
==========================================
  Files         620      626       +6     
  Lines       39023    39947     +924     
  Branches     6360     6521     +161     
==========================================
+ Hits        31735    32374     +639     
- Misses       6305     6558     +253     
- Partials      983     1015      +32     

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

@Nateowami
Copy link
Collaborator

So is this a newer version of the draft jobs tab?

@marksvc marksvc force-pushed the task/serval-builds branch from cdb4aca to 7967398 Compare March 2, 2026 23:50
@marksvc
Copy link
Collaborator Author

marksvc commented Mar 2, 2026

So is this a newer version of the draft jobs tab?

Yes, though I will want its tires kicked and to hear feedback first.

I also haven't yet wired up the Projects tab to link over to the Serval Builds tab.

@marksvc marksvc force-pushed the task/serval-builds branch from 7967398 to 63a0b70 Compare March 2, 2026 23:56
@marksvc marksvc added the e2e Run e2e tests for this pull request label Mar 2, 2026
@marksvc marksvc marked this pull request as draft March 2, 2026 23:58
devin-ai-integration[bot]

This comment was marked as resolved.

@marksvc marksvc force-pushed the task/serval-builds branch from 63a0b70 to 58caefa Compare March 3, 2026 21:37
@marksvc marksvc marked this pull request as ready for review March 3, 2026 22:55
@marksvc marksvc removed their assignment Mar 3, 2026
@marksvc marksvc force-pushed the task/serval-builds branch from 58caefa to 57307d2 Compare March 3, 2026 23:09
@marksvc marksvc removed the e2e Run e2e tests for this pull request label Mar 3, 2026
@marksvc marksvc force-pushed the task/serval-builds branch 3 times, most recently from ecc5abc to 256d266 Compare March 3, 2026 23:58
devin-ai-integration[bot]

This comment was marked as resolved.

@marksvc marksvc changed the title Add Serval builds tab SF-3736 Add Serval builds tab Mar 4, 2026
@marksvc marksvc added the will require testing PR should not be merged until testers confirm testing is complete label Mar 4, 2026
@marksvc marksvc force-pushed the task/serval-builds branch from 256d266 to 17f9c7f Compare March 4, 2026 23:27
@marksvc marksvc force-pushed the task/serval-builds branch from 17f9c7f to c35df22 Compare March 4, 2026 23:28
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 15 additional findings in Devin Review.

Open in Devin Review

Comment on lines +1190 to +1202
Dictionary<string, List<EventMetric>> unmatchedEventsByProject = eventsByProject
.ToDictionary(
kvp => kvp.Key,
kvp =>
kvp.Value.Where(e =>
{
string? requestId = GetRequestIdFromEvent(e);
return requestId == null || !matchedRequestIds.Contains(requestId);
})
.ToList()
)
.Where(kvp => kvp.Value.Count > 0)
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

Choose a reason for hiding this comment

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

🟡 Events with null request IDs can produce duplicate reports for builds already matched by Serval

In GetBuildsSinceAsync at MachineApiService.cs:1190-1202, the unmatchedEventsByProject filtering uses the condition requestId == null || !matchedRequestIds.Contains(requestId). Events where GetRequestIdFromEvent returns null always pass the filter, even if they were already correlated to a Serval build by FindEventTime (which matches on e.Result?.ToString() == servalBuildId). This means a StartPreTranslationBuildAsync event that was already used to populate sfUserRequested in a Serval-build-based report will also generate a separate events-only report via BuildEventsOnlyReports at line 1664-1690.

This primarily affects older data (pre-2026) that lacks draft generation request ID tags. The result is duplicate entries in the builds list for the same underlying draft generation request.

Prompt for agents
In MachineApiService.cs GetBuildsSinceAsync method, around line 1168-1184, in addition to tracking matchedRequestIds, also track the set of event metric IDs (or timestamps+eventTypes) that were successfully correlated to Serval builds during BuildReportAsync/BuildTimeline processing. Then in the unmatchedEventsByProject filtering at line 1190-1202, exclude events that were already used to build timeline data for a Serval build report, even if they have a null request ID. One approach is to collect all event IDs that were matched during FindEventTime calls and filter them out when building unmatchedEventsByProject.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

will require testing PR should not be merged until testers confirm testing is complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants