Skip to content

Conversation

@Siyasanga
Copy link
Contributor

@Siyasanga Siyasanga commented Oct 23, 2025

Addresses: #10760

Description

There's a requirement to allow countries(Somalia) to show the registration number on the summary screen. Since it's a metadata fields we need to add the registrationNumber config in the list of hardcoded options for summary screen.

@Siyasanga Siyasanga self-assigned this Oct 23, 2025
@ocrvs-bot
Copy link
Contributor

Your environment is deployed to https://ocrvs-10760.e2e-k8s.opencrvs.dev

@Siyasanga Siyasanga marked this pull request as ready for review October 31, 2025 08:04
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Important Files Changed

File Analysis

Filename Score Overview
CHANGELOG.md 5/5 Added changelog entry documenting the new registration number field in advanced search configuration
packages/commons/src/events/AdvancedSearchConfig.ts 5/5 Added legalStatuses.REGISTERED.registrationNumber to both EventFieldIdInput and EventFieldId enums, enabling registration number searches
packages/client/src/v2-events/features/events/Search/utils.ts 5/5 Added default field generator configuration for registration number field with proper label and text input type

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Siyasanga Siyasanga force-pushed the ocrvs-10760 branch 3 times, most recently from cd3cfa4 to 94e4ac0 Compare December 9, 2025 10:38
…ditionals

The .extend(z.object({...}).shape) pattern was preventing proper field overrides.
Specifically, ReadActionConfig's conditionals: z.never() override wasn't working,
causing validation errors when READ actions inherited the array conditionals from ActionConfigBase.

This fixes Zod validation errors:
- 'expected never, received array' for READ action conditionals
- Proper discriminated union validation for all action types
The .extend() method in Zod merges fields rather than replacing them.
When ActionConfigBase has conditionals defined, extending with conditionals: z.never()
creates a conflict. Using .omit({conditionals: true}) first removes the field completely,
then .extend() adds only the fields we want without the conditionals field.

This ensures READ actions truly cannot have conditionals, fixing the validation error:
'expected never, received array' at path actions[0].conditionals
Use 'in' operator to properly narrow ActionConfig type before accessing
conditionals property. Some action types (like READ) don't have conditionals,
so we need a type guard to satisfy TypeScript's stricter checking.
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