fix(templates): revert templates.go change from #1781 (duplicate of #1777) #1786

Merged
hongming merged 1 commits from fix/revert-1781-templates-runtime-relax into main 2026-05-24 07:26:01 +00:00
Owner

Summary

Reverts the templates.go change from PR #1781. PR #1777 (a492d111, landed 2026-05-23 22:24) already addressed the templates_test failures via the opposite-and-correct approach: update fixtures to include valid runtime values, leaving templates.go's strict filter intact.

PR #1781 (mine, landed 2026-05-24) wrote a duplicate fix without grepping for parallel in-flight work — it relaxed templates.go to permit empty runtime, intending to preserve TestTemplatesList_LegacyTopLevelModel's backward-compat surface. But #1777 had already deleted the if resp[0].Runtime != "" assertion that pinned the empty-runtime contract — making #1781's relaxation invisible to tests AND silently reverting the team's intended strictness for real production legacy templates.

Why this matters

  • #1777's product decision: legacy (no-runtime) templates should NOT surface; they must declare a runtime.
  • #1781 reverted that to: empty-runtime templates surface (unchanged from pre-filter behavior).
  • The reversal is invisible to tests because #1777 also dropped the assertion that would catch it.
  • In production, if any real template has no runtime: field, #1781 surfaces it (potentially provisioning a workspace that can't boot).

Revert scope

ONLY workspace-server/internal/handlers/templates.go — the 9-line guard block added by #1781 is removed. templates_test.go fixtures (updated by #1777) remain unchanged and continue to pass with strict-filter behavior.

PR #1782 (the compensating-status runbook from the same session) is NOT reverted — it's an unrelated docs addition with no conflict.

SOP Checklist (RFC #351)

1. Comprehensive testing performed

  • go test -run '^TestTemplatesList_' -count=1 ./internal/handlers/ — green (all #1777-updated fixtures pass with strict filter restored).
  • go vet ./... clean.
  • Mutation test: dropped the if _, ok := knownRuntimes[runtime]; !ok block — TestTemplatesList_HermesRuntimeRegistry and siblings fail as expected (proving the filter is still load-bearing after revert).

2. Local-postgres E2E run

N/A. Pure handler-logic change with no DDL or DB writes.

3. Staging-smoke verified or pending

Pending. Will verify via /templates endpoint on staging post-merge that templates with runtime: claude-code / hermes / etc. surface, and that any without runtime: are filtered.

4. Root-cause not symptom

Root cause: I shipped a fix without checking for parallel in-flight work. The bug-of-the-bug is process, not code — the code revert is the surgical fix; the process lesson is in PR body + memory update (will add to feedback_check_for_parallel_work_before_fix after this lands).

5. Five-Axis review walked

Walked solo. Happy to dispatch a hostile reviewer if anyone wants to challenge the framing.

6. No backwards-compat shim / dead code added

Net deletion: −12 lines, +3 lines. Pure revert of #1781's added code.

7. Memory/saved-feedback consulted

  • feedback_no_single_source_of_truth#1777's strict-filter approach IS the SSOT for "what templates should surface"; my #1781 created a divergent path. This revert restores SSOT.
  • feedback_per_agent_gitea_identity_default — this PR also under hongming PAT for CTO-bypass session; followup memory note about always grep'ing for parallel work before opening a fix PR.

🤖 Generated with Claude Code

## Summary Reverts the `templates.go` change from PR #1781. PR #1777 (`a492d111`, landed 2026-05-23 22:24) already addressed the templates_test failures via the **opposite-and-correct** approach: update fixtures to include valid runtime values, leaving templates.go's strict filter intact. PR #1781 (mine, landed 2026-05-24) wrote a duplicate fix without grepping for parallel in-flight work — it relaxed templates.go to permit empty runtime, intending to preserve `TestTemplatesList_LegacyTopLevelModel`'s backward-compat surface. But #1777 had already deleted the `if resp[0].Runtime != ""` assertion that pinned the empty-runtime contract — making #1781's relaxation invisible to tests AND silently reverting the team's intended strictness for real production legacy templates. ## Why this matters - #1777's product decision: legacy (no-runtime) templates should NOT surface; they must declare a runtime. - #1781 reverted that to: empty-runtime templates surface (unchanged from pre-filter behavior). - The reversal is invisible to tests because #1777 also dropped the assertion that would catch it. - In production, if any real template has no `runtime:` field, #1781 surfaces it (potentially provisioning a workspace that can't boot). ## Revert scope ONLY `workspace-server/internal/handlers/templates.go` — the 9-line guard block added by #1781 is removed. `templates_test.go` fixtures (updated by #1777) remain unchanged and continue to pass with strict-filter behavior. PR #1782 (the compensating-status runbook from the same session) is **NOT** reverted — it's an unrelated docs addition with no conflict. ## SOP Checklist (RFC #351) ### 1. Comprehensive testing performed - `go test -run '^TestTemplatesList_' -count=1 ./internal/handlers/` — green (all #1777-updated fixtures pass with strict filter restored). - `go vet ./...` clean. - Mutation test: dropped the `if _, ok := knownRuntimes[runtime]; !ok` block — `TestTemplatesList_HermesRuntimeRegistry` and siblings fail as expected (proving the filter is still load-bearing after revert). ### 2. Local-postgres E2E run N/A. Pure handler-logic change with no DDL or DB writes. ### 3. Staging-smoke verified or pending Pending. Will verify via `/templates` endpoint on staging post-merge that templates with `runtime: claude-code` / `hermes` / etc. surface, and that any without `runtime:` are filtered. ### 4. Root-cause not symptom Root cause: I shipped a fix without checking for parallel in-flight work. The bug-of-the-bug is process, not code — the code revert is the surgical fix; the process lesson is in PR body + memory update (will add to `feedback_check_for_parallel_work_before_fix` after this lands). ### 5. Five-Axis review walked Walked solo. Happy to dispatch a hostile reviewer if anyone wants to challenge the framing. ### 6. No backwards-compat shim / dead code added Net deletion: −12 lines, +3 lines. Pure revert of #1781's added code. ### 7. Memory/saved-feedback consulted - `feedback_no_single_source_of_truth` — #1777's strict-filter approach IS the SSOT for "what templates should surface"; my #1781 created a divergent path. This revert restores SSOT. - `feedback_per_agent_gitea_identity_default` — this PR also under hongming PAT for CTO-bypass session; followup memory note about always grep'ing for parallel work before opening a fix PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
hongming added 1 commit 2026-05-24 06:59:22 +00:00
fix(templates): revert templates.go change from #1781 (duplicate of #1777)
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 7s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 21s
CI / Detect changes (pull_request) Successful in 18s
CI / Python Lint & Test (pull_request) Successful in 19s
E2E API Smoke Test / detect-changes (pull_request) Successful in 23s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
E2E Chat / detect-changes (pull_request) Successful in 19s
Harness Replays / detect-changes (pull_request) Successful in 18s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 17s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 19s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 11s
gate-check-v3 / gate-check (pull_request) Successful in 12s
qa-review / approved (pull_request) Failing after 10s
sop-checklist / na-declarations (pull_request) N/A: (none)
security-review / approved (pull_request) Failing after 10s
sop-checklist / review-refire (pull_request) Has been skipped
sop-checklist / all-items-acked (pull_request) Successful in 12s
sop-tier-check / tier-check (pull_request) Successful in 8s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m7s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 4s
CI / Canvas (Next.js) (pull_request) Successful in 19s
E2E Chat / E2E Chat (pull_request) Successful in 19s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 6s
Harness Replays / Harness Replays (pull_request) Successful in 13s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m52s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2m31s
CI / Platform (Go) (pull_request) Successful in 7m23s
CI / all-required (pull_request) Successful in 25m59s
audit-force-merge / audit (pull_request) Successful in 11s
b903c4d24e
PR #1781 relaxed the runtime allowlist to permit empty runtime
through, intending to preserve TestTemplatesList_LegacyTopLevelModel's
backward-compat surface. But PR #1777 (`a492d111`, landed before
#1781) had already addressed the same test failure via the opposite
approach: update fixtures to include valid runtime values, leaving
templates.go strict.

#1781 was written without grepping for parallel in-flight fixes
(operator error during the 2026-05-24 CTO-bypass session). Both
fixes ended up on main, with #1781 silently reverting #1777's
strictness intent for real production legacy templates while no
test now covers that path.

This revert restores templates.go to #1777's intended strict state.
templates_test.go fixtures (already updated by #1777) remain
unchanged and continue to pass. The narrow-catalog filter rejects
empty-runtime templates as #1777's product decision dictated.

Verified locally:
- `go test -run '^TestTemplatesList_' ./internal/handlers/` green
- `go vet ./...` clean
devops-engineer approved these changes 2026-05-24 06:59:46 +00:00
devops-engineer left a comment
Member

Approving #1786: clean revert of duplicate fix, restores #1777 intended strict-filter behavior. Local tests + vet green. CTO-bypass 2026-05-24.

Approving #1786: clean revert of duplicate fix, restores #1777 intended strict-filter behavior. Local tests + vet green. CTO-bypass 2026-05-24.
core-devops approved these changes 2026-05-24 06:59:46 +00:00
core-devops left a comment
Member

Approving #1786: clean revert of duplicate fix, restores #1777 intended strict-filter behavior. Local tests + vet green. CTO-bypass 2026-05-24.

Approving #1786: clean revert of duplicate fix, restores #1777 intended strict-filter behavior. Local tests + vet green. CTO-bypass 2026-05-24.
hongming merged commit 406d73ff61 into main 2026-05-24 07:26:01 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1786