test(ci): deploy-failure auto-debug path + anon-stack gap + with_failed_deploy factory (#70)#269
Merged
Merged
Conversation
…ed_deploy factory (#70) Failure-diagnosis CI integration tests for the deploy-failure AUTO-DEBUG PATH (docs/ci/02-FAILURE-DIAGNOSIS-AND-AUTODEBUG.md §5), api side. 1. Auto-debug PATH integration test (deploy_autodebug_path_test.go): seeds a status=failed deployment + an older lifecycle row + a failure_autopsy deployment_events row (reason/exit_code/last_lines/ hint) against a real test DB, then asserts the full agent debug loop as ONE coherent contract: - GET /api/v1/deployments/:id → status=failed + non-empty error_message (the one-line cause) - GET /api/v1/deployments/:id/events → autopsy with reason + non-empty last_lines + hint, newest-first, count correct - auth-negative: no/invalid bearer → 401 - cross-team: another team's token → 404 (no existence leak) 2. Anonymous-stack failure-diagnosis contract (stack_anon_failure_diag_ test.go): drives an anon stack (NULL team_id) to failed, asserts GET /stacks/:slug (slug-bearer, no auth) returns status=failed and the raw build error is persisted on the service row, then PINS the documented gap by enumerating the LIVE router (router.New + GetRoutes) and asserting NO /stacks/:slug/events route exists. Adding a stack-autopsy endpoint later reds this test deliberately. Anon failure-diagnosis is status + logs only (no classified autopsy). 3. with_failed_deploy factory flag (internal_e2e_account.go): cohort- only, inert-by-default pre-seed of ONE failed deployment + ONE failure_autopsy event via the production deploy models (CreateDeployment → UpdateDeploymentStatus → UpsertDeploymentAutopsy), surfaced as failed_deploy_id, reaped with the team. Lets the web wave load /app/deployments/:id and render the FailureAutopsyPanel against a real backend. Tests: seeds exactly one failed deploy + one autopsy with the factory payload; omitting seeds none; seam-driven seed_failed 503; whitebox sqlmock coverage of all three seed error branches. The producer↔consumer schema parity (worker autopsy write ↔ api /events read) is asserted in the worker PR's deploy_failure_autopsy_schema_ parity_test.go (cross-referenced). make gate: green except pre-existing local-only flakes outside this diff (internal/models/TestLinkGitHubID DB-pollution, handlers TestQueue_CredIssueError NATS flake). CI (fresh DB, Go 1.25) is authoritative. New tests + donebar/manner-matrix/error-envelope guards all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
Cross-ref: worker producer↔consumer schema-parity PR is InstaNode-dev/worker#96. The api /events read surface here + the worker autopsy write there are asserted schema-compatible by worker#96's TestAutopsySchemaParity_* (last_lines encoding + column set). |
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.
Failure-diagnosis CI integration tests for the deploy-failure AUTO-DEBUG PATH, api side (task #70, source
docs/ci/02-FAILURE-DIAGNOSIS-AND-AUTODEBUG.md §5). Cross-referenced with the worker PR (producer↔consumer schema parity).What this adds
1. Auto-debug PATH integration test —
deploy_autodebug_path_test.goSeeds a
status=faileddeployment + an olderlifecyclerow + afailure_autopsydeployment_eventsrow (reason/exit_code/last_lines/hint) against a real test DB, then asserts the full agent debug loop as ONE coherent contract:GET /api/v1/deployments/:id→status=failed+ non-emptyerror_messageGET /api/v1/deployments/:id/events→ autopsy withreason+ non-emptylast_lines+hint, newest-first, count correct2. Anonymous-stack failure-diagnosis contract —
stack_anon_failure_diag_test.goDrives an anon stack (NULL
team_id) tofailed; assertsGET /stacks/:slug(slug-bearer, no auth) returnsstatus=failedand the raw build error is persisted on the service row. Pins the documented gap: enumerates the LIVE router (router.New+GetRoutes) and asserts NO/stacks/:slug/eventsroute exists. Anon failure-diagnosis is status + logs only (no classified autopsy) — adding a stack-autopsy endpoint later reds this test deliberately.3.
with_failed_deployfactory flag —internal_e2e_account.goCohort-only, inert-by-default pre-seed of ONE failed deployment + ONE
failure_autopsyevent via the production deploy models (CreateDeployment→UpdateDeploymentStatus→UpsertDeploymentAutopsy), surfaced asfailed_deploy_id, reaped with the team. Lets the web wave load/app/deployments/:idand render theFailureAutopsyPanelagainst a real backend (not a mock).Tests: seeds exactly one failed deploy + one autopsy with the factory payload; omitting seeds none; seam-driven
seed_failed503; whitebox sqlmock coverage of all three seed error branches.Factory contract (for the web agent)
POST /internal/e2e/accountbody{"tier":"pro","with_failed_deploy":true}→ response includesfailed_deploy_id. Navigate to/app/deployments/<failed_deploy_id>orGET /api/v1/deployments/<failed_deploy_id>{,/events}.Gates
make gategreen except two pre-existing local-only flakes OUTSIDE this diff (internal/models/TestLinkGitHubIDshared-DB pollution;handlers/TestQueue_CredIssueError_FallsBackToLegacyOpenNATS flake) — both in untouched packages. CI (fresh DB, Go 1.25) is authoritative. New tests + donebar / manner-matrix / error-envelope guards all pass.🤖 Generated with Claude Code