WL-0MP14WFW6001VE3G: Add priority normalization to create, update and doctor commands#2004
Merged
SorraTheOrc merged 1 commit intoMay 22, 2026
Conversation
… doctor commands - Create src/validators/priority.ts with normalizePriority, isValidPriority, isMappablePriority - Update create.ts to validate and normalize priority on creation, rejecting P* values - Update update.ts to validate and normalize priority on update, rejecting P* values - Update doctor.ts with: - 'doctor priority' subcommand supporting --dry-run and --apply - Priority validation integrated into main doctor findings with --fix support - Add unit tests for priority validator (14 tests) - Add integration tests for doctor priority subcommand (6 tests)
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.
Summary
Add priority normalization and validation across
wl create,wl update, andwl doctorcommands. This ensures consistent priority values in the database by normalizing case and providing a mapping for P* legacy values.Work Done
Created
src/validators/priority.ts— a centralized priority validation/normalization utility with:normalizePriority(raw)— case-normalizes canonical values, maps P0-P3 to canonical, returns null for unknown tokensisValidPriority(raw)— checks if a value is a canonical priority (case-insensitive)isMappablePriority(raw)— checks if a value is P0-P3 (case-insensitive)CANONICAL_PRIORITIESandPRIORITY_MAPUpdated
wl create— validates the--priorityflag: normalizes case, rejects P* and unknown tokens with a clear error messageUpdated
wl update— validates the--priorityflag with the same behavior as createUpdated
wl doctor:doctor prioritysubcommand with--dry-run(preview) and--apply(fix P* values)doctorfindings (reported with other findings)doctor --fixapplies the P*→canonical mapping for invalid priorities automaticallyTests:
src/validators/priority.tsdoctor prioritysubcommandHow to Test
wl create -t "test" -p High— should work (normalizes to "high")wl create -t "test" -p P1— should fail with error about P* not accepted at creationwl create -t "test" -p invalid— should fail with errorwl doctor priority --dry-run— preview invalid prioritieswl doctor priority --apply— fix P* values in the databaseReview Focus
src/validators/priority.ts