fix(provisioner)+test: EvalSymlinks templatePath; stage-2 e2e for files_dir consumption #104
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "optimize/extraction-stage-2-tests-and-validator-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two changes from one root cause discovered while preparing local platform spin-up for the dev-department extraction (internal#77).
The bug
CopyTemplateToContainer'sfilepath.Walkis called withtemplatePath = ws.FilesDirresolved againstorgBaseDir. With the cross-repo symlink composition shipped in parent template PR #5 (dev-lead → ../molecule-dev-department/dev-lead/), the Dev Lead workspace'sfiles_dir: dev-leadis the symlink itself.filepath.Walkdoes NOT descend into a symlink leaf — itLstats the root, sees a symlink (not a directory), emits exactly one entry, and returns. Result: workspace's/configs/tar would ship empty. Other 38 workspaces are fine because theirfiles_dirpaths just traverse the symlink (intermediate symlinks resolve viaLstattraversal); only the leaf-is-symlink case breaks.The fix
workspace-server/internal/provisioner/provisioner.go: callfilepath.EvalSymlinks(templatePath)beforefilepath.Walk. Resolves the leaf-symlink case for ALL templates, not just dev-dept.Security:
templatePathhas already passedresolveInsideRoot's path-string check at the call site; the trust boundary is the operator-side/org-templates/filesystem layout, not this resolution step.The test (regression guard)
workspace-server/internal/handlers/local_e2e_dev_dept_test.go: newTestLocalE2E_FilesDirConsumption. For every workspace in the resolvedOrgTemplate, asserts:resolveInsideRoot(orgBaseDir, ws.FilesDir)succeeds.os.Staton the result returns a directory.filepath.WalkafterEvalSymlinks(mirroring the platform fix) emits at least one file.workspace.yaml,system-prompt.md, orinitial-prompt.md).Exercises the SECOND half of
POST /org/importthat PR #103 (TestLocalE2E_DevDepartmentExtraction) didn't cover.Verified locally (2026-05-08)
Regression guard verified: without the
EvalSymlinksfix, the test fails on Dev Lead with:Refs
LGTM. Stage-2 test caught a real provisioner bug; the EvalSymlinks fix is surgical and well-justified. Test runs locally.