Skip to content

Move bulk refund result messages into locale catalog - #1901

Merged
stefan-burke merged 1 commit into
mainfrom
split/refund-copy-i18n
Jul 23, 2026
Merged

Move bulk refund result messages into locale catalog#1901
stefan-burke merged 1 commit into
mainfrom
split/refund-copy-i18n

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 23, 2026

Copy link
Copy Markdown
Member

What changed

Bulk refund result messages used to be hard-coded English strings inside the route handler. They now live in the locale catalog as ICU plural messages, so every surface that shows them stays worded the same way and can be translated.

Why

A person running refunds sees a result like "2 refunds succeeded. There was 1 failure. Some payments may have already been refunded." on the admin page. That copy was built from inline string concatenation in the route, so it could not be translated and had no single source of truth. Moving it into the catalog means the wording is defined once and reused everywhere, the plural forms are correct for any count, and the copy-check and translation-coverage gates cover it like every other user-facing string.

What it does

  • Adds five ICU plural keys to the attendee locale catalog for refund succeeded, failures, errors, remaining, and the completed-with-problems note.
  • Replaces the inline string building in the refund route with catalog lookups using t(), assembled with compact() so the error clause only appears when there are errors.
  • Strengthens the route-level tests to assert the exact messages, including plural forms for one and many, the remaining-work branch, the completed-with-problems branch, and an I18N_REPLACEMENTS round-trip that proves the route reads from the catalog rather than hard-coding.
  • Updates one stale flash-message assertion in the accounting e2e test.
  • Removes the now-unused expectPartialRefund test helper.
  • Removes a dead default parameter from refundError().
  • Updates the equivalent-mutant line reference after the source file changed.

Verification

  • deno task precommit (typecheck, lint, cpd, check:copy, build:edge, test:coverage): green
  • Targeted mutation on src/features/admin/attendee-refunds.ts: 84 killed, 1 documented equivalent
  • Refund suite: 54/54 pass
  • i18n-coverage ratchet: 6/6 pass

Summary by CodeRabbit

  • Bug Fixes

    • Improved admin “refund all attendees” flash messages with consistent, localized success/failure/error counts, including remaining/refund-complete states and the “submit again” hint.
    • Refined single and partial refund messaging for more accurate pluralization and clearer feedback when no refundable payment is available.
  • New Features

    • Added new localized English i18n strings for bulk refund outcome reporting.
  • Tests

    • Strengthened e2e and feature tests to assert exact refund outcome copy and activity-log messaging where applicable.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0c66854e-2e31-4b18-85da-21c78b703646

📥 Commits

Reviewing files that changed from the base of the PR and between f70a1f9 and 4a3f194.

📒 Files selected for processing (7)
  • scripts/mutation/equivalent-mutants.txt
  • src/features/admin/attendee-refunds.ts
  • src/locales/en/attendees.json
  • test/e2e/accounting/bulk-merges-and-pwyw.test.ts
  • test/features/admin/attendee-refunds/bulk.test.ts
  • test/features/admin/attendee-refunds/single.test.ts
  • test/lib/server-refunds-helpers.ts
💤 Files with no reviewable changes (1)
  • test/lib/server-refunds-helpers.ts

📝 Walkthrough

Walkthrough

Bulk attendee-refund result messages now use translated segments for success, failure, error, remaining, and completion states. Locale entries and refund tests assert exact copy, no-payment handling, and activity-log behavior.

Changes

Attendee refund messaging

Layer / File(s) Summary
Translated refund result construction
src/features/admin/attendee-refunds.ts, src/locales/en/attendees.json, scripts/mutation/equivalent-mutants.txt
Bulk refund responses compose translated outcome segments, require the refund error URL, and update the equivalent-mutant location.
Bulk refund outcome validation
test/features/admin/attendee-refunds/bulk.test.ts, test/lib/server-refunds-helpers.ts, test/e2e/accounting/bulk-merges-and-pwyw.test.ts
Bulk refund tests assert exact messages across success, remaining, partial, and thrown-refund cases while removing the shared partial-refund assertion helper.
Single refund validation
test/features/admin/attendee-refunds/single.test.ts
Single-refund tests cover exact confirmation errors, attendees without payments, and activity-log output after successful refunds.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: bulk refund result messages were moved into the locale catalog.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch split/refund-copy-i18n
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch split/refund-copy-i18n

Comment @coderabbitai help to get the list of available commands.

@stefan-burke
stefan-burke force-pushed the split/refund-copy-i18n branch from f70a1f9 to 4a3f194 Compare July 23, 2026 18:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a3f194311

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +206 to +207
t("admin.attendees.refund_all_result_failures", {
count: problemCount,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Separate errored refunds from failed count

When any refund errors, problemCount already includes those errors, and the next clause appends errorCount as its own sentence. A batch with one declined refund and one thrown or ledger error now tells the operator “There were 2 failures. There was 1 error”, which reads like three problematic payments even though only two refunds failed. Use failedCount for the failures clause, or make the first clause say total problems, so the numbers shown to the person stay accurate.

AGENTS.md reference: AGENTS.md:L196-L198

Useful? React with 👍 / 👎.

@stefan-burke
stefan-burke added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 7a0874d Jul 23, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the split/refund-copy-i18n branch July 23, 2026 19:09
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.

1 participant