test(templates): CI vs local environment divergence in TestTemplatesList_* #1813

Closed
opened 2026-05-24 23:00:38 +00:00 by hongming · 1 comment
Owner

Summary

TestTemplatesList_* in workspace-server/internal/handlers/templates_test.go pass in CI but fail on a fresh local checkout. The test handler logs runtime registry: manifest.json not found, using fallback allowlist (8 entries) locally, then rejects the test fixtures' empty runtime: field via the post-a5211050 runtime-allowlist filter. In CI the same code paths see a manifest.json with a more permissive runtime set (apparently includes empty) and the tests pass.

This is environment divergence, not a test or filter bug. Was flagged as acceptance criterion #3 on issue #1778 ("Document or remove the runtime-registry fallback-allowlist drift").

Reproduction

cd ~/molecule-core/workspace-server
go test -run '^TestTemplatesList_WithTemplates$' -count=1 ./internal/handlers/
# FAIL — fixtures missing runtime, fallback allowlist rejects empty

The same test passes in CI / Platform (Go) workflow against the same source commit.

Hypothesis

  1. CI's working tree has manifest.json committed or generated by a pre-test step. Local checkouts don't.
  2. The fallback allowlist (fallbackRuntimes in runtime_registry.go) is stricter than whatever manifest.json provides.

Fix options

Option Approach
A Commit a manifest.json to the repo with a known set of supported runtimes. Tests use the same list locally + CI.
B Make fallbackRuntimes accept empty runtime (the legacy backward-compat case) so the fallback is functionally equivalent to the manifest.
C Have tests load a fixture manifest.json explicitly, never the fallback.

Recommend C — most explicit, no production behavior change, scoped to tests.

Acceptance

  • go test -count=1 ./internal/handlers/ passes on a fresh local checkout (no manifest.json built)
  • CI continues to pass
  • No production behavior change

Discovered during

2026-05-24 memory-system session, fix for #1778 (templates_test fixtures) acknowledged this as a separate environment-divergence concern.

## Summary `TestTemplatesList_*` in `workspace-server/internal/handlers/templates_test.go` pass in CI but fail on a fresh local checkout. The test handler logs `runtime registry: manifest.json not found, using fallback allowlist (8 entries)` locally, then rejects the test fixtures' empty `runtime:` field via the post-`a5211050` runtime-allowlist filter. In CI the same code paths see a manifest.json with a more permissive runtime set (apparently includes empty) and the tests pass. This is environment divergence, not a test or filter bug. Was flagged as acceptance criterion #3 on issue #1778 ("Document or remove the runtime-registry fallback-allowlist drift"). ## Reproduction ```bash cd ~/molecule-core/workspace-server go test -run '^TestTemplatesList_WithTemplates$' -count=1 ./internal/handlers/ # FAIL — fixtures missing runtime, fallback allowlist rejects empty ``` The same test passes in `CI / Platform (Go)` workflow against the same source commit. ## Hypothesis 1. CI's working tree has `manifest.json` committed or generated by a pre-test step. Local checkouts don't. 2. The fallback allowlist (`fallbackRuntimes` in `runtime_registry.go`) is stricter than whatever manifest.json provides. ## Fix options | Option | Approach | |---|---| | A | Commit a `manifest.json` to the repo with a known set of supported runtimes. Tests use the same list locally + CI. | | B | Make `fallbackRuntimes` accept empty runtime (the legacy backward-compat case) so the fallback is functionally equivalent to the manifest. | | C | Have tests load a fixture `manifest.json` explicitly, never the fallback. | Recommend C — most explicit, no production behavior change, scoped to tests. ## Acceptance - [ ] `go test -count=1 ./internal/handlers/` passes on a fresh local checkout (no manifest.json built) - [ ] CI continues to pass - [ ] No production behavior change ## Discovered during 2026-05-24 memory-system session, fix for #1778 (templates_test fixtures) acknowledged this as a separate environment-divergence concern.
Author
Owner

Closing as not-reproducible

Re-checking on current main HEAD (post-#1777, #1786, #1809):

$ cd ~/molecule-core/workspace-server
$ go test -run '^TestTemplatesList_' -count=1 ./internal/handlers/
2026/05/24 16:05:58 runtime registry: manifest.json not found, using fallback allowlist (8 entries)
ok  	github.com/Molecule-AI/molecule-monorepo/platform/internal/handlers	0.587s

All TestTemplatesList_* pass green on a local checkout WITH the "manifest.json not found" log line — meaning the fallback allowlist IS being used and the fixtures pass against it.

What I'd missed: PR #1777 (a492d11, before this session) had already aligned the fixtures with the strict runtime allowlist by adding runtime: claude-code to each fixture. My earlier observation of the failure was on the pre-#1777 / pre-#1786 state. The fix has been in for hours.

There's no environment divergence to chase. The fallback allowlist works for both CI and local since the fixtures all declare a known runtime now.

Filing this issue was based on a stale read. Closing.

## Closing as not-reproducible Re-checking on current main HEAD (post-#1777, #1786, #1809): ```bash $ cd ~/molecule-core/workspace-server $ go test -run '^TestTemplatesList_' -count=1 ./internal/handlers/ 2026/05/24 16:05:58 runtime registry: manifest.json not found, using fallback allowlist (8 entries) ok github.com/Molecule-AI/molecule-monorepo/platform/internal/handlers 0.587s ``` All `TestTemplatesList_*` pass green on a local checkout WITH the "manifest.json not found" log line — meaning the fallback allowlist IS being used and the fixtures pass against it. What I'd missed: PR #1777 (`a492d11`, before this session) had already aligned the fixtures with the strict runtime allowlist by adding `runtime: claude-code` to each fixture. My earlier observation of the failure was on the pre-#1777 / pre-#1786 state. The fix has been in for hours. There's no environment divergence to chase. The fallback allowlist works for both CI and local since the fixtures all declare a known runtime now. Filing this issue was based on a stale read. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1813