Skip to content

Conversation

@marksvc
Copy link
Collaborator

@marksvc marksvc commented Dec 11, 2025

The Max still includes all jobs. This is to assist with metrics
reporting.


This screenshot shows the Mean and Max display area on the Draft Jobs table.

image

This change is Reviewable

@marksvc marksvc added e2e Run e2e tests for this pull request testing not required labels Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.82%. Comparing base (7e567d4) to head (95bcef3).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3611   +/-   ##
=======================================
  Coverage   82.82%   82.82%           
=======================================
  Files         610      610           
  Lines       37398    37400    +2     
  Branches     6151     6151           
=======================================
+ Hits        30974    30976    +2     
+ Misses       5491     5478   -13     
- Partials      933      946   +13     

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

@marksvc marksvc marked this pull request as ready for review December 11, 2025 16:22
@RaymondLuong3 RaymondLuong3 self-assigned this Dec 11, 2025
Copy link
Collaborator

@RaymondLuong3 RaymondLuong3 left a comment

Choose a reason for hiding this comment

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

@RaymondLuong3 reviewed 13 of 13 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @marksvc)


src/SIL.XForge.Scripture/ClientApp/src/type-utils.ts line 140 at r1 (raw file):

export function isPopulatedString(value: unknown): value is Exclude<string, ''> {
  return typeof value === 'string' && value !== '';
}

I'm not sure what the purpose of moving this from utils is. Why is this a more appropriate place for this code?

Code quote:

export function isPopulatedString(value: unknown): value is Exclude<string, ''> {
  return typeof value === 'string' && value !== '';
}

src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/draft-jobs-export.service.ts line 138 at r1 (raw file):

    // Append max duration row
    const maxRow: SpreadsheetRow = {
      servalBuildId: 'Max any duration minutes',

nit: I like max all better

Code quote:

'Max any duration minutes',

@marksvc marksvc changed the title Draft jobs duration mean only includes successful jobs Draft jobs duration mean: only include successful jobs Dec 12, 2025
Copy link
Collaborator Author

@marksvc marksvc left a comment

Choose a reason for hiding this comment

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

Thank you. Here is an updated screenshot.

image.png

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @RaymondLuong3)


src/SIL.XForge.Scripture/ClientApp/src/type-utils.ts line 140 at r1 (raw file):
Right, good question. When I put isPopulatedString into xforge-common/utils.ts, I think it was not the right choice. The xforge-common/utils.ts file is mostly populated by browser-related or other higher level utilities. Whereas type-utils.ts is mostly populated by types and type guards that work with TypeScript language-level details.

isPopulatedString acts not only to check and guide program flow based on the content of a string, but it also provides a type guard to inform the type system as to what the shape of the value in question can be.[*]

So I think it is better placed with similar code in type-utils.ts.

[*] Then you can do things like:

  get draftGenerationRequestIdDisplay(): string {
    if (!isPopulatedString(this.data.draftGenerationRequestId)) return 'none';
    return this.data.draftGenerationRequestId;
  }

If the isPopulatedString just had a boolean return type, like

export function isPopulatedString(value: unknown): boolean {
  return typeof value === 'string' && value !== '';
}

, then the get draftGenerationRequestIdDisplay getter would have an error on the second return, saying

Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.

But with the type guard (value is Exclude<string, ''>), TypeScript is instructed that if isPopulatedString returns true, it should treat the value as not possibly being null, and so it does not have the error. [**]

[**] Exclude<string, ''>here is like "type string, except not the empty string".
(Also, in TypeScript, null and undefined have different types than a string. So if something is of type string, then it is not null or undefined.)


src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/draft-jobs-export.service.ts line 138 at r1 (raw file):

Previously, RaymondLuong3 (Raymond Luong) wrote…

nit: I like max all better

Done. I wrestled with how I might word these to be consistent, and whether they should contain "of", etc. I left Mean as it is and changed max to "Max all durations" and "Max all durations minutes". What do you think of this?

Copy link
Collaborator

@RaymondLuong3 RaymondLuong3 left a comment

Choose a reason for hiding this comment

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

@RaymondLuong3 reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @marksvc)


src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/draft-jobs-export.service.ts line 138 at r1 (raw file):

Previously, marksvc wrote…

Done. I wrestled with how I might word these to be consistent, and whether they should contain "of", etc. I left Mean as it is and changed max to "Max all durations" and "Max all durations minutes". What do you think of this?

That works!

The Max still includes all jobs. This is to assist with metrics
reporting.
@RaymondLuong3 RaymondLuong3 merged commit 47ee299 into master Dec 15, 2025
23 checks passed
@RaymondLuong3 RaymondLuong3 deleted the task/mean branch December 15, 2025 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run e2e tests for this pull request testing not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants