Repository navigation
Description
Verified against (commit SHA or released version)
commit 988c0355bb05631e9c6c1785e443937ff2a88c0e (main, v0.14.0)
Discord Username / User ID
1149447580477042769
What does this improvement do?
DOCUMENTATION.md lists testsprite schedule update <project-schedule-id> --env staging as a usage example and describes --dry-run as the way "to confirm an install or learn the surface before configuring auth". Previewing that example offline always fails, and the error text describes a write that never happened:
$ testsprite schedule update sch_1 --env staging --dry-run
[dry-run] sample response — not from the server
Error: This server does not support schedule environments yet.
The server updated schedule sch_7d21ac48 without confirming the environment pin. Other requested fields (none) may have been applied; inspect it with: testsprite schedule get sch_7d21ac48
exit=7
With --output json the envelope is "code": "UNSUPPORTED" (exit 7), with details.requestedFields: ["environment"]. The sibling schedule create … --env staging --dry-run previews fine (environment: staging (pinned), exit 0). So a user or agent following the docs is told their server lacks the feature and that a real schedule "may have been" changed, during a run that is supposed to make no writes.
A smaller symptom of the same cause: schedule update sch_1 --start 2027-01-01T00:00:00Z --end 2027-06-01T00:00:00Z --dry-run --output json echoes the canned "startAt": "2026-05-01T00:00:00.000Z", "endAt": null. The requested dates are dropped from the preview, although --name, --cron, --timezone, --pause/--resume and --send-to are echoed.
Reproduction: run the commands above. No account or network is needed.
Expected. schedule update --env staging --dry-run previews the pinned schedule (environment: staging, environmentMode: pinned) and exits 0, as schedule create --env … --dry-run does. --start/--end show up in the preview like the other updated fields.
Details / implementation notes
Root cause. runUpdate in src/commands/schedule.ts correctly skips the server-support probe under dry-run:
if (environment !== undefined && !opts.dryRun) {
await checkScheduleEnvironmentSupport(client, opts.scheduleId);
}It then still runs the post-PATCH pin check against the dry-run sample:
if (
environment !== undefined &&
!(updated.environmentMode === 'pinned' && updated.environment === environment)
) {
throw unsupportedEnvironmentError(`The server updated schedule …`)The updateSchedule sample in src/lib/dry-run/samples.ts is documented as "Echoes the requested change so a caller can confirm the flags they passed reached the body". However, it echoes only name, enabled, cron, timezone and sendTo. It never echoes environment/environmentMode (so the check always fails) or startAt/endAt.
Proposed change (small, sample-only, no change to the live path):
-
In the
updateSchedulesample, echoenvironmenttogether withenvironmentMode: 'pinned'when the PATCH body carries a stringenvironment, and echostartAt/endAtwhen present. The real-server pin check stays exactly as it is, so an old server that drops the field is still refused. -
Tests:
- in
src/commands/schedule.write.test.ts(runUpdate):--env stagingunderdryRun: trueresolves, exit 0, and prints the pinned environment;--start/--endappear in the dry-run output; - in
src/lib/dry-run/samples.test.ts: theupdateSchedulesample echoesenvironment,environmentMode,startAtandendAt.
Each fails on
maintoday. - in
An alternative is to skip the pin check when opts.dryRun. I'd rather fix the sample, because that keeps the preview showing the pinned environment, as schedule create --dry-run does.
I already hold #372–#374, so this is free for anyone to pick up once it's triaged.
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
joaorgb15 commentedon Oct 16, 2026
Hello TestSprite maintainers,
I'm interested in contributing a fix for issue #377 as part of the Season 4 CLI Improvement Bonus.
I've reviewed the reproduction evidence and the proposed sample-only fix, including the required regression tests.
Before starting implementation, could you please confirm:
schedule update --env <name> --dry-runalways fails with UNSUPPORTED (exit 7) and says the server updated the schedule #377 accepted for implementation and available for assignment?I understand that merging a PR and qualifying for the bonus are separate decisions, and that payment is not guaranteed.
Thank you!
protonjls commentedon Oct 16, 2026
Thanks @joaorgb15. From my side it's yours: I'm not working on #377 and won't open a PR for it. Acceptance and eligibility are for the maintainers to answer. Per CONTRIBUTING, once a maintainer labels it
accepted, a/assigncomment claims it.Two pointers that may save you time:
entry('updateSchedule', 'PATCH', '/schedules/{scheduleId}', …)insrc/lib/dry-run/samples.ts;environmentMode === 'pinned'test inrunUpdate(src/commands/schedule.ts). It runs even when--dry-runskipscheckScheduleEnvironmentSupportjust above it.zeshi-du commentedon Oct 20, 2026
Thanks @protonjls — confirmed on v0.15.0 and accepted. The
updateScheduledry-run sample never echoesenvironment/environmentModeorstartAt/endAt, so the post-PATCH pin check inrunUpdatealways fails under--dry-run.Scope:
environmentwithenvironmentMode: 'pinned'when the PATCH body carries a stringenvironment, and echostartAt/endAtwhen present.schedule.write.test.tsandsamples.test.tsthat fail before the fix.@joaorgb15 asked to take it and @protonjls has stepped aside, so @joaorgb15, comment
/assignto claim it.grzdev commentedon Oct 20, 2026
/assign
testsprite-hob commentedon Oct 20, 2026
Assigned to @grzdev. Thanks for taking this on. (1 more slot available.)
Your open assigned issues (2/3):
ruili-testsprite commentedon Oct 20, 2026
Small addition to the scope above: please also make the base
schedulesample insrc/lib/dry-run/samples.tsmatch the real response shape. The server always returnsenvironmentandenvironmentMode; for a project schedule that isenvironment: null, environmentMode: 'inherit'unless it is pinned. When echoingstartAt/endAt, use ISO strings (new Date(x).toISOString()), as the server does.grzdev commentedon Oct 20, 2026
Thanks @ruili-testsprite! Updated in #584:
ew Date(x).toISOString()).
fix(schedule): echo environment and dates in updateSchedule dry-run s…