fix(agent-memory-sync): support lone-value cron step form a/n as a-max/n#62
Merged
Conversation
…-max/n' Standard Vixie cron reads 5/2 on minutes as 5-59/2 (start at 5, step by 2 through the rest of the field range). The parser's step-match branch previously routed the lone range token through parseRange, whose missing end token failed parseInteger(undefined, ...) with a misleading "'undefined' ... outside range" error. Add a branch that treats a step token without a dash as start-max, matching how */n and a-b/n are already handled. Refs: c1117b17-ef8f-4b2c-b2b3-4aecf8c5f469 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The new a/n lone-value branch reuses parseStep, same as */n and a-b/n, so step 0 must still be rejected. Add a targeted test since the existing */0 test only pins the shared guard, not this specific form. Refs: c1117b17-ef8f-4b2c-b2b3-4aecf8c5f469 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
In
packages/agent-memory-sync/src/memory-sync/scheduler.ts,parsePart's step branch routed a lone range token (5in5/2) throughparseRange, whose missing end token failedparseInteger(undefined, ...)and threw the misleadingcron value 'undefined' is outside the allowed range. Standard Vixie cron reads5/2on minutes as5-59/2.Fix (AC option a)
The step branch now distinguishes a dashed range token (
a-b/n, existing path, unchanged) from a lone-value token, parsed as a single integer and filled fromstartto the field'smax:a/n==a-max/n.5/2on minutes yields {5,7,9,...,59}; per-field max honored.The
step<=0guard (#61) is untouched:parseStepruns before the branch dispatch, so5/0still throws before reaching the new path.Tests
5/2pinning test (throws -> valid) and added membership5/2 -> {5,7,...,59}, edge20/10 hours -> {20}, and a5/0rejection test (defense-in-depth for the fix(agent-memory-sync): reject cron step<=0 to stop scheduler infinite-loop hang (+ coverage) #61 infinite-loop guard on the new branch).*/nanda-b/nuntouched (existing tests green). typecheck clean; 52/52 tests; coverage gate green (scheduler.ts 100% lines).Reviewed (accept-with-nits, LOW only).
Refs: c1117b17-ef8f-4b2c-b2b3-4aecf8c5f469