Skip to content

[Hackathon] fix(schedule): echo environment and dates in updateSchedule dry-run sample - #584

Merged
zeshi-du merged 3 commits into
TestSprite:mainfrom
grzdev:fix/schedule-update-dry-run-sample
Nov 10, 2026
Merged

zeshi-du merged 3 commits into
TestSprite:mainfrom
grzdev:fix/schedule-update-dry-run-sample

Conversation

@grzdev

@grzdev grzdev commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes an issue where previewing schedule update --env <name> --dry-run failed with UNSUPPORTED (exit 7) and an error claiming the server updated the schedule without confirming the pin, and where --start / --end dates were dropped from the dry-run output preview.

Specifically:

  • In src/lib/dry-run/samples.ts (updateSchedule), echoes environment together with environmentMode: 'pinned' when environment is passed in the request body.
  • Echoes startAt and endAt when present in the request body.
  • Leaves the live-path server environment check intact so older live servers dropping the field are still properly rejected.
  • Adds regression tests in src/commands/schedule.write.test.ts (runUpdate dry-run previewing env pin and start/end dates) and src/lib/dry-run/samples.test.ts (updateSchedule sample validation).

Related issue

Fixes #377

Season 4 CLI Improvement Bonus

  • I'm entering this PR for the Season 4 CLI Improvement Bonus

Discord username: 3raiden

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Documentation only
  • Build / CI / chore

Checklist

  • PR targets the main branch.
  • Commits follow Conventional Commits (feat(...), fix(...), docs(...), …).
  • npm run lint and npm run format:check pass.
  • npm run typecheck passes.
  • npm test passes and coverage stays at or above the 80% gate.
  • New behavior is covered by unit tests (mock-based; no network or credentials required).
  • No secrets, API keys, internal endpoints, or personal data are included.
  • User-facing changes are reflected in README.md / DOCUMENTATION.md where relevant.

Notes for reviewers

Sample-only change as discussed in #377. Live path behavior remains unchanged.

Summary by CodeRabbit

  • Bug Fixes

    • Schedule update dry runs now preserve and display the selected environment, start date, and end date.
    • Date values are consistently normalized to ISO format, while unset dates remain explicitly represented.
    • Schedule details now clearly indicate whether the environment is inherited or pinned.
    • JSON and text output consistently report these schedule settings.
  • Tests

    • Added coverage for environment handling, date normalization, inherited environments, and pinned schedule updates across returned results and dry-run output.

…ample

Echo environment with environmentMode: 'pinned' when the PATCH body carries environment, and echo startAt and endAt when present in the updateSchedule dry-run sample. This prevents schedule update --env --dry-run from failing with an unsupportedEnvironmentError (exit 7).

Fixes TestSprite#377
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

The schedule dry-run sample now returns inherited environment fields and echoes update environment and date values. Tests verify pinned environment output and ISO date normalization in text, JSON, and sample responses.

Changes

Schedule update dry-run

Layer / File(s) Summary
Echo update fields in the sample
src/lib/dry-run/samples.ts, src/lib/dry-run/samples.test.ts
The sample declares environment: null with environmentMode: 'inherit'. Schedule updates echo string environments with environmentMode: 'pinned' and normalize supported date strings to ISO values. Tests verify these fields.
Verify schedule update preview
src/commands/schedule.write.test.ts
Tests verify pinned environment output and ISO date values in returned and JSON dry-run results.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 1a0fa

The dry-run preview behavior matches the requested environment and date output, with no identified merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Issue #377 has active coding requirements. The supplied change summary states that updateSchedule echoes a string environment with environmentMode: 'pinned', echoes startAt and endAt, and no…
Out of Scope Changes check Passed The supplied change summary lists changes in src/lib/dry-run/samples.ts, src/lib/dry-run/samples.test.ts, and src/commands/schedule.write.test.ts. These changes directly implement issue #377 and…
Title check Passed The title clearly identifies the main change: the schedule update dry-run sample now echoes the environment and dates.
Full details: Linked Issues check

Explanation

Issue #377 has active coding requirements. The supplied change summary states that updateSchedule echoes a string environment with environmentMode: 'pinned', echoes startAt and endAt, and normalizes date values. The supplied PR description states that the live-path environment check remains unchanged. Regression tests cover the dry-run environment pin, start/end dates, sample fields, and successful output.

Full details: Out of Scope Changes check

Explanation

The supplied change summary lists changes in src/lib/dry-run/samples.ts, src/lib/dry-run/samples.test.ts, and src/commands/schedule.write.test.ts. These changes directly implement issue #377 and its regression coverage. No unrelated production behavior is identified.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

ℹ️ Recent review info

⚙️ Run configuration

  • Configuration used: Repository: TestSprite/testsprite-cli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 186ea9b5-91e7-4691-bd2b-1877b339a6e9
📥 Commits

Reviewing files that changed from the base of the PR and between 9e5b32f and 1a0faab.

📒 Files selected for processing: 3

  • src/commands/schedule.write.test.ts
  • src/lib/dry-run/samples.test.ts
  • src/lib/dry-run/samples.ts
🚧 Files skipped from review as they are similar to previous changes: 1

  • src/commands/schedule.write.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions

Copy link
Copy Markdown

🏆 Season 4 CLI Improvement Bonus: entry recorded. Thanks, @grzdev!

To be counted, this PR needs the following by Oct 29, 11:59 PM PT:

  • ✅ A linked issue assigned to you.
  • ✅ Out of draft.
  • ✅ A Discord username in the description.

Rewards go to merged PRs judged a genuine improvement, and up to three bonus-eligible PRs count per person. Untick the box to withdraw the entry. This comment refreshes when you edit the PR. Full rules.

@github-actions github-actions Bot added the s4-cli-bonus Entered for the Season 4 CLI Improvement Bonus label Oct 22, 2026
@grzdev grzdev changed the title fix(schedule): echo environment and dates in updateSchedule dry-run sample [Hackathon] fix(schedule): echo environment and dates in updateSchedule dry-run sample Oct 28, 2026
@jangjos-128 jangjos-128 added the hackathon CLI hackathon submissions label Oct 29, 2026
@zeshi-du
zeshi-du merged commit adc5128 into TestSprite:main Nov 10, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hackathon CLI hackathon submissions s4-cli-bonus Entered for the Season 4 CLI Improvement Bonus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants