Repository navigation
fix(shared): use slice(-2) for UEN T-series 2-digit year so future years reject - #10026
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Add a regression test covering a valid-checksum future T-series value.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes future-year validation for T-series UENs by correctly extracting the final two year digits.
Changes:
- Replaces
substring(-2)withslice(-2).
File summaries
| File | Summary |
|---|---|
packages/shared/utils/uen-validation.ts |
Corrects T-series future-year validation. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| const currentYear = parseInt( | ||
| new Date().getFullYear().toString().substring(-2), | ||
| new Date().getFullYear().toString().slice(-2), |
|
Warning Endor Labs detected 1 policy violations associated with this pull request. Please review the findings that caused the policy violations.
|
| }) | ||
|
|
||
| it('should reject a future T-series year with a valid checksum', () => { | ||
| // T99SS0032K has a valid checksum (via calcOtherCheckDigit) but year 99 |
There was a problem hiding this comment.
hey @soroush5, thanks for the contribution.
LGTM 👍 , but shall we update to remove the context about the previous substring(-2) as might not be useful in the long run?
There was a problem hiding this comment.
Done, trimmed it down to just what the test checks.
|
Hi, gentle nudge on the UEN year fix. Can add more T-series cases if useful. |
|
LGTM 👍 |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
#10026 left the currentYear parseInt call split across lines, which fails the prettier/prettier lint rule in CI. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
Thanks for the review and the merge. |
substring(-2) returns the whole year string, so the future-year guard never fired. One-line fix to slice(-2). Verified: fake T99 rejected after, valid T09 still passes.
Fixes #10025