test(matrix): W4 stacks-advanced block integration suite (move exempt→mapped)#256
Merged
mastermanas805 merged 2 commits intoJun 5, 2026
Merged
Conversation
…→mapped) Close the eight /api/v1/stacks/:slug/* advanced routes carried as routeCoverageExemptions in the done-bar guard, moving them exempt→mapped with a DB-backed handler-integration suite: POST/DELETE /api/v1/stacks/:slug/confirm-deletion (tokenized two-step delete) POST /api/v1/stacks/:slug/promote (env-promote approval gate) GET /api/v1/stacks/:slug/family (Pro-gated env-family read) POST/GET /api/v1/stacks/:slug/domains (custom-domain add/list) POST /api/v1/stacks/:slug/domains/:id/verify DELETE /api/v1/stacks/:slug/domains/:id New suite internal/handlers/stacks_advanced_block_integration_test.go drives each route through the production RequireAuth + /api/v1 group (newStacksAdvancedApp mirrors router.go) against a real Postgres (testhelpers.SetupTestDB). Asserts the real contract per handler (rule 16): confirm-deletion is tokenized + single-use (410 replay, 410 cross-team token); promote validates env (invalid_env/invalid_target/env_mismatch) and short- circuits a non-dev target to 202 pending_approval + a promote_approvals row before any compute; family stamps Cache-Control: private, max-age=60; domains create→list→verify(TXT seam)→delete round-trips + per-count/feature tier gates. Plus the authz axes: owner+member (same team_id) 2xx, non-member cross-team 404 (never 403), unauth 401, off-tier 402. The external DNS/cert-manager ingress+ cert legs need a live k8s and are asserted only up to the verified state (k8s nil) — deferred to the W4 custom-domain e2e spec. No handler-source edits; no helper redefined. PATCH /stacks/:slug/env stays exempt (out of this scope). Both done-bar guards green (TestDoneBar_EveryRouteCovered + TestDoneBar_TestMapPointsAtRealTests). mapped 98→106, exempt 73→65. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Closes the eight
/api/v1/stacks/:slug/*stacks-advanced routes that were carried asrouteCoverageExemptionsin the done-bar guard, moving them exempt→mapped with a real DB-backed integration suite.POST /api/v1/stacks/:slug/confirm-deletionTestStacksAdvancedBlock_ConfirmDelete_TokenizedTwoStepDELETE /api/v1/stacks/:slug/confirm-deletionTestStacksAdvancedBlock_ConfirmDelete_MissingTokenAndCancelPOST /api/v1/stacks/:slug/promoteTestStacksAdvancedBlock_Promote_ApprovalGateAndAuthz(+_ContractValidation)GET /api/v1/stacks/:slug/familyTestStacksAdvancedBlock_Family_HappyAuthzAndCachePOST /api/v1/stacks/:slug/domainsTestStacksAdvancedBlock_Domains_FullLifecycleGET /api/v1/stacks/:slug/domainsTestStacksAdvancedBlock_Domains_FullLifecyclePOST /api/v1/stacks/:slug/domains/:id/verifyTestStacksAdvancedBlock_Domains_FullLifecycleDELETE /api/v1/stacks/:slug/domains/:idTestStacksAdvancedBlock_Domains_TierGateAndCrossTeamRowHow
New
internal/handlers/stacks_advanced_block_integration_test.godrives every route through the production auth chain (RequireAuth+ the/api/v1group;newStacksAdvancedAppmirrorsrouter.go) against a real Postgres (testhelpers.SetupTestDB). Reuses existing helpers (requireTestDB,ensureStackTables,mustUUIDStr,MustCreateTeamDB/MustSignSessionJWT,models.CreateStack/CreatePendingDeletion/CreateCustomDomain, theSetLookupTXTForTestseam) — nothing redefined, no handler-source edits.Real contract per handler (rule 16):
POST ?tokenCASes apending_deletionsrow toconfirmedand tears the stack down (single-use → 410 replay; cross-team token → 410);DELETEcancels (session is auth) →cancelled.invalid_env/invalid_target/env_mismatch) and short-circuits a non-dev target to202 pending_approval+ apromote_approvalsrow before any compute.Cache-Control: private, max-age=60.pending_verification→verified)→delete round-trips + the per-count/feature tier gates fromplans.Registry.Authz axes: owner + member (same
team_id) 2xx, non-member cross-team 404 (never 403), unauth 401, off-tier (hobby) 402.The external DNS / cert-manager ingress+cert legs need a live k8s and are asserted only up to the
verifiedstate (k8s nil) — deferred to the W4 custom-domain e2e spec, but the routes are mapped.PATCH /stacks/:slug/envstays exempt (out of this PR's scope).Guard state
Both done-bar guards green (
TestDoneBar_EveryRouteCovered+TestDoneBar_TestMapPointsAtRealTests). mapped 98→106, exempt 73→65.Gate
make gategreen except the pre-existing non-deterministicTestLinkGitHubIDflake ininternal/models(untouched package; verified identical on cleanorigin/masterwith these files stashed). My packages (internal/handlers,internal/router) pass. CI is authoritative.🤖 Generated with Claude Code