Repository navigation
fix: issue #393 tax id followups - #434
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR adds server-side tax-registration format validation and keeps frontend format guidance synchronized with the country for which the server resolved it.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| frontend/src/app/(dashboard)/settings/page.tsx | Associates each resolved tax-ID format with its country and preserves authoritative guidance after silent save failures, resolving both prior findings. |
| main/routes/settings.ts | Validates non-empty submitted tax registration numbers against the effective country’s active format before persistence. |
| main/routes/tax-packs.ts | Returns the newly active country pack’s tax-registration format after activation completes. |
| tests/tax-pack-management.test.ts | Covers validation rejection, non-persistence, valid acceptance, activation response format, length limits, and disabled-tax behavior. |
| docs/API.md | Documents tax-registration validation and the structured validation-error response. |
Reviews (3): Last reviewed commit: "fix(settings): associate tax format with..." | Re-trigger Greptile
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Enforce signed tax registration formats at the settings API and refresh the UI after country-pack activation
What Changed
Final changed paths and statuses:
Risk Assessment
✅ Low: Change is well-bounded: adds server-side format validation to two settings endpoints with correct guard conditions (skips when no format exists, skips for empty tax ID), returns format in ensure-country response, and frontend correctly surfaces server error messages and updates the format hint. Previous finding was correctly fixed. Test coverage exercises the new validation paths.
Testing
Ran tax-pack-management integration test (166/166 pass) which covers the new section 9 assertions: invalid tax ID rejected at PUT /api/settings/business (400 + tax_id_format returned + DB unchanged), valid tax ID accepted (200), PUT /api/settings/tax rejects invalid tax ID (400), ensure-country returns tax_id_format, resolveTaxIdFormat/validateTaxRegistrationNumber unit assertions. Also ran 5 related test suites (all pass) and confirmed backend compiles cleanly.
Evidence: tax-pack-management test output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
frontend/src/app/(dashboard)/settings/page.tsx:2018- When PUT /settings/business returns 400 (tax ID fails format validation), the catch block shows only a generict('saveFailed')toast, discarding the server's specific error message ("Tax ID does not match the expected XX format: description") and thetax_id_formatobject. The user gets no actionable feedback about what format is expected. Additionally,setTaxIdFormatis only called on the success path (line 2010), so if the user changed country but the save failed, the UI continues showing the old country's format rather than the expected format from the 400 response. The server already sendstax_id_formatin the 400 body specifically for this use case.🔧 Fix: Show server 400 error message and tax_id_format on business save failure
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:tax-pack-managementnpm run test:redos-hardeningnpm run test:tax-enginenpm run test:tax-componentsnpm run test:tax-pack-catalognpm run test:legacy-tax-pack-digestnpm run build✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.