Skip to content

fix: source UT PDF list titles from locale files instead of hardcoded strings - #847

Merged
junaidiqbalmoj merged 4 commits into
masterfrom
fix/ut-pdf-generator-hardcoded-court-names
Jul 13, 2026
Merged

fix: source UT PDF list titles from locale files instead of hardcoded strings#847
junaidiqbalmoj merged 4 commits into
masterfrom
fix/ut-pdf-generator-hardcoded-court-names

Conversation

@junaidiqbalmoj

@junaidiqbalmoj junaidiqbalmoj commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • createUtDailyHearingListPdfGenerator previously accepted courtName and listTitle as hardcoded English strings, so Welsh PDFs always displayed English court/list names
  • Translations are now loaded first inside the factory; t.pageTitle (from the locale file) is passed as listTitle so the correct locale string renders in the PDF
  • The unused courtName parameter is removed from the factory signature and all three renderer RenderOptions interfaces

Affected packages

  • @hmcts/upper-tribunal-common (factory)
  • @hmcts/upper-tribunal-administrative-appeals-chamber-daily-hearing-list
  • @hmcts/upper-tribunal-lands-chamber-daily-hearing-list
  • @hmcts/upper-tribunal-tax-and-chancery-chamber-daily-hearing-list

Test plan

  • All existing unit tests updated and passing (37–39 tests per package, 8 in common)
  • Welsh locale: PDF listTitle now reads from cy.pageTitle e.g. "Rhestr Gwrandawiadau Dyddiol Tribiwnlys Uwch (Siambr Apeliadau Gweinyddol)"
  • English locale: PDF listTitle reads from en.pageTitle as before

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Enhancements

    • Daily hearing list PDFs now display the correct translated list title based on the selected language.
    • Welsh versions now show chamber-specific Welsh titles across Upper Tribunal hearing lists.
    • PDF generation now uses the relevant language content consistently, improving multilingual presentation.
  • Bug Fixes

    • Removed outdated hard-coded title information that could result in English titles appearing in Welsh PDFs.

… strings

The createUtDailyHearingListPdfGenerator factory previously accepted
courtName and listTitle as hardcoded English strings, meaning Welsh
PDFs would always display English court names. Translations are now
loaded first and t.pageTitle is passed as listTitle so the correct
locale string is used. The unused courtName parameter is removed
throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@junaidiqbalmoj, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1bdd1811-49b7-4607-9830-fa8d638724e8

📥 Commits

Reviewing files that changed from the base of the PR and between a94d375 and f4d049f.

📒 Files selected for processing (11)
  • .github/workflows/e2e.yml
  • .github/workflows/job.e2e-test.yml
  • apps/web/src/pages/(list-types)/upper-tribunal-administrative-appeals-chamber-daily-hearing-list/index.test.ts
  • apps/web/src/pages/(list-types)/upper-tribunal-administrative-appeals-chamber-daily-hearing-list/index.ts
  • apps/web/src/pages/(list-types)/upper-tribunal-lands-chamber-daily-hearing-list/index.test.ts
  • apps/web/src/pages/(list-types)/upper-tribunal-lands-chamber-daily-hearing-list/index.ts
  • apps/web/src/pages/(list-types)/upper-tribunal-tax-and-chancery-chamber-daily-hearing-list/index.test.ts
  • apps/web/src/pages/(list-types)/upper-tribunal-tax-and-chancery-chamber-daily-hearing-list/index.ts
  • libs/list-types/upper-tribunal-administrative-appeals-chamber-daily-hearing-list/src/rendering/renderer.test.ts
  • libs/list-types/upper-tribunal-lands-chamber-daily-hearing-list/src/rendering/renderer.test.ts
  • libs/list-types/upper-tribunal-tax-and-chancery-chamber-daily-hearing-list/src/rendering/renderer.test.ts
📝 Walkthrough

Walkthrough

The shared Upper Tribunal PDF generator now loads translations before rendering and supplies translations.pageTitle as listTitle. Hard-coded court-name and title parameters were removed from the generator API and chamber integrations, with renderer contracts and tests updated accordingly.

Changes

Upper Tribunal PDF title localisation

Layer / File(s) Summary
Generator translation flow
libs/list-types/upper-tribunal-common/src/pdf-generator.ts, libs/list-types/upper-tribunal-common/src/pdf-generator.test.ts
The generator removes courtName and listTitle parameters, loads translations before rendering, and passes the translated page title as listTitle.
Chamber generator and renderer contracts
libs/list-types/upper-tribunal-*/src/pdf/pdf-generator.ts, libs/list-types/upper-tribunal-*/src/rendering/renderer.ts
UTAAC, UTLC, and UTCC integrations use the revised factory signature, and their RenderOptions interfaces no longer include courtName.
Localised renderer expectations
libs/list-types/upper-tribunal-*/src/pdf/pdf-generator.test.ts
Chamber PDF tests expect Welsh translated titles when rendering with the Welsh locale, while retaining date and locale assertions.

Possibly related PRs

  • hmcts/cath-service#669: Both changes update Upper Tribunal daily hearing-list PDF generator plumbing and chamber renderer options.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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: sourcing UT PDF list titles from locale files instead of hardcoded strings.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ut-pdf-generator-hardcoded-court-names

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright E2E Test Results

84 tests   52 ✅  7m 55s ⏱️
33 suites  32 💤
 1 files     0 ❌

Results for commit f4d049f.

♻️ This comment has been updated with latest results.

junaidiqbalmoj and others added 3 commits July 10, 2026 16:48
…when no E2E results

When this PR has no E2E test changes, dorny/test-reporter errors because
junit-results.xml doesn't exist. fail-on-empty: false makes it a no-op
instead of a failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
courtName was removed from RenderOptions in all three UT renderer
interfaces; the web page controllers still passed it, causing TS2353
build errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…b controllers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment Successful 🚀

Your preview environment is ready:

The environment will be automatically cleaned up when this PR is closed.

@junaidiqbalmoj
junaidiqbalmoj merged commit a970e2a into master Jul 13, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant