#21190: test(cron-cli): assert cron.update patch schedule.staggerMs on edit
cli
size: XS
Cluster:
Cron Enhancements and Fixes
## Summary
- **Problem:** The `sets explicit stagger for cron edit` test asserted `schedule.*` at the top level, but the CLI sends the update as `{ id, patch: { schedule: ... } }`, causing the assertion to read `undefined`.
- **Why it matters:** Ensures correct validation of stagger behavior in cron edit, which is used for load-balanced scheduling.
- **What changed:** Updated the test to assert `params.patch.schedule.kind` and `params.patch.schedule.staggerMs`.
- **What did NOT change:** No CLI behavior changes; no gateway contract changes; test-only fix.
---
## Change Type
- [x] Bug fix
---
## Scope
- [x] CI/CD / infra
---
## Linked Issue/PR
- Closes #
- Related #
---
## User-visible / Behavior Changes
None.
---
## Security Impact (required)
- New permissions/capabilities? No
- Secrets/tokens handling changed? No
- New/changed network calls? No
- Command/tool execution surface changed? No
- Data access scope changed? No
---
## Repro + Verification
### Environment
- OS: macOS
- Runtime/container: Node + pnpm
- Model/provider: N/A
- Integration/channel: N/A (unit test only)
- Relevant config (redacted): default local dev setup
### Steps
1. pnpm -s vitest src/cli/cron-cli.test.ts -t "sets explicit stagger for cron edit"
### Expected
- Test passes.
### Actual
- Test passes after assertion fix.
---
## Evidence
- [x] Failing test before + passing after (local reproduction)
---
## Human Verification (required)
- Verified scenarios: Ran targeted vitest test and full `src/cli/cron-cli.test.ts` locally.
- Edge cases checked: None (test-only assertion path correction).
- What you did **not** verify: No integration or e2e flows; no runtime gateway calls.
---
## Compatibility / Migration
- Backward compatible? Yes
- Config/env changes? No
- Migration needed? No
---
## Failure Recovery (if this breaks)
- Revert this commit (test-only change).
---
## Risks and Mitigations
None.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed test assertion path to correctly validate stagger behavior in cron edit. The CLI sends `{ id, patch: { schedule: ... } }` to `cron.update`, but the test was asserting `schedule.*` at the top level, causing assertions to read `undefined`. Updated to assert `params.patch.schedule.kind` and `params.patch.schedule.staggerMs`.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk - it's a test-only assertion fix with no behavior changes.
- The change corrects a test assertion path to match the actual gateway RPC structure. The fix is straightforward, isolated to test code only, and aligns with other test patterns in the same file that already use `params.patch.*` correctly. No runtime code, CLI behavior, or gateway contracts are affected.
- No files require special attention
<sub>Last reviewed commit: 926c3ad</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#21027: fix(tests): resolve TypeScript type errors in CLI test files
by kittipond2365 · 2026-02-19
79.0%
#12303: fix(cron): correct nextRunAtMs calculation and prevent timer stall
by colddonkey · 2026-02-09
78.5%
#20188: fix: Update sessionFile path when rolling to new session in cron jobs
by jriff · 2026-02-18
78.3%
#8698: fix(cron): default enabled to true for new jobs
by emmick4 · 2026-02-04
77.8%
#17643: fix: clear stale runningAtMs in cron.run to allow manual triggers
by MisterGuy420 · 2026-02-16
77.6%
#11813: fix(cron): ensure 'at' schedule type correctly registers nextWakeAt...
by leo-reifying · 2026-02-08
77.4%
#18743: Cron Tool Hardening: Normalize Gateway Params and Enforce Valid Sch...
by cccat6 · 2026-02-17
77.2%
#23221: fix(cron): recover flat patch params for update action and fix schema
by charojo · 2026-02-22
76.9%
#2071: fix: accept JSON string for cron.add job parameter (#1940)
by andrescardonas7 · 2026-01-26
76.9%
#19414: fix: respect job timeoutSeconds for stuck runningAtMs detection
by namabile · 2026-02-17
76.7%