Derive ComplaintStatus from the status array instead of duplicating it - #151
Merged
hasithakn merged 1 commit intoSep 7, 2026
Merged
Conversation
The five status values were written out twice - once as a union type, once as the array the filter dropdowns iterate - so adding or renaming a status meant editing both, with nothing to catch it if only one changed. Deriving the union from the array with `as const` leaves a single source of truth; the resulting type is identical, and the array is only ever read (two `.map()` calls in the complaint filters), so becoming readonly costs nothing. It also settles a formatting disagreement. Prettier 3.9 collapses a union that fits inside printWidth, where 3.8 kept one member per line, so this file could not satisfy both versions at once and the frontend-npm group bump raising Prettier to 3.9.6 failed the format check on it. With the union gone, neither version has an opinion about the file and the bump can land unchanged. Verified against both: 3.8.1 and 3.9.6 each report the file clean. tsc, eslint and the full 297-test Vitest suite pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5BHH7V3eMp8RYgXP79TCL
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Comment |
hasithakn
approved these changes
Sep 7, 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.
Why
Frontend qualityfails on #103, the frontend-npm group bump, on one file:That bump raises Prettier from 3.8.1 to 3.9.6, and 3.9 changed how it formats union types — a union that fits inside
printWidthis now collapsed rather than kept one member per line:The two versions are mutually incompatible on this file — each rejects the other's output. Verified by running both against
main's copy withmain's.prettierrc:mainas-isSo simply reformatting the file in a separate PR would not work: that PR's own
Frontend qualityjob runsmain's Prettier 3.8.1, which would reject 3.9-formatted output. The reformat can only ride along inside #103 itself.What this does instead
The file already listed those five values twice — once as the union, once as the array the complaint filter dropdowns iterate:
Adding or renaming a status meant editing both, with nothing to catch it if only one changed. Deriving the union from the array removes the duplication:
The resulting type is identical.
COMPLAINT_STATUSESis only ever read — two.map()calls, inComplaintListFilters.tsxandComplaintQueueFilters.tsx— so becomingreadonlycosts nothing.Because the multi-line union is gone, neither Prettier version has an opinion about this file any more, which is what lets this merge on its own and unblocks #103 without touching it.
Verified
prettier@3.8.1 --check(whatmainruns today)prettier@3.9.6 --check(what #103 upgrades to)tsc -beslint src/types/complaint.tsSequencing
This is safe to merge on its own — it passes today's Prettier. Once it is on
main, #103 needs a rebase and should then go green with no changes of its own.Worth noting for later: this only removes the current collision. Any future Prettier minor can reformat something else, and Dependabot cannot fix that itself. If that churn becomes tiresome, pinning Prettier via a
dependabot.ymlignore is the alternative — deliberate upgrades instead of surprise ones.🤖 Generated with Claude Code
https://claude.ai/code/session_01N5BHH7V3eMp8RYgXP79TCL