fix(itest): broadcast org-root test seeds workspace_status 'online' not invalid 'running' #2111
Reference in New Issue
Block a user
Delete Branch "fix/broadcast-itest-status-enum-online"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix a broken integration test on main that is currently failing the Handlers Postgres Integration required check for every molecule-core PR.
workspace_broadcast_org_root_integration_test.go(added by #2105, the #1959 fix) seeds its 3-level org chain withstatus = 'running'. Butworkspace_status(enum created in043_workspace_status_enum.up.sql, extended in046) has no'running'value — valid alive state is'online'. Postgres rejects the seed INSERT at setup:Why it surfaced now
The test was masked since it landed: the Handlers Postgres Integration job kept failing earlier, at the runner checkout step (
Cannot find node in PATH), because the dedicated CI runners registereddocker-host:host(host-mode, no node) instead ofdocker-host:docker://<image>. With the runner registration fixed, the integration job runs for the first time in a while and the bad enum literal surfaces. The enum-drift gate (internal/db/workspace_status_enum_drift_test.go) only scans non-test Go, so it never caught the test-file literal.The fix
Replace
'running'→'online'in the 3 seed INSERTs (root/mid/leaf). Status is irrelevant to what the test asserts — the org-root CTE walksparent_idand ignoresstatus— so'online'(the canonical alive value) is both valid and semantically correct.Phase 1 — Inventory
statusliteral in the seed INSERTs (lines 105/112/119). No other'running'in the file. No product code changed — test-only.provisioning, online, offline, degraded, failed, removed, paused, hibernated, awaiting_agent, hibernating.'running'is not among them;'online'is the "heartbeat fresh + healthy" state.Testing
The Handlers Postgres Integration CI context on this PR IS the gate — it executes the seed against real Postgres and runs the org-root CTE assertions (root/mid/leaf → true root). Pre-fix it failed at seed; post-fix the seed succeeds and the #1959 assertions run.
SOP checklist
Comprehensive testing performed: the change is test-only (3 status literals). Validation is the Handlers Postgres Integration required CI context on this PR, which executes the verbatim seed + org-root CTE against real Postgres. Pre-fix:
pq: invalid input value for enum workspace_status: "running"at seed (0.01s). Post-fix: seed succeeds, root/mid/leaf assertions execute. No product code touched, so no unit-suite impact.Local-postgres E2E run: the Handlers Postgres Integration job is the local-postgres gate (path filter covers
workspace-server/internal/handlers/**); it runs the real-Postgres seed+CTE. Not run on a separate workstation DB — the CI context is the authoritative real-Postgres execution.Staging-smoke verified or pending: N/A — test-only change, no handler logic, no schema, no migration, no write path. Nothing to smoke in staging.
Root-cause not symptom: root cause is an invalid enum literal in the seed (
'running'never existed inworkspace_status), not a flake or a cleanup race. Fix uses the correct valid value'online', not a band-aid (e.g. not loosening the enum or swallowing the error). Follow-up filed-worthy: extend the enum-drift gate to scan_test.goso future bad literals are caught at unit time.Five-Axis review walked: correctness (verified enum set vs migrations 043/046;
'online'valid; CTE ignores status so assertions unaffected); readability (3-line literal change, no logic); architecture (test-only, no production path); security (none — does not touch the OFFSEC-015 org-isolation logic #2105 fixed); performance (none).No backwards-compat shim / dead code added: confirmed — straight literal replacement, no shim, no dead code.
Memory/saved-feedback consulted: yes —
feedback_pr_ci_green_not_main_green(this is exactly a main-only failure the PR-head run didn't exhibit; the integration job had been masked);feedback_verify_real_artifact_not_proxy_metric(read the real CI log + the enum migrations rather than trusting the "duplicate-key" red herring in the surrounding output).Unblocks the Handlers Postgres Integration required check on molecule-core main.
🤖 Generated with Claude Code
Non-author note: #2111 is a 3-line test-only fix (status seed literal
running→online, valid per workspace_status enum migrations 043/046). The org-root CTE ignores status, so the #1959 assertions are unaffected. Handlers Postgres Integration check is GREEN on this PR. /qa-recheck /security-recheckApprove under CTO authority. Test-only fix; verified valid enum value
onlinevs migrations 043/046; Handlers Postgres Integration green on this PR; org-root CTE assertions unaffected by status. Unblocks main.QA approved (#2111). Test-only change: broadcast org-root integration seed status literal running->online, valid per workspace_status enum (migrations 043/046). The org-root CTE walks parent_id and ignores status, so #1959 assertions are unaffected; Handlers Postgres Integration + Platform(Go) green on this PR. No product code touched.
Security approved (#2111). Test-only change; ZERO security surface — no product/auth/handler code touched. Does not alter the OFFSEC-015 org-isolation logic that #2105 fixed. Seed status literal corrected to a valid enum value; org-root CTE ignores status. CI green.
/qa-recheck /security-recheck