fix(itest): broadcast org-root test seeds workspace_status 'online' not invalid 'running' #2111

Merged
devops-engineer merged 1 commits from fix/broadcast-itest-status-enum-online into main 2026-06-01 22:37:20 +00:00
Member

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 with status = 'running'. But workspace_status (enum created in 043_workspace_status_enum.up.sql, extended in 046) has no 'running' value — valid alive state is 'online'. Postgres rejects the seed INSERT at setup:

workspace_broadcast_org_root_integration_test.go:107: seed root: pq: invalid input value for enum workspace_status: "running"
--- FAIL: TestIntegration_BroadcastOrgRoot_NonRootSenderResolvesToRoot (0.01s)

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 registered docker-host:host (host-mode, no node) instead of docker-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 walks parent_id and ignores status — so 'online' (the canonical alive value) is both valid and semantically correct.

Phase 1 — Inventory

  • 3 occurrences, all the status literal in the seed INSERTs (lines 105/112/119). No other 'running' in the file. No product code changed — test-only.
  • Confirmed valid enum set against migrations 043 + 046: 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 in workspace_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.go so 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

## 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 with `status = 'running'`. But `workspace_status` (enum created in `043_workspace_status_enum.up.sql`, extended in `046`) has **no `'running'` value** — valid alive state is **`'online'`**. Postgres rejects the seed INSERT at setup: ``` workspace_broadcast_org_root_integration_test.go:107: seed root: pq: invalid input value for enum workspace_status: "running" --- FAIL: TestIntegration_BroadcastOrgRoot_NonRootSenderResolvesToRoot (0.01s) ``` ### 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 registered `docker-host:host` (host-mode, no node) instead of `docker-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 walks `parent_id` and ignores `status` — so `'online'` (the canonical alive value) is both valid and semantically correct. ## Phase 1 — Inventory - 3 occurrences, all the `status` literal in the seed INSERTs (lines 105/112/119). No other `'running'` in the file. No product code changed — test-only. - Confirmed valid enum set against migrations 043 + 046: `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 in `workspace_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.go` so 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](https://claude.com/claude-code)
devops-engineer added 1 commit 2026-06-01 21:39:04 +00:00
fix(itest): broadcast org-root test seeds workspace_status='online' not invalid 'running'
sop-tier-check / tier-check (pull_request_review) Successful in 3s
qa-review / approved (pull_request) Refired via /qa-recheck by unknown
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
CI / Detect changes (pull_request) Successful in 5s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 3s
E2E API Smoke Test / detect-changes (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 7s
CI / Python Lint & Test (pull_request) Successful in 11s
sop-checklist / review-refire (pull_request_target) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 4s
Harness Replays / detect-changes (pull_request) Successful in 9s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 9s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4
sop-checklist / na-declarations (pull_request) N/A: (none)
qa-review / approved (pull_request_target) Successful in 4s
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
security-review / approved (pull_request_target) Successful in 4s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
Harness Replays / Harness Replays (pull_request) Successful in 2s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 13s
E2E Chat / detect-changes (pull_request) Successful in 17s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 13s
sop-tier-check / tier-check (pull_request_target) Successful in 21s
CI / Canvas (Next.js) (pull_request) Successful in 20s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Chat / E2E Chat (pull_request) Successful in 15s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m16s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m11s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m31s
CI / Platform (Go) (pull_request) Successful in 3m58s
CI / all-required (pull_request) Successful in 1s
audit-force-merge / audit (pull_request_target) Successful in 4s
4135e6ee3b
The workspace_status enum (migrations 043/046) has no 'running' value;
valid alive state is 'online'. Seed INSERTs used 'running' -> pq rejects
it at setup, failing TestIntegration_BroadcastOrgRoot_NonRootSenderResolvesToRoot.
Masked until now because Handlers Postgres Integration kept failing at the
runner node/checkout step (ded docker-host:host). Status is irrelevant to the
org-root CTE (it walks parent_id); 'online' is the correct alive value.
Author
Member

Non-author note: #2111 is a 3-line test-only fix (status seed literal runningonline, 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-recheck

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-recheck
hongming-ceo-delegated approved these changes 2026-06-01 21:43:12 +00:00
hongming-ceo-delegated left a comment
Member

Approve under CTO authority. Test-only fix; verified valid enum value online vs migrations 043/046; Handlers Postgres Integration green on this PR; org-root CTE assertions unaffected by status. Unblocks main.

Approve under CTO authority. Test-only fix; verified valid enum value `online` vs migrations 043/046; Handlers Postgres Integration green on this PR; org-root CTE assertions unaffected by status. Unblocks main.
core-qa approved these changes 2026-06-01 22:29:12 +00:00
core-qa left a comment
Member

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.

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.
core-security approved these changes 2026-06-01 22:29:31 +00:00
core-security left a comment
Member

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.

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.
Author
Member

/qa-recheck /security-recheck

/qa-recheck /security-recheck
devops-engineer closed this pull request 2026-06-01 22:32:38 +00:00
devops-engineer reopened this pull request 2026-06-01 22:32:41 +00:00
devops-engineer merged commit a17c984c8d into main 2026-06-01 22:37:20 +00:00
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2111