Skip to content

feat(services): fast env apply after save — restart without rebuild - #681

Open
Rish-it wants to merge 4 commits into
oblien:mainfrom
Rish-it:fix/669-service-env-fast-apply
Open

feat(services): fast env apply after save — restart without rebuild#681
Rish-it wants to merge 4 commits into
oblien:mainfrom
Rish-it:fix/669-service-env-fast-apply

Conversation

@Rish-it

@Rish-it Rish-it commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #669

Summary

Services panel now offers a fast Apply after saving environment variables on a service with a live deployment. Apply triggers a refresh deployment that recreates only that service from its existing image — no rebuild, same as the project-level fast apply.

Changes (2 atomic commits)

  1. feat(dashboard): add per-service env apply trigger payload helper — pure helper (service-env-apply.ts) returning { projectId, refresh: true, serviceIds: [serviceId] }, the contract the API's refresh path already honors. Unit tests pin the payload shape and that it never pulls source.
  2. feat(services): offer restart-only env apply after env saveServiceDetailPanel swaps Save → Apply once env is saved and a deployment is live. Clicking routes to /build/<id> for progress, matching the panel's existing redeploy handler (same response guard, same navigation). Pending offer resets on service switch so it can't leak across services. Editing again reverts to Save.

Reuses existing pieces only: backend refresh + serviceIds path, panel's deployApi import and RotateCw icon, i18n keys from projectSettings.json (envVars.applyButton, envVars.toast.applyFailed*). No new dependencies, no new translation entries.

Testing

  • New unit tests: service-env-apply.test.ts
  • Full dashboard suite: 1048 passed
  • tsc --noEmit: clean

Pure helper returning the deployApi.trigger payload for a refresh-only
redeployment of one service ({ projectId, refresh: true, serviceIds }).
Contract pinned by unit tests; mirrors the refresh path the API already
honors for project-level fast env apply.
After saving environment variables on a service with a live deployment,
swap the Save button for Apply, which triggers a refresh deployment that
recreates only that service from its existing image — no rebuild.

Mirrors the project-level EnvVarsEditor flow; response handling and
build-page navigation follow the panel's existing redeploy handler.
Pending offer resets on service switch so it can't leak across services.

Fixes oblien#669
Copilot AI lite review requested due to automatic review settings August 21, 2026 17:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The refresh path (POST /deployments with refresh+serviceIds) had zero
coverage despite being the engine behind the fast env apply. Pins:
- per-service refresh lands as an exclusive non-force subset
  (meta.targetServiceIds + meta.refreshServiceIds)
- disabled services are filtered out of an explicit scope
- no active deployment / empty enabled target fail loudly instead of
  silently re-cloning
- refresh skips the git HEAD lookup and inherits the active commit
- key the apply offer by service id, not a boolean reset by an
  env-identity effect — refetches replace service objects wholesale,
  so the old offer could never survive to render
- drop the trigger-payload helper and its test; inline the call like
  handleRedeployService already does
- guard Apply on enabled services; disabled ones surfaced the
  backend's raw "Nothing to refresh" error
- keep the spinner set through navigation instead of resetting it in
  a finally (button flickered back to Save mid-route-change)
- own i18n keys under projectDetail.services.detail in all locales;
  borrowed projectSettings copy didn't name the service
- remove stray blank line in build.service.test.ts

Backend refresh-contract tests unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: add publish env button after update env / updated env without need to redeploy it, as fast env update in services / project

2 participants