feat: add scope discriminator to Validator#108
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Validator type by replacing the optional country field with a discriminated union ValidatorScope (supporting either a global scope or a country scope with a required country code). This breaking change requires all existing validators to be updated with their respective scopes and the byCountry utility to filter accordingly. The reviewer feedback highlights that because this is a breaking change, the package version in package.json and CHANGELOG.md should be bumped to 2.0.0 instead of 1.1.0 to properly adhere to Semantic Versioning.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: addfcd9bce
ℹ️ 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".
Replace `country?: CountryCode` with a discriminated scope union so consumers can narrow country-scoped and global identifiers explicitly. Apply `scope: "global"` to cross-border validators and `scope: "country"` to country validators. Keep concrete validator exports branch-typed with `CountryValidator<"XX">` or `GlobalValidator`, and narrow country pattern helpers accordingly. Bump the package to 2.0.0 and update the changelog.
addfcd9 to
68171c5
Compare
Summary
country?: CountryCodeonValidatorwith ascopediscriminator.scope: "global"and country validators asscope: "country".CountryValidator<"XX">orGlobalValidator, and narrow country pattern helpers.Breaking Change
Validatoris now a discriminated union, sovalidator.countryis available after narrowing withvalidator.scope === "country". Published as2.0.0with a changelog entry.