Skip to content

stack: expose cleanup targets on the public handle for embedding supervisors #5789

Description

@martijnwalraven

Pinned at: develop @ 31d6fb97, consuming @supabase/stack via createStack() from Node.

The stack computes exact Docker cleanup targets at build time (CleanupTargets — the deterministic container names) and the daemon path persists them (StackMetadataPersistence.fromStateManagerstack.json) precisely so crash recovery can docker rm -f the exact set after the daemon dies. That's the right design — but it's daemon-only: the library/foreground layer wires StackMetadataPersistence.noop (layers.ts), and StackHandle exposes no cleanup targets.

An application embedding createStack() in its own supervisor has the identical crash-recovery need: if the host process is SIGKILLed hard enough that the detached per-service supervisors also die before their cleanup runs, the embedder must remove leftover containers on its next start — and today the only way to know their names is to re-derive the internal supabase-<service>-<apiPort> convention (StackBuilder's dockerContainerName), i.e. couple to an implementation detail that can drift.

Request: expose the computed cleanup targets read-only on the public handle (and/or StackInfo), so embedders can persist the same exact-targets record the daemon path already relies on. The data exists at handle-construction time; this is surfacing, not new machinery.

(For context: the per-service supervisors' orphan cleanup is excellent — in our testing it reaped containers within seconds of host death. This request is only about the residual case where the supervisors themselves are killed.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions