Files
molecule-core/workspace-server
core-devops 03cee314ba
CI / Canvas Deploy Reminder (pull_request) Blocked by required conditions
E2E API Smoke Test / E2E API Smoke Test (pull_request) Blocked by required conditions
E2E Chat / E2E Chat (pull_request) Blocked by required conditions
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Blocked by required conditions
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Blocked by required conditions
Harness Replays / Harness Replays (pull_request) Blocked by required conditions
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Waiting to run
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Blocked by required conditions
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
Check migration collisions / Migration version collision check (pull_request) Successful in 10s
CI / Detect changes (pull_request) Successful in 6s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 20s
CI / Platform (Go) (pull_request) Successful in 4m15s
E2E API Smoke Test / detect-changes (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 5s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 10s
CI / Canvas (Next.js) (pull_request) Successful in 5m39s
E2E Staging SaaS (full lifecycle) / E2E Staging SaaS (pull_request) Has been skipped
Handlers Postgres Integration / detect-changes (pull_request) Successful in 4s
Harness Replays / detect-changes (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 4s
E2E Staging SaaS (full lifecycle) / pr-validate (pull_request) Successful in 31s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 9s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
gate-check-v3 / gate-check (pull_request) Successful in 4s
qa-review / approved (pull_request) Successful in 3s
security-review / approved (pull_request) Failing after 4s
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request) Successful in 3s
sop-checklist / review-refire (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request) Successful in 5s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m0s
CI / Python Lint & Test (pull_request) Successful in 6m54s
CI / all-required (pull_request) Successful in 6m57s
E2E Staging External Runtime / E2E Staging External Runtime (pull_request) Successful in 5m20s
audit-force-merge / audit (pull_request) Successful in 6s
chore(workspace-server): drop dead runtime_image_pins migration (closes #335, supersedes #1608)
Empirical finding (a6e3ff018, 2026-05-20): molecule-core's
runtime_image_pins table (mig 047) has never had a writer in any repo.
The reader at handlers/runtime_image_pin.go has been hitting
sql.ErrNoRows on every workspace provision since mig 047 landed,
silently falling through to the :latest path. CP's parallel table
(CP mig 027) is the de-facto and only SSOT — it has the writer
(POST /cp/admin/runtime-image/promote), the reader, the hard-gate
(RFC internal#541 Step 2), seeded post-suspension digests (CP mig 028),
and the admin endpoints.

This PR ratifies that reality.

Note: this is a fresh rebase against current main (tip f17375a9).
PR #1608 was cut from a base before #1585 (RFC#596 Phase 2 dual-push)
landed, so merging it would silently revert the publish-runtime.yml
Gitea-PyPI-primary path. Sub-agent a5521785 flagged this on PR #1608
comment 41389. The substantive Go logic is identical to PR #1608;
the only difference is the base.

What

- Add 20260520120000_drop_runtime_image_pins.up.sql / .down.sql to drop
  the unused table. Care zone PRESERVED: workspaces.runtime_image_digest
  column + its partial index untouched (earmarked for a future
  stale-workspace panel per RFC internal#617 §3).
- Delete handlers/runtime_image_pin.go (the dead reader) +
  handlers/runtime_image_pin_test.go.
- handlers/workspace_provision.go: replace
  resolveRuntimeImage(ctx, payload.Runtime) with Image: "" (the dead
  reader was already returning "" on every call). Rewire the
  surviving db.DB.QueryRow on this call site to QueryRowContext so
  the provision-timeout ctx stays load-bearing.
- Doc comments in provisioner/provisioner.go + provisioner/registry.go
  updated to point at CP as the SSOT instead of the dead local table.
- Add db/migration_20260520_drop_runtime_image_pins_test.go — static-
  file pin that up.sql DROPs runtime_image_pins, does NOT touch the
  care-zone column / index, and that the dead reader files cannot be
  re-added without failing the test.
- Hygiene: prune the now-stranded
  mock.ExpectQuery("SELECT digest FROM runtime_image_pins") rows in
  handlers/handlers_test.go and handlers/workspace_provision_test.go
  (the dead reader is gone, so the mock expectation can never fire).
  Provisioner test comment updated to reflect CP-as-SSOT.

Why

Two parallel-named tables with structurally incompatible schemas, only
one ever written — that is exactly the kind of internal drift
feedback_no_single_source_of_truth was written about for non-vendor
surfaces. The deletion is reversible (down.sql recreates the table)
and the only behavior change is "ctx is now propagated into the
workspace_dir DB lookup", which is a small correctness nudge.

Verification

- [x] go vet ./internal/handlers/... ./internal/db/... ./internal/provisioner/...  — clean
- [x] go build ./...  — clean
- [x] go test ./internal/handlers/ ./internal/db/ ./internal/provisioner/  — all pass (16.5s + 0.2s + 0.3s)
- [x] New regression tests assert the care-zone column is not touched + the dead reader cannot return
- [x] Empirical grep cross-check: no writer for runtime_image_pins in molecule-core; no reader for workspaces.runtime_image_digest anywhere (both confirmed in RFC internal#617 §1 + §3)
- [x] Verified clean rebase: branch parent is current main tip (f17375a9), NOT pre-#1585 stale base. Diff vs main contains ONLY the migration-drop work — no .gitea/workflows/publish-runtime.yml regression.

Tier

tier:medium + area:schema — schema/migration change. Reversible by
re-running the down-migration. Two-eye review reviewers: core-be
(read path / Go) + core-qa (migration correctness). Cascade plan to
~6 live tenant DBs per RFC internal#617 §7 +
feedback_image_promote_is_not_user_live (verify on at least 2
tenants post-deploy).

Memory consulted: feedback_no_single_source_of_truth,
feedback_image_promote_is_not_user_live,
feedback_verify_actual_endstate_not_ack_follow_sop,
reference_package_distribution_open_ecosystem_dual_push.

RFC: molecule-ai/internal#617
Supersedes: #1608

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 05:30:35 -07:00
..