fix(webapp): allow resuming manually paused environments#4120
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details
|
| File | Change Summary |
|---|---|
| `apps/webapp/app/v3/services/pauseEnvironment.server.ts` | Updated resume query filter to include `pauseSource: null` alongside excluding `BILLING_LIMIT` |
| `.server-changes/fix-resume-user-paused-environment.md` | Added changelog entry describing the fix |
Sequence Diagram(s)
Not applicable — this is a simple filter condition update, not a multi-step interaction flow.
Related Issues: None specified.
Related PRs: None specified.
Suggested labels: bug, webapp, server
Suggested reviewers: None specified.
Poem: A rabbit paused, then hopped once more,
No billing gate to bar the door.
Null pauseSource now finds its way,
Resumed and running, come what may.
A tiny fix, a tidy cheer— 🐇
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | The description is useful but does not follow the required template and omits the Closes, checklist, testing, changelog, and screenshots sections. | Reformat the PR description to match the template, add Closes #, complete the checklist, and include Testing, Changelog, and Screenshots sections. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly summarizes the main change: allowing manually paused environments to resume. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/resume-user-paused-env
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.
Comment @coderabbitai help to get the list of available commands.
…nts (#4127) Follow-up to #4120, adding regression coverage for the pause/resume path in `PauseEnvironmentService`. Three tests against the real service with testcontainers Postgres (no mocks), seeded org/project/environment rows, and the same `AuthenticatedEnvironment` coercion production uses: 1. **resumes a manually paused env** - the actual regression: pause leaves `pauseSource` null, resume must succeed. Verified this fails with the exact pre-#4120 symptom (false billing-limit error) when the fix is reverted locally. 2. **rejects resume of a billing-limit paused env** - the guard still blocks manual resume while `pauseSource = BILLING_LIMIT`, and the env stays paused. 3. **manual pause while billing-limit paused is a no-op** - returns success without overwriting `pauseSource`, so billing-limit converge can still find and unpause the environment. Tests-only change, no runtime behavior touched.
Bug
Manually pausing an environment works, but resuming it always fails with:
even when no billing limit is in effect. Once paused by a user, an environment cannot be resumed at all.
Root cause
A manual pause leaves
RuntimeEnvironment.pauseSourceasNULL(only billing-limit enforcement setsBILLING_LIMIT). The resume path inPauseEnvironmentServiceguards itsupdateManywith:Prisma's
NOTon a nullable field translates to SQL!=, which excludesNULLrows. So the update matches zero rows for every user-paused environment, and the zero-count branch (meant to catch a race with billing-limit pausing) returns the misleading billing-limit error.Introduced in #3996 (the guard is correct for
BILLING_LIMITrows; it just also swallowsNULL).Fix
Explicitly include
pauseSource: nullrows:Billing-limit-paused environments are still blocked from manual resume, both by the
getManualPauseEnvironmentResultguard and by this clause.Verification
Reproduced locally: paused an environment via
PauseEnvironmentService(DB showspaused = true,pauseSource = NULL), resume returned the billing-limit error withupdateManymatching 0 rows. With the fix, resume succeeds and the environment unpauses. Billing-paused rows remain excluded by the same clause.