Skip to content

Use singular/plural form on GitOps log messages as appropriate - #33675

Merged
iansltx merged 2 commits into
mainfrom
33199-gitops-pluralization
Oct 1, 2025
Merged

Use singular/plural form on GitOps log messages as appropriate#33675
iansltx merged 2 commits into
mainfrom
33199-gitops-pluralization

Conversation

@iansltx

@iansltx iansltx commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

Also replaces existing pluralization function so everything in GitOps is using the same thing

Note that this doesn't add counts to log messages where they aren't currently, nor does it change logic on what count we actually show.

Fixes #33199.

Related issue: Resolves #

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests

  • QA'd all new/changed functionality manually

Also replaces existing pluralization function so everything in GitOps is using the same thing

Note that this doesn't add counts to log messages where they aren't currently, nor does it change logic on what count we actually show.

Fixes #33199.
Comment thread server/service/client.go
Comment on lines +510 to +513
if n == 1 {
return fmt.Sprintf("%d %s", n, singular)
}
return fmt.Sprintf("%d %s", n, plural)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
if n == 1 {
return fmt.Sprintf("%d %s", n, singular)
}
return fmt.Sprintf("%d %s", n, plural)
return fmt.Sprintf("%s %s", n, n == 1 ? singular : plural)

lol jk golang doesn't believe in ternaries

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nor does it believe in optional arguments, which would let you leave off the third arg in most cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ikr

@sgress454 sgress454 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Didn't actually test each of these cases but I ran my pencil down the page and they all look right + it's low risk and there's some tests. Thanks for the nice standardization!

Comment thread server/service/client.go
Comment on lines +510 to +513
if n == 1 {
return fmt.Sprintf("%d %s", n, singular)
}
return fmt.Sprintf("%d %s", n, plural)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nor does it believe in optional arguments, which would let you leave off the third arg in most cases.

@iansltx

iansltx commented Sep 30, 2025

Copy link
Copy Markdown
Contributor Author

@sgress454 thx for the review! I need to run through the entire test plan (which I just finished writing) before merging this; fingers crossed I don't find anything in the process. Otherwise I'll make sure any fix commits are up prior to tmw AM.

@sgress454

Copy link
Copy Markdown
Contributor

@sgress454 thx for the review! I need to run through the entire test plan (which I just finished writing) before merging this; fingers crossed I don't find anything in the process. Otherwise I'll make sure any fix commits are up prior to tmw AM.

generate-gitops might be your friend here, you could do a bunch of stuff in the UI and then export it. Then save those files for QA to re-use 😇

@iansltx
iansltx merged commit e235fda into main Oct 1, 2025
38 checks passed
@iansltx
iansltx deleted the 33199-gitops-pluralization branch October 1, 2025 14:32
@codecov

codecov Bot commented Oct 1, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.02%. Comparing base (d8093f7) to head (eb806c9).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #33675      +/-   ##
==========================================
- Coverage   64.02%   64.02%   -0.01%     
==========================================
  Files        2067     2067              
  Lines      207065   207037      -28     
  Branches     6854     6854              
==========================================
- Hits       132574   132547      -27     
+ Misses      64065    64064       -1     
  Partials    10426    10426              

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

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.

GitOps runs pluralize single targets

2 participants