fix: relax NATIONAL_ID regex to accept short codes like DCC#2167
fix: relax NATIONAL_ID regex to accept short codes like DCC#2167
Conversation
The national ID regex required 5-20 characters, rejecting legitimate short codes like DCC (3 chars), GETW (4 chars), and SEPD (4 chars) used in the PAYG energy manifest. This caused the nightly Demo Reset workflow to fail on every run since the PAYG tenant was added. Lowered the minimum from 5 to 2 characters.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe national ID external reference validation regex was relaxed to accept 2–20 uppercase alphanumeric characters (was 5–20). Tests were updated: a boundary valid case shortened and a new valid test for "DCC" added. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Claude Code ReviewCommit: f8b04d5 | CI: running (several checks still pending) SummaryClean, well-scoped bug fix. The NATIONAL_ID regex minimum was 5 characters, rejecting legitimate UK energy industry short codes (DCC=3, GETW=4, SEPD=4) and breaking the nightly Demo Reset workflow since the PAYG tenant was added. Lowering the minimum to 2 is a reasonable fix -- it accommodates known short codes while still rejecting empty/single-character inputs. Tests are thorough: boundary cases updated for both edges of the new range (AB at min, A below min), and a dedicated DCC case added to TestValidateExternalReference. This satisfies the stated requirement. Risk Assessment
FindingsNo actionable findings. The change is minimal, correct, and well-tested. Bot Review Notes
Previously Flagged
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@services/party/domain/party_test.go`:
- Around line 520-525: The existing TestParty_SetExternalReference_NationalID
tests must be updated to match the relaxed regex ({2,20}) used for
ExternalReferenceTypeNationalID: locate the
TestParty_SetExternalReference_NationalID table entries for the cases named
"minimum length" (currently using reference "AB123") and "too short" (currently
using "AB12") and either (A) change the inputs to reflect true minimum/too-short
boundaries (e.g., set "minimum length" to a 2-char string and make "too short" a
1-char string) or (B) update their wantErr expectations so "AB12" no longer
expects an error; ensure any assertions that reference the reference value or
wantErr are adjusted accordingly so tests align with the new {2,20} rule for
SetExternalReference / ExternalReferenceTypeNationalID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6da54b73-b3ee-4869-94d5-43666650f2a2
📒 Files selected for processing (2)
services/party/domain/party.goservices/party/domain/party_test.go
Update minimum length test to use 2-char reference and too-short test
to use 1-char reference, matching the new {2,20} constraint.
Stale CR - CodeRabbit re-reviewed and approved after boundary tests were updated
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
DCC(3 chars),GETW(4 chars), andSEPD(4 chars) are legitimate UK energy industry identifiers used in the PAYG energy manifestTest plan
DCC) - passesTestValidateExternalReferencesuite passes