Skip to content

fix: retry failed SSL renewals and preserve login context endpoints - #196

Merged
Hydralerne merged 7 commits into
oblien:feat/bugfix-batch-2026-09-16from
Rish-it:fix/critical-deploy-ssl-server-bugs
Sep 16, 2026
Merged

Hydralerne merged 7 commits into
oblien:feat/bugfix-batch-2026-09-16from
Rish-it:fix/critical-deploy-ssl-server-bugs

Conversation

@Rish-it

@Rish-it Rish-it commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

A transient SSL renewal failure changed the certificate row to error, which excluded it from both automatic and organization-wide renewal selection. Re-authenticating a named CLI context also replaced its saved endpoints with localhost when URL flags were omitted.

The renewal selectors now retry due certificates in either active or error state. Organization renewal uses the same configured renewal window and TLS ownership helper as the scheduler, respects per-domain access, and reports an unverified provider result as failed. Unissued, fresh, and externally managed certificates are excluded.

CLI login resolves each endpoint from the explicit flag, then the named context’s saved value, then the local default. It keeps validation through the shared SDK HTTP client and saves changes only after the replacement token is accepted.

Validation: 47 API/TLS/server-removal cases, 17 CLI cases, and a real PGlite selector regression pass. API and CLI TypeScript pass. Six regressions fail against current main.

This PR targets the bug integration branch for #892.

Rish-it added 5 commits July 24, 2026 12:38
A renewal that throws flips the domain to sslStatus="error", but both
renewal selectors matched only "active": findExpiringSsl (the ssl:renew
cron) and renewOrgCerts (the org-wide "renew all"). Once a renew failed,
the domain was never picked up again by either path, so its certificate
expired silently with no further attempt.

Include "error" in both selectors so a failed renewal is retried on the
next sweep (every 6h; well under Let's Encrypt's failed-validation rate
limit). "external" (upstream-managed TLS) and "provisioning" (no cert
issued yet) stay excluded.
POST /deployments responded { data: { deployment } }, but the CLI git-deploy
path reads data.deployment_id (apps/cli deploy.ts). The flat id was undefined,
breaking `openship deploy --watch` and the follow hint. The flat
{ deployment_id, project_id } shape is the convention elsewhere (dashboard
lib/api/updates.ts types it; the folder-deploy path already emits it) — this
trigger was the outlier.

Flatten deployment.id/projectId into the response. Additive: `deployment` (and
`skipped`) stay so existing readers of those keep working.
deleteServer hard-deleted a server with no occupancy check, orphaning the
running containers of any project deployed to it — server delete does not
enqueue orphaned-resource GC (that path is project-teardown only).

Add deployment.countActiveOnServer(): projects whose CURRENT active
deployment targets the server, matched on the snapshot meta serverId.
deleteServer now returns 409 when the count is non-zero unless
?force=true is passed.
Two robustness gaps in the `server` command:

- `rm` deleted with no confirmation; it now prompts (y/N) interactively
  and takes --force to skip. --force also forwards ?force=true so the
  API's active-deployment guard is bypassed for a deliberate teardown.
- Non-streaming `install` exited 0 even when a component failed, unlike
  the --follow path. It now exits 1 when any component fails, so CI and
  scripts don't read a partial install as success.
The --api-url/--dashboard-url options carried localhost defaults, so
commander set them even when unspecified. Re-authing an existing context
without those flags wrote the localhost defaults over its saved
endpoints, silently repointing a prod/staging context at localhost.

Drop the option defaults and resolve from flag -> saved context ->
localhost, so an omitted flag keeps the stored URL and an explicit flag
still overrides.
Copilot AI review requested due to automatic review settings July 24, 2026 07:56

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.

@Baaaki

Baaaki commented Aug 7, 2026

Copy link
Copy Markdown

Ran into this too. Fix looks solid, thanks.

Conflict in the deploy trigger response: main routes the returned deployment
through deploymentService.presentDeployment (the oblien#336 env-masking boundary),
this branch flattens deployment_id/project_id for the CLI. Both are kept —
the masked deployment plus the flat ids.

deployment.controller.test.ts stubs deployment.service as an empty module, so
create() now needs presentDeployment on the mock; passes the row through
untouched since masking has its own coverage.
@Hydralerne Hydralerne changed the title fix: five silent-failure bugs in the CLI/deploy path (SSL renewal, deploy id, server rm, install exit, re-login) fix: retry failed SSL renewals and preserve login context endpoints Sep 16, 2026
@Hydralerne
Hydralerne changed the base branch from main to feat/bugfix-batch-2026-09-16 September 16, 2026 04:03
@Hydralerne
Hydralerne merged commit 2f37a0a into oblien:feat/bugfix-batch-2026-09-16 Sep 16, 2026
6 of 8 checks passed
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.

4 participants