Skip to content

api: env-aware deployments — family endpoint + list env + scoped vault#23

Merged
mastermanas805 merged 1 commit into
masterfrom
env-aware-deployments-2026-05-12
May 12, 2026
Merged

api: env-aware deployments — family endpoint + list env + scoped vault#23
mastermanas805 merged 1 commit into
masterfrom
env-aware-deployments-2026-05-12

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

Closes the gaps J flagged after §10.17 promote/copy roll-in (RETRO-2026-05-12).

  • GET /api/v1/stacks now returns env + parent_stack_id per stack. Dashboard can stop hardcoding env: 'production'.
  • NEW: GET /api/v1/stacks/:slug/family — Pro+ endpoint that returns root + every direct child as a flat list (with is_root, parent_stack_id, best-effort url from 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.
  • ResolveVaultRefs now resolves against stack.Env rather than the hardcoded "production" string in two call sites (stack.New + stack.Redeploy). Staging stacks read from the staging vault, dev from dev. deploy.go was already correct.
  • OpenAPI updated: /api/v1/stacks list documents env + parent_stack_id; new /api/v1/stacks/{slug}/family path documents the full 200/401/402/404 contract.
  • 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 extended to assert env/parent_stack_id present.

Compute redeploy on promote is still deferred — that hook waits on Phase-1 POST /deploy/new along with the rest of the env-aware story.

Test plan

  • make test-unit — all packages green
  • go build ./... clean
  • go vet ./... clean
  • After merge: deploy + smoke curl -H "Authorization: Bearer …" https://api.instanode.dev/api/v1/stacks/<slug>/family

ResolveVaultRefs call sites updated

  • internal/handlers/stack.go::New (line ~603) — now uses stack.Env
  • internal/handlers/stack.go::Redeploy (line ~975) — now uses stack.Env
  • internal/handlers/deploy.go::deploy (line ~150) — was already correct (uses d.Env)

🤖 Generated with Claude Code

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>
@mastermanas805 mastermanas805 merged commit 6f7c29e into master May 12, 2026
@mastermanas805 mastermanas805 deleted the env-aware-deployments-2026-05-12 branch May 12, 2026 05:24
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