Skip to content

feat(#792): register Mental Health Tribunal Daily Hearing List - #866

Closed
junaidiqbalmoj wants to merge 3 commits into
masterfrom
feature/792-mental-health-tribunal-hearing-list
Closed

feat(#792): register Mental Health Tribunal Daily Hearing List#866
junaidiqbalmoj wants to merge 3 commits into
masterfrom
feature/792-mental-health-tribunal-hearing-list

Conversation

@junaidiqbalmoj

@junaidiqbalmoj junaidiqbalmoj commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Registers MENTAL_HEALTH_TRIBUNAL_HEARING_LIST as a flat-file, strategic, manually-uploaded list type, linked to the Mental Health Tribunal sub-jurisdiction (parent jurisdiction Tribunal), with Public default sensitivity.

Resolves #792.

Changes

  • libs/list-types/common/src/list-type-data.ts — catalogue entry (provenance: CFT_IDAM, isNonStrategic: false, defaultSensitivity: "Public", shortenedFriendlyName = full name, subJurisdictionIds: [20], English + Welsh friendly names).
  • libs/list-types/common/src/list-type-data.test.ts — new AAA unit test asserting the entry's fields and listTypeData[].name uniqueness.
  • apps/postgres/prisma/scripts/001_insert_missing_list_types.sql — prod seed insert row (empty url, Public, CFT_IDAM, false).
  • apps/postgres/prisma/scripts/003_upsert_sub_jurisdictions_and_list_type_links.sql — sub-jurisdiction link row (name → 20, id-independent join).

Notes

  • Flat-file list type — no JSON schema, validator, converter, PDF generator, or list page. The manual upload form auto-populates from findStrategicListTypes(), so no controller change is needed.
  • Follows CLAUDE.md: sub-jurisdiction linked by stable name, never a numeric listTypeId.
  • "National region" is a location-level attribute (not a list-type field), so no list-type change is required for region.

Acceptance Criteria

  • List created and linked to Tribunal jurisdiction; shows as "Mental Health Tribunal Daily Hearing List" in the manual upload form
  • List is strategic (isNonStrategic = false)
  • Default sensitivity is Public
  • Flat file — no JSON schema validation, no style guide

Testing

  • list-type-data.test.ts — 9 tests passing
  • yarn biome check — clean
  • Runtime verification of the manual upload dropdown requires a seeded DB / running app (not possible headless).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for the Mental Health Tribunal daily hearing list as a public, flat-file list.
    • Linked the list to the Mental Health Tribunal.
    • Added a conditional “held in private” notice on publication summary pages (English and Welsh).
  • Bug Fixes

    • Improved consistency of list catalogue entries and their jurisdiction links when data is reprocessed.
  • Tests

    • Added automated coverage for the new list configuration, catalogue integrity, and notice visibility (including EN/Welsh cases).

Register MENTAL_HEALTH_TRIBUNAL_HEARING_LIST as a flat-file, strategic,
manually-uploaded list type linked to the Mental Health Tribunal
sub-jurisdiction (Tribunal jurisdiction), with Public default sensitivity.

- Add catalogue entry to list-type-data.ts (CFT_IDAM, isNonStrategic: false,
  defaultSensitivity: Public, subJurisdictionIds: [20]) plus unit test
- Add prod seed row (001) and sub-jurisdiction link by stable name (003)

Flat-file list type: no JSON schema, validator, converter, PDF generator,
or list page. Manual upload form auto-populates from findStrategicListTypes().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 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: CHILL

Plan: Pro

Run ID: 3fe0e65c-fd93-4a54-a779-a598fc5bf344

📥 Commits

Reviewing files that changed from the base of the PR and between e59057b and c31b045.

📒 Files selected for processing (3)
  • apps/postgres/prisma/scripts/001_insert_missing_list_types.sql
  • libs/list-types/common/src/list-type-data.test.ts
  • libs/list-types/common/src/list-type-data.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • libs/list-types/common/src/list-type-data.test.ts
  • libs/list-types/common/src/list-type-data.ts
  • apps/postgres/prisma/scripts/001_insert_missing_list_types.sql

📝 Walkthrough

Walkthrough

The PR registers MENTAL_HEALTH_TRIBUNAL_HEARING_LIST as a strategic, public, flat-file list type, seeds it in PostgreSQL, links it to the Mental Health Tribunal sub-jurisdiction, adds catalogue tests, and documents the ticket implementation and review status.

Changes

Mental Health Tribunal hearing list

Layer / File(s) Summary
Catalogue and database registration
libs/list-types/common/src/list-type-data.ts, libs/list-types/common/src/list-type-data.test.ts, apps/postgres/prisma/scripts/*.sql
Adds the list type metadata, validates its fields and catalogue-name uniqueness, seeds the database entry, and links it to sub-jurisdiction 20.
Ticket implementation definition
docs/tickets/792/ticket.md, docs/tickets/792/plan.md, docs/tickets/792/tasks.md
Defines the flat-file list configuration, acceptance criteria, proposed summary-page notice, implementation tasks, and edge-case expectations.
Implementation review record
docs/tickets/792/review.md
Records review findings, coverage assessment, acceptance-criteria status, and outstanding runtime and translation verification.

Possibly related issues

Possibly related PRs

  • hmcts/cath-service#761 — Connects through shortenedFriendlyName-driven upload display-name handling.
  • hmcts/cath-service#862 — Updates the shared list-type catalogue and tests for another flat-file list type.
  • hmcts/cath-service#863 — Updates the same catalogue and PostgreSQL seed/link scripts for another sub-jurisdiction-linked flat-file list type.
🚥 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 states the main change: registering the Mental Health Tribunal Daily Hearing List for #792.
Linked Issues check ✅ Passed The changes add the new list type, seed and link it to the Mental Health Tribunal sub-jurisdiction, and set the expected Public/non-strategic metadata.
Out of Scope Changes check ✅ Passed The added ticket documentation stays aligned with the same issue, and no unrelated code changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/792-mental-health-tribunal-hearing-list

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
libs/list-types/common/src/list-type-data.test.ts (1)

5-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reduce test boilerplate.

Consider extracting the repeated list type lookup into a beforeEach hook to make the tests more concise and DRY.

♻️ Proposed refactor
   describe("MENTAL_HEALTH_TRIBUNAL_HEARING_LIST entry", () => {
+    let entry: typeof listTypeData[0] | undefined;
+
+    beforeEach(() => {
+      entry = listTypeData.find((lt) => lt.name === "MENTAL_HEALTH_TRIBUNAL_HEARING_LIST");
+    });
+
     it("should include a Mental Health Tribunal Daily Hearing List entry", () => {
-      // Arrange
-      // Act
-      const entry = listTypeData.find((lt) => lt.name === "MENTAL_HEALTH_TRIBUNAL_HEARING_LIST");
-
       // Assert
       expect(entry).toBeDefined();
     });
 
     it("should be a strategic list type", () => {
-      // Arrange
-      const entry = listTypeData.find((lt) => lt.name === "MENTAL_HEALTH_TRIBUNAL_HEARING_LIST");
-
       // Act
       const isNonStrategic = entry?.isNonStrategic;

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0864dfdd-0e5a-4b23-bc7c-32e4c6836047

📥 Commits

Reviewing files that changed from the base of the PR and between ed63e44 and e59057b.

📒 Files selected for processing (8)
  • apps/postgres/prisma/scripts/001_insert_missing_list_types.sql
  • apps/postgres/prisma/scripts/003_upsert_sub_jurisdictions_and_list_type_links.sql
  • docs/tickets/792/plan.md
  • docs/tickets/792/review.md
  • docs/tickets/792/tasks.md
  • docs/tickets/792/ticket.md
  • libs/list-types/common/src/list-type-data.test.ts
  • libs/list-types/common/src/list-type-data.ts

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright E2E Test Results

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

Results for commit c31b045.

♻️ This comment has been updated with latest results.

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

('CROWN_FIRM_LIST', 'Crown Firm List', 'Crown Firm List', 'Crown Firm List', 'crown-firm-list', 'Classified', 'CRIME_IDAM', false, NOW()),
('CIVIL_AND_FAMILY_DAILY_CAUSE_LIST', 'Civil and Family Daily Cause List', 'Rhestr Achos Dyddiol Sifil a Theulu', 'Civil and Family Daily Cause List', 'civil-and-family-daily-cause-list', 'Public', 'CFT_IDAM', false, NOW()),
('CARE_STANDARDS_TRIBUNAL_WEEKLY_HEARING_LIST', 'Care Standards Tribunal Weekly Hearing List', 'Rhestr Gwrandawiadau Wythnosol y Tribiwnlys Safonau Gofal', 'Care Standards Tribunal Weekly Hearing List', 'care-standards-tribunal-weekly-hearing-list', 'Public', 'CFT_IDAM', true, NOW()),
('MENTAL_HEALTH_TRIBUNAL_HEARING_LIST', 'Mental Health Tribunal Daily Hearing List', 'Rhestr Wrandawiadau Dyddiol y Tribiwnlys Iechyd Meddwl', 'Mental Health Tribunal Daily Hearing List', '', 'Public', 'CFT_IDAM', false, NOW()),

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.

On OG CaTH this is currently configured to have a provenance of PI_AAD

@junaidiqbalmoj junaidiqbalmoj Jul 21, 2026

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.

As discussed, remove this script file.

@@ -0,0 +1,107 @@
import { describe, expect, it } from "vitest";

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.

Not sure of testing the static values in the list type array. Do we need to test that?

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.

as discussed, remove this file.

name: "MENTAL_HEALTH_TRIBUNAL_HEARING_LIST",
englishFriendlyName: "Mental Health Tribunal Daily Hearing List",
welshFriendlyName: "Rhestr Wrandawiadau Dyddiol y Tribiwnlys Iechyd Meddwl",
provenance: "CFT_IDAM",

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.

provenance on this list type is PI_AAD on OG CaTH

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.

fixed.

junaidiqbalmoj and others added 2 commits July 21, 2026 13:09
…o PI_AAD

Change default/allowed provenance from CFT_IDAM to PI_AAD in the list type
reference data and the insert-missing-list-types SQL script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

Style Guide: Mental Health Tribunal Daily Hearing List

2 participants