refactor(coderd/templatebuilder): address review feedback

- Replace stub module with real code-server module manifest
- Export ParseModulesFromFS(fs.FS) for test isolation (no sync.Once coupling)
- Use sync.OnceValues for the cached loader
- Validate module ID (non-empty, unique), pinned_version, and variable types
  during parsing; reject unknown types at load time
- Normalize nil slices to empty in ToSDK() to prevent null in JSON responses
- Distinguish fs.ErrNotExist from other ReadFile errors
- Improve error messages to describe what failed, not internal plumbing
- Rewrite tests with fstest.MapFS fixtures covering all variable types,
  default pointer, validation errors, and full SDK field assertions
- Trim zero-value godoc comments
- Add future tense to README for unimplemented behavior; link RFC
This commit is contained in:
Jeremy Ruppel
2026-06-01 20:21:01 +00:00
parent bf131f3f67
commit cc381e17e8
7 changed files with 485 additions and 159 deletions
@@ -0,0 +1,30 @@
{
"id": "code-server",
"display_name": "code-server",
"description": "VS Code in the browser",
"icon": "/icon/code.svg",
"category": "IDE",
"tags": ["ide", "web"],
"compatible_os": ["linux"],
"conflicts_with": [],
"pinned_version": "1.2.3",
"variables": [
{
"name": "agent_id",
"type": "string",
"description": "The ID of the Coder agent. Injected automatically by the builder.",
"required": true,
"sensitive": false,
"builder_managed": true
},
{
"name": "port",
"type": "number",
"description": "Port to run code-server on",
"default": "13337",
"required": false,
"sensitive": false,
"builder_managed": false
}
]
}