test: templates_test.go fixtures broken on main — missing runtime field collides with runtime-allowlist filter #1778

Closed
opened 2026-05-24 05:25:51 +00:00 by hongming · 0 comments
Owner

Summary

TestTemplatesList_WithTemplates, TestTemplatesList_LegacyTopLevelModel, TestTemplatesList_NoProvidersField, and likely several sibling tests in workspace-server/internal/handlers/templates_test.go fail locally on origin/main HEAD (verified at 50720fb8, 2026-05-24). The runtime-allowlist filter landed in templates.go without corresponding fixture updates.

Reproduction

cd ~/molecule-core/workspace-server
go test -run '^TestTemplatesList_WithTemplates$' -count=1 ./internal/handlers/

Output:

2026/05/23 22:17:01 runtime registry: manifest.json not found, using fallback allowlist (8 entries)
2026/05/23 22:17:01 templates list: skip test-agent: unsupported runtime ""
--- FAIL: TestTemplatesList_WithTemplates (0.00s)
    templates_test.go:119: expected 1 template, got 0

Root cause

workspace-server/internal/handlers/templates.go has a runtime allowlist filter:

runtime := strings.TrimSuffix(strings.TrimSpace(raw.Runtime), "-default")
if _, ok := knownRuntimes[runtime]; !ok {
    log.Printf("templates list: skip %s: unsupported runtime %q", id, runtime)
    return
}

Test fixtures in templates_test.go (around lines 80-90, 553-565, 596-608) do NOT set runtime: in their config.yaml. Empty runtime "" is not in knownRuntimes, so all templates get skipped → tests fail.

Why CI on main "passes" despite tests being broken

CI's working tree apparently has the manifest.json file present (so the runtime registry loads the full allowlist, which evidently allows empty runtime); local dev trees don't have it. Test is environment-dependent. This is a deeper test-hygiene bug.

Acceptance

  • All TestTemplatesList_* tests pass on a fresh local checkout (no manifest.json present)
  • Test fixtures use runtime: <something-in-knownRuntimes> consistently
  • Document or remove the runtime-registry fallback-allowlist drift

Discovered during

Multi-PR CTO-bypass merge session 2026-05-24. #1759's Platform (Go) failed with this; cross-checked against origin/main and confirmed identical failure → unrelated to #1759's seedInitialMemories work.

## Summary `TestTemplatesList_WithTemplates`, `TestTemplatesList_LegacyTopLevelModel`, `TestTemplatesList_NoProvidersField`, and likely several sibling tests in `workspace-server/internal/handlers/templates_test.go` **fail locally on origin/main HEAD** (verified at 50720fb8, 2026-05-24). The runtime-allowlist filter landed in templates.go without corresponding fixture updates. ## Reproduction ``` cd ~/molecule-core/workspace-server go test -run '^TestTemplatesList_WithTemplates$' -count=1 ./internal/handlers/ ``` Output: ``` 2026/05/23 22:17:01 runtime registry: manifest.json not found, using fallback allowlist (8 entries) 2026/05/23 22:17:01 templates list: skip test-agent: unsupported runtime "" --- FAIL: TestTemplatesList_WithTemplates (0.00s) templates_test.go:119: expected 1 template, got 0 ``` ## Root cause `workspace-server/internal/handlers/templates.go` has a runtime allowlist filter: ```go runtime := strings.TrimSuffix(strings.TrimSpace(raw.Runtime), "-default") if _, ok := knownRuntimes[runtime]; !ok { log.Printf("templates list: skip %s: unsupported runtime %q", id, runtime) return } ``` Test fixtures in `templates_test.go` (around lines 80-90, 553-565, 596-608) do NOT set `runtime:` in their config.yaml. Empty runtime `""` is not in `knownRuntimes`, so all templates get skipped → tests fail. ## Why CI on main "passes" despite tests being broken CI's working tree apparently has the `manifest.json` file present (so the runtime registry loads the full allowlist, which evidently allows empty runtime); local dev trees don't have it. Test is environment-dependent. This is a deeper test-hygiene bug. ## Acceptance - [ ] All `TestTemplatesList_*` tests pass on a fresh local checkout (no manifest.json present) - [ ] Test fixtures use `runtime: <something-in-knownRuntimes>` consistently - [ ] Document or remove the runtime-registry fallback-allowlist drift ## Discovered during Multi-PR CTO-bypass merge session 2026-05-24. #1759's Platform (Go) failed with this; cross-checked against origin/main and confirmed identical failure → unrelated to #1759's seedInitialMemories work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1778