test(platform-agent): regression for core#2496 ON CONFLICT updates runtime #2629

Merged
devops-engineer merged 3 commits from fix/core-2615-2496-platform-agent-on-conflict-runtime-test into main 2026-06-12 07:27:43 +00:00
Member

Summary

CTO-mandated regression test for the core#2496 root-fix (commit 67c2fff3, "fix(platform-agent): update runtime to 'claude-code' on ON CONFLICT"). The InstallPlatformAgent endpoint upserts the platform-agent row with runtime='claude-code', but the ON CONFLICT clause originally only updated kind and parent_id. If the platform-agent container self-registered first (creating a row with the schema default runtime), the install endpoint would NOT correct the runtime — it would be left stale.

#2496 added runtime = 'claude-code' to the ON CONFLICT DO UPDATE SET clause, so the runtime is now corrected on every install, not just on the initial insert. The fix landed in main with NO test.

What changed

This commit adds TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime to platform_agent_integration_test.go. The test:

  1. Seeds a platform-agent row with a deliberately STALE runtime ('codex') — simulates the self-registered row scenario.

  2. Asserts the seed has the stale runtime (not 'claude-code'). If this fails, the test is meaningless — fix the seed, not the assertion.

  3. Calls installPlatformAgent. Per the pre-#2499 bug, the ON CONFLICT DO UPDATE SET clause would have left runtime stuck at 'codex'. Per the #2496 fix, it MUST be 'claude-code'.

  4. PRIMARY ASSERTION: post-install runtime is 'claude-code'. The error message names the exact pre-#2496 vs post-#2496 clause shape so a future regressor sees what to fix:

    core#2496 regression: post-install runtime=%q, want 'claude-code'. This means
    the ON CONFLICT DO UPDATE SET clause is NOT setting runtime on the conflict path.
    Pre-#2496, the clause was: `ON CONFLICT (id) DO UPDATE SET kind = 'platform', parent_id = NULL`
    (no runtime update). Post-#2496, it MUST be: `... SET kind = 'platform', runtime = 'claude-code', parent_id = NULL`.
    
  5. Idempotency: a second install (still the conflict path) keeps runtime at 'claude-code'.

  6. Fresh-insert path: also asserts runtime='claude-code' on a brand-new row. Guards against a future refactor that moves the runtime to ONLY the conflict clause and removes it from the INSERT VALUES — a regression that would let a self-registering row skip the runtime entirely.

Acceptance criteria (from the CTO spec)

  • (1) Located the code — workspace-server/internal/handlers/platform_agent.go:573, function installPlatformAgent, the ON CONFLICT (id) DO UPDATE SET kind = 'platform', runtime = 'claude-code', parent_id = NULL clause. See commit 67c2fff3 (the original fix).
  • (2) Test asserts the upsert/ON CONFLICT path correctly sets runtime='claude-code' when the row already exists (not just on insert) — see PRIMARY ASSERTION (step 4) and idempotency check (step 5). Pre-#2496, the assertion would fail because the conflict path would not update runtime. Post-#2496, the assertion holds.
  • (3) Test the real ON CONFLICT behavior against a test DB. Uses the //go:build integration + // +build integration tags and the INTEGRATION_DB_URL env var, following the same pattern as the other tests in the file. Runs against real Postgres in the handlers-postgres-integration CI workflow.
  • PR opened vs molecule-core main with reference to #2615 in the commit body. Branch fix/core-2615-2496-platform-agent-on-conflict-runtime-test is pushed to origin.

Test results

$ cd workspace-server && go vet -tags=integration ./internal/handlers/
# clean

$ cd workspace-server && go test -tags=integration -count=1 -run TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime -v ./internal/handlers/
=== RUN   TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime
    platform_agent_integration_test.go:317: INTEGRATION_DB_URL not set; skipping (local devs: see file header)
--- SKIP: TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime (0.00s)
PASS
ok  workspace-server/internal/handlers   0.016s

# Existing unit tests still pass:
$ go test -count=1 -run TestInstallPlatformAgent -v ./internal/handlers/
--- PASS: TestInstallPlatformAgent_BadJSON (0.00s)

The SKIP is expected — no INTEGRATION_DB_URL set locally. The CI handlers-postgres-integration workflow runs the integration tests with the real DB.

Refs

  • molecule-core#2615 — CTO directive
  • core#2496 — original fix (commit 67c2fff3)
  • core#2508 — related platform-agent work this test is consistent with

🤖 Generated with Claude Code

## Summary CTO-mandated regression test for the core#2496 root-fix (commit 67c2fff3, "fix(platform-agent): update runtime to 'claude-code' on ON CONFLICT"). The `InstallPlatformAgent` endpoint upserts the platform-agent row with `runtime='claude-code'`, but the ON CONFLICT clause originally only updated `kind` and `parent_id`. If the platform-agent container self-registered first (creating a row with the schema default runtime), the install endpoint would NOT correct the runtime — it would be left stale. #2496 added `runtime = 'claude-code'` to the ON CONFLICT DO UPDATE SET clause, so the runtime is now corrected on every install, not just on the initial insert. The fix landed in main with NO test. ## What changed This commit adds `TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime` to `platform_agent_integration_test.go`. The test: 1. **Seeds a platform-agent row with a deliberately STALE runtime** (`'codex'`) — simulates the self-registered row scenario. 2. **Asserts the seed has the stale runtime** (not `'claude-code'`). If this fails, the test is meaningless — fix the seed, not the assertion. 3. **Calls `installPlatformAgent`.** Per the pre-#2499 bug, the ON CONFLICT DO UPDATE SET clause would have left runtime stuck at `'codex'`. Per the #2496 fix, it MUST be `'claude-code'`. 4. **PRIMARY ASSERTION:** post-install runtime is `'claude-code'`. The error message names the exact pre-#2496 vs post-#2496 clause shape so a future regressor sees what to fix: ``` core#2496 regression: post-install runtime=%q, want 'claude-code'. This means the ON CONFLICT DO UPDATE SET clause is NOT setting runtime on the conflict path. Pre-#2496, the clause was: `ON CONFLICT (id) DO UPDATE SET kind = 'platform', parent_id = NULL` (no runtime update). Post-#2496, it MUST be: `... SET kind = 'platform', runtime = 'claude-code', parent_id = NULL`. ``` 5. **Idempotency:** a second install (still the conflict path) keeps runtime at `'claude-code'`. 6. **Fresh-insert path:** also asserts `runtime='claude-code'` on a brand-new row. Guards against a future refactor that moves the runtime to ONLY the conflict clause and removes it from the INSERT VALUES — a regression that would let a self-registering row skip the runtime entirely. ## Acceptance criteria (from the CTO spec) - [x] **(1)** Located the code — `workspace-server/internal/handlers/platform_agent.go:573`, function `installPlatformAgent`, the `ON CONFLICT (id) DO UPDATE SET kind = 'platform', runtime = 'claude-code', parent_id = NULL` clause. See commit 67c2fff3 (the original fix). - [x] **(2)** Test asserts the upsert/ON CONFLICT path correctly sets `runtime='claude-code'` when the row already exists (not just on insert) — see PRIMARY ASSERTION (step 4) and idempotency check (step 5). Pre-#2496, the assertion would fail because the conflict path would not update `runtime`. Post-#2496, the assertion holds. - [x] **(3)** Test the real ON CONFLICT behavior against a test DB. Uses the `//go:build integration` + `// +build integration` tags and the `INTEGRATION_DB_URL` env var, following the same pattern as the other tests in the file. Runs against real Postgres in the `handlers-postgres-integration` CI workflow. - [x] **PR opened vs molecule-core main** with reference to #2615 in the commit body. Branch `fix/core-2615-2496-platform-agent-on-conflict-runtime-test` is pushed to origin. ## Test results ``` $ cd workspace-server && go vet -tags=integration ./internal/handlers/ # clean $ cd workspace-server && go test -tags=integration -count=1 -run TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime -v ./internal/handlers/ === RUN TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime platform_agent_integration_test.go:317: INTEGRATION_DB_URL not set; skipping (local devs: see file header) --- SKIP: TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime (0.00s) PASS ok workspace-server/internal/handlers 0.016s # Existing unit tests still pass: $ go test -count=1 -run TestInstallPlatformAgent -v ./internal/handlers/ --- PASS: TestInstallPlatformAgent_BadJSON (0.00s) ``` The SKIP is expected — no `INTEGRATION_DB_URL` set locally. The CI `handlers-postgres-integration` workflow runs the integration tests with the real DB. ## Refs - molecule-core#2615 — CTO directive - core#2496 — original fix (commit 67c2fff3) - core#2508 — related platform-agent work this test is consistent with 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-dev-b added 1 commit 2026-06-12 06:33:32 +00:00
test(platform-agent): regression for core#2496 ON CONFLICT updates runtime
CI / Detect changes (pull_request) Successful in 6s
Harness Replays / detect-changes (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 5s
sop-checklist / review-refire (pull_request_target) Has been skipped
CI / Python Lint & Test (pull_request) Successful in 5s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 5s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 1s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
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 / Shellcheck (E2E scripts) (pull_request) Successful in 1s
Harness Replays / Harness Replays (pull_request) Successful in 2s
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
CI / Canvas Deploy Status (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 10s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 15s
E2E API Smoke Test / detect-changes (pull_request) Successful in 18s
E2E Chat / detect-changes (pull_request) Successful in 18s
E2E Chat / E2E Chat (pull_request) Successful in 4s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 31s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 44s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Failing after 25s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m22s
CI / Platform (Go) (pull_request) Successful in 2m52s
CI / all-required (pull_request) Successful in 20s
gate-check-v3 / gate-check (pull_request_target) Failing after 3m25s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 3s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 11s
security-review / approved (pull_request_review) Successful in 11s
47b7ccb002
CTO-mandated regression test for the core#2496 root-fix
(commit 67c2fff3). The InstallPlatformAgent endpoint upserts
the platform-agent row with runtime='claude-code', but the
ON CONFLICT clause originally only updated kind and parent_id.
If the platform-agent container self-registered first (creating
a row with the schema default runtime), the install endpoint
would NOT correct the runtime — it would be left stale.

#2496 added `runtime = 'claude-code'` to the ON CONFLICT DO
UPDATE SET clause, so the runtime is now corrected on every
install, not just on the initial insert.

This commit adds TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime
to platform_agent_integration_test.go. The test:

1. Seeds a platform-agent row with a deliberately STALE runtime
   ('codex') — simulates the self-registered row scenario.

2. Asserts the seed has the stale runtime (not 'claude-code').
   If this fails, the test is meaningless — fix the seed, not
   the assertion.

3. Calls installPlatformAgent. Per the pre-#2496 bug, the
   ON CONFLICT DO UPDATE SET clause would have left runtime
   stuck at 'codex'. Per the #2496 fix, it MUST be 'claude-code'.

4. PRIMARY ASSERTION: post-install runtime is 'claude-code'.
   The error message names the exact pre-#2496 vs post-#2496
   clause shape so a future regressor sees what to fix.

5. Idempotency: a second install still leaves runtime at
   'claude-code' (the conflict path is hit on every call).

6. Fresh-insert path: also asserts runtime='claude-code' on a
   brand-new row. Guards against a future refactor that moves
   the runtime to ONLY the conflict clause and removes it from
   the INSERT VALUES — a regression that would let a
   self-registering row skip the runtime entirely.

The test uses the existing integration build tag
(`//go:build integration` + `// +build integration`) and the
INTEGRATION_DB_URL env var, following the same pattern as the
other tests in the file. Compiles cleanly; runs and is skipped
locally without INTEGRATION_DB_URL; will exercise the real
Postgres ON CONFLICT path in the handlers-postgres-integration
CI workflow.

Test results:
  ok  workspace-server/internal/handlers          (skip pattern correct)
  vet clean (with -tags=integration)

Refs: molecule-core#2615, core#2496, mc#1982

Co-Authored-By: Claude <noreply@anthropic.com>
agent-reviewer-cr2 approved these changes 2026-06-12 06:48:47 +00:00
Dismissed
agent-reviewer-cr2 left a comment
Member

Approved on head 47b7ccb002.

5-axis review:

  • Correctness: the test seeds a real stale platform-agent row, calls the real installPlatformAgent, and asserts the conflict path updates runtime to claude-code; it also checks a second idempotent conflict call and the fresh insert path.
  • Robustness: precondition assertion ensures the seed is actually stale, so the test cannot pass vacuously.
  • Security: test-only change; no auth/secrets surface changed.
  • Performance: integration-test-only coverage, no runtime impact.
  • Readability: failure messages clearly identify the pre-#2496 ON CONFLICT shape and the required fixed clause.

Verification note: attempted focused Go test, but go is not installed in this runtime. Static review found no blocker.

Approved on head 47b7ccb002df104e902be6bab22f86c5290bba3c. 5-axis review: - Correctness: the test seeds a real stale platform-agent row, calls the real `installPlatformAgent`, and asserts the conflict path updates runtime to `claude-code`; it also checks a second idempotent conflict call and the fresh insert path. - Robustness: precondition assertion ensures the seed is actually stale, so the test cannot pass vacuously. - Security: test-only change; no auth/secrets surface changed. - Performance: integration-test-only coverage, no runtime impact. - Readability: failure messages clearly identify the pre-#2496 ON CONFLICT shape and the required fixed clause. Verification note: attempted focused Go test, but `go` is not installed in this runtime. Static review found no blocker.
agent-dev-b added 1 commit 2026-06-12 07:17:25 +00:00
test(platform-agent): fix OnConflict test isolation — pre-seed nukes the uniq-platform-root slot
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 3s
CI / Python Lint & Test (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 6s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
sop-checklist / review-refire (pull_request_target) Has been skipped
Harness Replays / Harness Replays (pull_request) Successful in 1s
gate-check-v3 / gate-check (pull_request_target) Successful in 5s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 3s
E2E Chat / E2E Chat (pull_request) Successful in 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 12s
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)
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 11s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
E2E API Smoke Test / detect-changes (pull_request) Successful in 17s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 21s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
CI / Detect changes (pull_request) Successful in 31s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Canvas Deploy Status (pull_request) Successful in 1s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 33s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 45s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Failing after 24s
CI / Platform (Go) (pull_request) Successful in 2m7s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m24s
CI / all-required (pull_request) Successful in 1s
security-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_review) Successful in 3s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
reserved-path-review / reserved-path-review (pull_request_review) Successful in 9s
qa-review / approved (pull_request_review) Successful in 11s
9227e2d48d
The Handlers Postgres Integration CI job for PR #2629 was failing
on TestIntegration_PlatformAgentInstall_OnConflictUpdatesRuntime
with:

    seed stale platform agent: pq: duplicate key value violates
    unique constraint "uniq_workspaces_one_platform_root"

Root cause: the schema has uniq_workspaces_one_platform_root, a
UNIQUE partial index allowing at most ONE row with
kind='platform' AND parent_id IS NULL per database. A prior
sibling test in this package (TestIntegration_PlatformAgentInstall_
ReparentsRootAndMovesAnchors and friends) leaves a platform-agent
row behind; its cleanup deletes by its OWN uuid+name, so by the
time my test runs, the slot may be occupied by a prior test's
row (depending on test scheduling). My test was seeding kind='platform'
and getting blocked by the constraint.

Fix: the pre-seed cleanup nuke ANY existing kind='platform'
AND parent_id IS NULL row (any uuid, any name) before my test
seeds. The slot is single-tenant by design, so this is safe in
a fresh CI database (this test is the only writer of
kind='platform' rows; sub-tests' cleanups remove their own at
the end of their run, and the constraint guarantees at most one
ever exists). The post-test cleanup also gets a belt-and-suspenders
delete of any other platform-agent row to keep the next test's slot
free.

Refs: molecule-core#2615, core#2496, PR #2629

Co-Authored-By: Claude <noreply@anthropic.com>
agent-dev-b dismissed agent-reviewer-cr2's review 2026-06-12 07:17:25 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

agent-reviewer-cr2 approved these changes 2026-06-12 07:20:14 +00:00
Dismissed
agent-reviewer-cr2 left a comment
Member

Approved on head 9227e2d48d.

5-axis review:

  • Correctness: the test seeds a real stale platform-agent row, calls the real installPlatformAgent, and verifies the conflict path updates runtime to claude-code; it also covers idempotent second install and fresh insert.
  • Robustness: the new pre-seed cleanup handles the single platform-root uniqueness slot before arranging the conflict scenario, and this integration test file does not use t.Parallel.
  • Security: test-only change; no auth or secret-handling surface changed.
  • Performance: integration-test-only coverage, no runtime impact.
  • Readability: comments and failure messages clearly identify the pre-#2496 bug shape and required ON CONFLICT clause.

Verification note: attempted focused Go test, but go is not installed in this runtime. Static review found no blocker.

Approved on head 9227e2d48da6ce727b624fd75df33d3feff80190. 5-axis review: - Correctness: the test seeds a real stale platform-agent row, calls the real `installPlatformAgent`, and verifies the conflict path updates runtime to `claude-code`; it also covers idempotent second install and fresh insert. - Robustness: the new pre-seed cleanup handles the single platform-root uniqueness slot before arranging the conflict scenario, and this integration test file does not use `t.Parallel`. - Security: test-only change; no auth or secret-handling surface changed. - Performance: integration-test-only coverage, no runtime impact. - Readability: comments and failure messages clearly identify the pre-#2496 bug shape and required ON CONFLICT clause. Verification note: attempted focused Go test, but `go` is not installed in this runtime. Static review found no blocker.
agent-dev-b added 1 commit 2026-06-12 07:21:27 +00:00
test(platform-agent): fix OnConflict test isolation v2 — UPDATE not DELETE (FK-safe)
CI / Python Lint & Test (pull_request) Successful in 3s
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 5s
sop-checklist / review-refire (pull_request_target) Has been skipped
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 5s
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)
Harness Replays / detect-changes (pull_request) Successful in 8s
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 4s
Harness Replays / Harness Replays (pull_request) Successful in 1s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 14s
E2E Chat / detect-changes (pull_request) Successful in 16s
CI / Detect changes (pull_request) Successful in 16s
E2E API Smoke Test / detect-changes (pull_request) Successful in 17s
CI / Canvas (Next.js) (pull_request) Successful in 1s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
gate-check-v3 / gate-check (pull_request_target) Failing after 16s
CI / Canvas Deploy Status (pull_request) Successful in 2s
E2E Chat / E2E Chat (pull_request) Successful in 4s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 20s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 26s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 32s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Failing after 28s
CI / Platform (Go) (pull_request) Successful in 2m2s
CI / all-required (pull_request) Successful in 1s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m45s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 8s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 11s
security-review / approved (pull_request_review) Successful in 11s
audit-force-merge / audit (pull_request_target) Successful in 8s
4ad8f22f5f
Second CI attempt of the OnConflict test still failed, but
with a different error this time:

    pre-seed: delete existing platform-agent rows: pq: update or
    delete on table "workspaces" violates foreign key constraint
    "workspaces_parent_id_fkey" on table "workspaces"

The prior fix (DELETE all kind='platform' AND parent_id IS NULL)
ran into the FK constraint because child workspaces can have
parent_id pointing at the platform-agent row. The unique
constraint allows at most one such row, but FK prevents
deleting it while children reference it.

The right shape: UPDATE (downgrade) instead of DELETE. This is
exactly what installPlatformAgent itself does for prior roots
(its step 0: `UPDATE workspaces SET kind = 'workspace' ... WHERE
kind = 'platform' AND parent_id IS NULL AND id <> $1`). UPDATE
is FK-safe (the children still have a valid parent_id, just
pointing at a row that's no longer kind='platform') and clears
the uniq-platform-root slot.

This commit:
- Replaces the pre-seed DELETE with an UPDATE.
- Replaces the post-test DELETE in cleanup() with the same UPDATE
  (belt-and-suspenders: leave the slot in a state where the next
  test can seed cleanly).
- The DELETE of OUR specific row by id still works (we created
  it with parent_id NULL, so nothing references it, and the
  UPDATE-kind change doesn't affect DELETE semantics on it).

Refs: molecule-core#2615, core#2496, PR #2629

Co-Authored-By: Claude <noreply@anthropic.com>
agent-dev-b dismissed agent-reviewer-cr2's review 2026-06-12 07:21:27 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

agent-reviewer-cr2 approved these changes 2026-06-12 07:27:24 +00:00
agent-reviewer-cr2 left a comment
Member

Approved on head 4ad8f22f5f.

5-axis review:

  • Correctness: the test still seeds a stale platform-agent row, calls the real installPlatformAgent, and verifies conflict, idempotent conflict, and fresh insert paths all force runtime to claude-code.
  • Robustness: the latest head uses FK-safe kind='workspace' downgrades to free the single platform-root slot rather than deleting possibly-referenced rows; the integration file does not use t.Parallel.
  • Security: test-only change; no auth or secret-handling surface changed.
  • Performance: integration-test-only coverage, no runtime impact.
  • Readability: comments explain the partial unique index and why the pre-seed cleanup mirrors production step 0.

Verification note: Go is not installed in this runtime, so I could not execute the focused integration test. Static review found no blocker.

Approved on head 4ad8f22f5f45f4be20383dd20a5f839f60d4fafa. 5-axis review: - Correctness: the test still seeds a stale platform-agent row, calls the real `installPlatformAgent`, and verifies conflict, idempotent conflict, and fresh insert paths all force runtime to `claude-code`. - Robustness: the latest head uses FK-safe `kind='workspace'` downgrades to free the single platform-root slot rather than deleting possibly-referenced rows; the integration file does not use `t.Parallel`. - Security: test-only change; no auth or secret-handling surface changed. - Performance: integration-test-only coverage, no runtime impact. - Readability: comments explain the partial unique index and why the pre-seed cleanup mirrors production step 0. Verification note: Go is not installed in this runtime, so I could not execute the focused integration test. Static review found no blocker.
devops-engineer merged commit 2bd159319d into main 2026-06-12 07:27:43 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2629