fix: spell every weekday correctly in the schedule preview - #376
Open
Sma1lboy wants to merge 1 commit into
Open
Conversation
The automation composer's schedule preview built a weekday phrase by uppercasing the first letter and appending "days" to the lowercased tail, which only spelled MON/FRI/SUN right — TUE/WED/THU/SAT rendered "Tuedays", "Weddays", "Thudays", "Satdays", all reachable straight from the day stepper. Name weekdays from an explicit map, and stay silent on an hourly list/range minute (`15,45`) instead of asserting a `:15,45` fire time the schedule never has.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @Sma1lboy's task in 1m 57s —— View job Review in progress
|
Codecov Report❌ Patch coverage is
... and 398 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.

Direction
Bugs / correctness — a self-found defect in the automation composer's schedule-preview text.
Problem
describeCroninsrc/tui/component/cron-segments.tsbuilt the single-weekday phrase by string surgery — uppercase the first letter, lowercase the tail, append"days":That only spells the three abbreviations whose first-letter + lowercased-tail +
"days"happens to equal the real word (MON→Mondays,FRI→Fridays,SUN→Sundays). The other four render garbage, and every one of them is reachable straight from the day-of-week stepper (DOW_LADDER):0 9 * * TUETuedays at 09:000 9 * * WEDWeddays at 09:000 9 * * THUThudays at 09:000 9 * * SATSatdays at 09:00The whole point of the preview is to let a user confirm a cron they can't read back, so 4/7 weekdays showing a nonsense word defeats it.
A second, narrower defect in the same function's helper (
describeTimeOfDay): for an hourly schedule (hour === "*") any non-*/nminute fell through to`hourly at :${minute.padStart(2, "0")}`. A list/range minute is not a single clock minute, so15,45 * * * *renderedevery day hourly at :15,45— a confidently-false fire time — instead of returningnullthe way every other unmodelled shape does.Fix
DOW_NAMESmap instead of the slice trick./^\d+$/) and otherwise returnsnull, keeping the preview's "silent rather than wrong" contract.Both changes are confined to
cron-segments.ts(still ~127 lines, well under the size cap).Verification
test/tui/cron-segments.test.ts: the existingdescribeCronblock only assertedMON(the one accidentally-correct case), so the bug slipped through. Added all six other weekdays plus the hourly list/range-minute cases.bun run vitest run test/tui/cron-segments.test.ts→ 16 passed.bun run lintandbun run typecheckboth green across the workspace.Follow-ups
None required. The bug-hunt also flagged a borderline
formatRelativerounding choice (Math.round(minutes / 60)reports 90 min as "in 2h") inautomation-composer.ts— left out of scope as an approximation-precision judgement call, not a clear defect.Generated by Claude Code