Skip to content

fix(validate): pluralize the text summary line - #664

Merged
tampakrap merged 1 commit into
crossplane:mainfrom
tampakrap:theo/fix_validate_summary_plural
Dec 4, 2026
Merged

tampakrap merged 1 commit into
crossplane:mainfrom
tampakrap:theo/fix_validate_summary_plural

Conversation

@tampakrap

@tampakrap tampakrap commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description of your changes

The summary line printed by crossplane validate used fixed plural nouns, so a single resource read "Total 1 resources: 0 missing schemas, 1 success cases, 0 failure cases".

Build the line with plural.Format, so each count uses the singular noun when it is 1: "Total 1 resource: 0 missing schemas, 1 success case, 0 failure cases". Add a table test for the singular, plural and zero cases and update the two integration test assertions.

I have:

  • Read and followed Crossplane's contribution process.
  • Read and followed Crossplane's AI policy and confirmed a human stands behind this PR.
  • Run ./nix.sh flake check to ensure this PR is ready for review.
  • Added or updated unit tests.
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

@tampakrap
tampakrap requested review from a team and jcogilvie as code owners December 4, 2026 21:23
@tampakrap
tampakrap requested review from negz and a balanced review from Copilot and removed request for a team December 4, 2026 21:23

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the validation summary noun-formatting change.

No open issues 🎉

What changed in this PR

Corrects singular and plural nouns in the crossplane validate text summary using the existing plural.Format helper.

Changes:

  • Formats each summary count with the appropriate noun.
  • Adds singular, plural, and zero-count unit tests.
  • Updates integration assertions for singular output.
File Description
pkg/​validate/​output/​render.go Extracts summary formatting into a plural-aware helper.
pkg/​validate/​output/​render_test.go Tests noun forms and updates renderer expectations.
cmd/​crossplane/​validate/​validate_integration_test.go Updates expected singular summary text.

Review effort: Balanced

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.71%. Comparing base (2c81981) to head (1689c42).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tampakrap
tampakrap force-pushed the theo/fix_validate_summary_plural branch from 1f573aa to 8b5094b Compare December 4, 2026 22:27
Copilot AI balanced review requested due to automatic review settings December 4, 2026 22:27

Copilot AI 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.

🟡 Changes recommended

The output package’s tests no longer compile because TestRendererFor_TextWithSource still passes a ValidationResult to summaryLine, which now requires a ValidationSummary.

1 open issue

Review effort: Balanced

Comment thread pkg/validate/output/render_test.go Resolved
The summary line printed by `crossplane validate` used fixed plural
nouns, so a single resource read "Total 1 resources: 0 missing schemas,
1 success cases, 0 failure cases".

Build the line with plural.Format, so each count uses the singular noun
when it is 1: "Total 1 resource: 0 missing schemas, 1 success case,
0 failure cases". Add a table test for the singular, plural and zero
cases and update the two integration test assertions.

Signed-off-by: Theo Chatzimichos <tampakrap@gmail.com>
@tampakrap
tampakrap force-pushed the theo/fix_validate_summary_plural branch from 8b5094b to 1689c42 Compare December 4, 2026 22:38
Copilot AI balanced review requested due to automatic review settings December 4, 2026 22:38

Copilot AI 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.

🟢 Approval recommended

The summary pluralization change has no active review issues.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@tampakrap
tampakrap merged commit 2ce244f into crossplane:main Dec 4, 2026
12 checks passed
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