api: env-aware deployments — family endpoint + list env + scoped vault#23
Merged
Merged
Conversation
Closes the gaps J flagged after the §10.17 promote/copy roll-in:
- GET /api/v1/stacks now returns the real env + parent_stack_id
fields per stack so the dashboard stops hardcoding production.
- NEW: GET /api/v1/stacks/:slug/family — Pro+ endpoint that walks
parent_stack_id to the root, returns root + every direct child as
a flat list. Best-effort per-row URL from the primary exposed
service. Cache-Control: private, max-age=60 — short enough to
stay fresh across promotes, long enough to make env-tab nav snappy.
- ResolveVaultRefs now resolves against stack.Env (was hardcoded
"production"). Staging stacks read from the staging vault, dev
from dev, etc. Two call sites updated: stack.New + stack.Redeploy.
deploy.go was already correct.
- OpenAPI: list response shape documents env + parent_stack_id;
new /api/v1/stacks/{slug}/family path documents the 200/401/402/404
contract with full response schema.
- Tests: 8 new family cases (tier gate, single env, multi env,
fetch-via-child, cross-team 404, auth required, unknown slug 404,
cache header) + TestStackList asserts env/parent_stack_id present.
Compute redeploy on promote is still deferred — that hook waits on
Phase-1 POST /deploy/new like the rest of the env-aware story.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the gaps J flagged after §10.17 promote/copy roll-in (RETRO-2026-05-12).
GET /api/v1/stacksnow returnsenv+parent_stack_idper stack. Dashboard can stop hardcodingenv: 'production'.GET /api/v1/stacks/:slug/family— Pro+ endpoint that returns root + every direct child as a flat list (withis_root,parent_stack_id, best-efforturlfrom the primary exposed service,last_deploy_at). Same tier gate + agent_action contract as/promote. Cache-Control: private, max-age=60 — short enough to stay fresh across promotes, long enough to make env-tab nav snappy.ResolveVaultRefsnow resolves againststack.Envrather than the hardcoded"production"string in two call sites (stack.New+stack.Redeploy). Staging stacks read from the staging vault, dev from dev.deploy.gowas already correct./api/v1/stackslist documentsenv+parent_stack_id; new/api/v1/stacks/{slug}/familypath documents the full 200/401/402/404 contract.TestStackListextended to assert env/parent_stack_id present.Compute redeploy on promote is still deferred — that hook waits on Phase-1
POST /deploy/newalong with the rest of the env-aware story.Test plan
make test-unit— all packages greengo build ./...cleango vet ./...cleancurl -H "Authorization: Bearer …" https://api.instanode.dev/api/v1/stacks/<slug>/familyResolveVaultRefs call sites updated
internal/handlers/stack.go::New(line ~603) — now usesstack.Envinternal/handlers/stack.go::Redeploy(line ~975) — now usesstack.Envinternal/handlers/deploy.go::deploy(line ~150) — was already correct (usesd.Env)🤖 Generated with Claude Code