Skip to content

feat: add scope discriminator to Validator#108

Merged
jan-kubica merged 1 commit into
mainfrom
worktree-compiled-twirling-pike
Jun 4, 2026
Merged

feat: add scope discriminator to Validator#108
jan-kubica merged 1 commit into
mainfrom
worktree-compiled-twirling-pike

Conversation

@jan-kubica
Copy link
Copy Markdown
Contributor

@jan-kubica jan-kubica commented Jun 3, 2026

Summary

  • Replace country?: CountryCode on Validator with a scope discriminator.
  • Mark cross-border validators as scope: "global" and country validators as scope: "country".
  • Keep concrete validator exports typed as CountryValidator<"XX"> or GlobalValidator, and narrow country pattern helpers.
  • Export scope-related validator types from the package root.

Breaking Change

Validator is now a discriminated union, so validator.country is available after narrowing with validator.scope === "country". Published as 2.0.0 with a changelog entry.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread package.json Outdated
Comment thread CHANGELOG.md Outdated
@jan-kubica jan-kubica marked this pull request as ready for review June 3, 2026 21:46
Copy link
Copy Markdown

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

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: 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".

Comment thread package.json Outdated
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.
@jan-kubica jan-kubica force-pushed the worktree-compiled-twirling-pike branch from addfcd9 to 68171c5 Compare June 4, 2026 07:00
@jan-kubica jan-kubica merged commit ae94dc6 into main Jun 4, 2026
7 checks passed
@jan-kubica jan-kubica deleted the worktree-compiled-twirling-pike branch June 4, 2026 07:04
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant