Skip to content

[Hackathon] fix(schedule): schedule update --env <name> --dry-run always fails with UNSUPPORTED (exit 7) and says the server updated the schedule #377

Closed

Description

@protonjls

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 updateSchedule sample, echo environment together with environmentMode: 'pinned' when the PATCH body carries a string environment, and echo startAt / endAt when 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 staging under dryRun: true resolves, exit 0, and prints the pinned environment; --start/--end appear in the dry-run output;
    • in src/lib/dry-run/samples.test.ts: the updateSchedule sample echoes environment, environmentMode, startAt and endAt.

    Each fails on main today.

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

  1. joaorgb15 commented on Oct 16, 2026

    @joaorgb15

    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:

    1. Is issue [Hackathon] fix(schedule): schedule update --env <name> --dry-run always fails with UNSUPPORTED (exit 7) and says the server updated the schedule #377 accepted for implementation and available for assignment?
    2. Is a new PR fixing this issue eligible for the Season 4 bonus, even though the issue was created before October 16?
    3. Are contributors based in Brazil eligible to receive cash rewards? If so, which payout methods are supported, and are there any verification requirements?

    I understand that merging a PR and qualifying for the bonus are separate decisions, and that payment is not guaranteed.

    Thank you!

  2. protonjls commented on Oct 16, 2026

    @protonjls
    ContributorAuthor

    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 /assign comment claims it.

    Two pointers that may save you time:

    • the sample is entry('updateSchedule', 'PATCH', '/schedules/{scheduleId}', …) in src/lib/dry-run/samples.ts;
    • the check that trips is the post-PATCH environmentMode === 'pinned' test in runUpdate (src/commands/schedule.ts). It runs even when --dry-run skips checkScheduleEnvironmentSupport just above it.
  3. zeshi-du commented on Oct 20, 2026

    @zeshi-du
    Contributor

    Thanks @protonjls — confirmed on v0.15.0 and accepted. The updateSchedule dry-run sample never echoes environment/environmentMode or startAt/endAt, so the post-PATCH pin check in runUpdate always fails under --dry-run.

    Scope:

    • Sample-only fix as proposed: echo environment with environmentMode: 'pinned' when the PATCH body carries a string environment, and echo startAt/endAt when present.
    • Do not change the live-path pin check; an old server that drops the field must still be refused.
    • Tests in schedule.write.test.ts and samples.test.ts that fail before the fix.

    @joaorgb15 asked to take it and @protonjls has stepped aside, so @joaorgb15, comment /assign to claim it.

  4. added
    accepted
    on Oct 20, 2026
  5. grzdev commented on Oct 20, 2026

    @grzdev
    Contributor

    /assign

  6. added
    in-progress
    on Oct 20, 2026
  7. testsprite-hob commented on Oct 20, 2026

    @testsprite-hob

    Assigned to @grzdev. Thanks for taking this on. (1 more slot available.)

    Your open assigned issues (2/3):

  8. ruili-testsprite commented on Oct 20, 2026

    @ruili-testsprite
    Contributor

    Small addition to the scope above: please also make the base schedule sample in src/lib/dry-run/samples.ts match the real response shape. The server always returns environment and environmentMode; for a project schedule that is environment: null, environmentMode: 'inherit' unless it is pinned. When echoing startAt/endAt, use ISO strings (new Date(x).toISOString()), as the server does.

  9. grzdev commented on Oct 20, 2026

    @grzdev
    Contributor

    Thanks @ruili-testsprite! Updated in #584:

    • The base schedule sample in src/lib/dry-run/samples.ts now matches the real response shape with environment: null, environmentMode: 'inherit'.
    • updateSchedule echoes startAt / endAt as ISO strings (
      ew Date(x).toISOString()).
    • Added unit tests in src/lib/dry-run/samples.test.ts and src/commands/schedule.write.test.ts verifying the base sample shape and ISO-normalized date echo under --dry-run.
  10. added
    hackathon
    on Oct 29, 2026
  11. added a commit that references this issue on Nov 10, 2026
    adc5128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

acceptedhackathonin-progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions