Skip to content

fix(up): start shared-only (hub) workspaces and self-heal the network - #91

Merged
gustavobertoi merged 1 commit into
mainfrom
fix/up-hub-workspace-network-selfheal
Jul 1, 2026
Merged

fix(up): start shared-only (hub) workspaces and self-heal the network#91
gustavobertoi merged 1 commit into
mainfrom
fix/up-hub-workspace-network-selfheal

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Problem (reported live)

devstack up from a devstack init starter workspace (shared pg/redis/minio, no projects) printed a wall of [ok]/[skipped] but started nothing — no containers, no devstack_shared network:

[ok]      preflight
[skipped] network
[skipped] generate
[ok]      secrets
[ok]      trust
[skipped] shared      <- brought up nothing

Root cause — two drift bugs

  1. Hub / shared-only workspaces never came up. Selective-up (spec 12) derives the shared set from projects' uses (profile.sharedUsedBy). A workspace with shared: but no projects has nothing referencing those services, so active.Shared was empty and the shared phase no-op'd. This is exactly what devstack init scaffolds.

  2. The network phase was fingerprint-cached with a constant fingerprint, so once satisfied it skipped forever. When the external devstack_shared network was removed out-of-band (a docker network prune, a Docker Desktop / WSL restart), up skipped re-creating it and every compose-up failed with network devstack_shared declared as external, but could not be found.

Fix

  • A project-less workspace that declares shared: now brings up its full declared shared stack (sortedSharedNames).
  • The network phase is now AlwaysRun: EnsureNetwork is a cheap create-if-missing under the lock, so re-running every time is correct and self-healing.

Verification

Ran against the real reported workspace — network re-created (51ms) and all three shared services came up healthy:

[ok]      network (51ms)
[ok]      shared (10738ms)
devstack-shared-postgres-1   Up (healthy)   5432/tcp
devstack-shared-redis-1      Up (healthy)   6379/tcp
devstack-shared-minio-1      Up (healthy)   9000/tcp

Tests

  • TestBuildUpHubWorkspaceBringsUpAllShared — a hub workspace brings up all declared shared services and builds no compose-up phase.
  • TestNetworkPhaseSelfHeals — the network re-ensures after out-of-band removal.
  • TestBuildUpHappyPath re-run assertion updated: network now re-runs (AlwaysRun) rather than skips.

Known follow-up (not in this PR)

Container-level drift (a manual docker rm of a shared container while config is unchanged) still leaves the shared phase fingerprint-satisfied → skipped. Shared services ship with restart: unless-stopped so restarts self-recover; manual removal is recovered via doctor --fix / shared reconcile. A future change can fold live-container liveness into the shared phase gate.

🤖 Generated with Claude Code

Two drift bugs made `devstack up` a silent no-op that started nothing —
the exact symptom hit on a `devstack init` starter workspace (shared
pg/redis/minio, no projects):

1. Selective-up derived the shared set only from projects' `uses`
   (profile.sharedUsedBy). A hub / shared-only workspace has no project
   referencing its shared services, so `active.Shared` was empty and the
   shared phase brought up nothing. Now a project-less workspace that
   declares `shared:` brings up its full declared shared stack.

2. The network phase had a constant fingerprint, so once satisfied it was
   skipped forever — even after the external `devstack_shared` network was
   removed out-of-band (docker network prune, a Docker Desktop / WSL
   restart). Every subsequent compose-up then failed with "network
   devstack_shared declared as external, but could not be found". Marked
   the phase AlwaysRun: EnsureNetwork is a cheap create-if-missing under
   the lock, so re-running every time is correct and self-healing.

Tests: a hub workspace brings up all declared shared services (and no
compose-up phase); the network re-ensures after out-of-band removal; the
happy-path re-run now expects network to re-run (AlwaysRun) rather than skip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi
gustavobertoi merged commit bb77e22 into main Jul 1, 2026
4 checks passed
@gustavobertoi
gustavobertoi deleted the fix/up-hub-workspace-network-selfheal branch July 1, 2026 12:39
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.

1 participant