Compare commits

...

1 Commits

Author SHA1 Message Date
Molecule AI Dev Engineer A (Kimi) 975ccb2d32 test(integration): pre-clean BroadcastOrgRoot fixtures to avoid unique-index collision
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 7s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
CI / Detect changes (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
E2E Chat / detect-changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 7s
sop-checklist / review-refire (pull_request_target) Has been skipped
gate-check-v3 / gate-check (pull_request_target) Successful in 4s
qa-review / approved (pull_request_target) Failing after 4s
security-review / approved (pull_request_target) Failing after 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 9s
E2E API Smoke Test / detect-changes (pull_request) Successful in 13s
Harness Replays / detect-changes (pull_request) Successful in 10s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 9s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
CI / Canvas (Next.js) (pull_request) Successful in 1s
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
E2E Chat / E2E Chat (pull_request) Successful in 2s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 13s
sop-tier-check / tier-check (pull_request_target) Successful in 4s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Harness Replays / Harness Replays (pull_request) Successful in 1s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 6s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 12s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 8s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 55s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m10s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m27s
audit-force-merge / audit (pull_request_target) Has been skipped
CI / Platform (Go) (pull_request) Successful in 3m57s
CI / all-required (pull_request) Successful in 1s
Adds pre-test DELETE + defensive index creation to
TestIntegration_BroadcastOrgRoot_NonRootSenderResolvesToRoot so a
prior crashed run (or stale shared DB) does not leave rows that
 collide on workspaces_parent_name_uniq.

Does not touch production logic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 04:08:10 +00:00
@@ -70,6 +70,19 @@ func integrationDB_BroadcastOrgRoot(t *testing.T) *sql.DB {
t.Fatalf("ping: %v", err)
}
t.Cleanup(func() { conn.Close() })
// Defensive: ensure the partial-unique index exists so the test
// exercises real constraint behaviour (not a silently-missing index).
if _, err := conn.ExecContext(context.Background(), `
CREATE UNIQUE INDEX IF NOT EXISTS workspaces_parent_name_uniq
ON workspaces (
COALESCE(parent_id, '00000000-0000-0000-0000-000000000000'::uuid),
name
)
WHERE status != 'removed'
`); err != nil {
t.Fatalf("ensure constraint: %v", err)
}
return conn
}
@@ -88,6 +101,13 @@ func TestIntegration_BroadcastOrgRoot_NonRootSenderResolvesToRoot(t *testing.T)
ctx := context.Background()
prefix := fmt.Sprintf("itest-bcastroot-%s", uuid.New().String()[:8])
// Pre-test cleanup: remove any stale rows left by a prior crashed run
// so the fixture INSERTs below don't hit the partial-unique index.
if _, err := conn.ExecContext(ctx,
`DELETE FROM workspaces WHERE name LIKE $1`, prefix+"%"); err != nil {
t.Logf("pre-test cleanup (non-fatal): %v", err)
}
t.Cleanup(func() {
if _, err := conn.ExecContext(ctx,
`DELETE FROM workspaces WHERE name LIKE $1`, prefix+"%"); err != nil {