fix(validator): path-string symlink semantics + add local-e2e setup script #4

Merged
claude-ceo-assistant merged 1 commits from fix/validator-symlink-semantics into main 2026-05-08 11:47:40 +00:00

Summary

Two follow-ups discovered while pre-flighting local platform spin-up (internal#77 dev-department extraction).

Validator (closes task #231)

Previous validate-tree.py used Path.resolve() everywhere — Python's realpath equivalent that follows symlinks. Caused false positives on parent template's cross-repo symlink (dev-lead → sibling repo): validator reported resolves outside repo root even though the platform's resolveYAMLIncludes accepts the path because filepath.Abs/Rel operate on path STRINGS, not on realpath.

Fix: introduce _abs_no_symlink_resolve() helper using os.path.abspath (string-only) and _is_inside_root() that mirrors Go's filepath.Rel + HasPrefix idiom. All places where the validator emulates the platform security check now use these helpers; Path.resolve() is reserved for cases that need realpath semantics (none currently).

Verified:

  • Validator now passes on parent template's dev-lead symlink (was previously hard error).
  • Still rejects truly-out-of-root references.
  • dev-department --strict still 28/28 reachable / 0 orphans / 0 .. / 0 dups.

Local E2E setup script (DX win)

New .molecule-ci/scripts/local-e2e-setup.sh — bootstraps the /tmp/local-e2e-deploy/ sibling-clone fixture used by workspace-server's TestLocalE2E_* tests. Idempotent (pulls latest) with --fresh to wipe and re-clone. Exits non-zero with diagnostics if the parent template's dev-lead symlink is missing or broken (catches stale parent-template clones from before PR #5).

Verified locally (2026-05-08)

$ ./local-e2e-setup.sh --fresh
[fresh] wiping /tmp/local-e2e-deploy
[clone] molecule-ai-org-template-molecule-dev → molecule-dev
[clone] molecule-dev-department → molecule-dev-department
== ready ==
  symlink: ../molecule-dev-department/dev-lead

$ cd <molecule-core>/workspace-server
$ go test -v -run TestLocalE2E_ ./internal/handlers/
ok  github.com/Molecule-AI/.../platform/internal/handlers  0.498s

Refs

  • internal#77 — extraction RFC
  • task #231 — validator-vs-platform symlink semantics
  • Hongming GO 2026-05-08
## Summary Two follow-ups discovered while pre-flighting local platform spin-up (internal#77 dev-department extraction). ## Validator (closes task #231) Previous `validate-tree.py` used `Path.resolve()` everywhere — Python's realpath equivalent that follows symlinks. Caused false positives on parent template's cross-repo symlink (`dev-lead → sibling repo`): validator reported `resolves outside repo root` even though the platform's `resolveYAMLIncludes` accepts the path because `filepath.Abs/Rel` operate on path STRINGS, not on realpath. **Fix**: introduce `_abs_no_symlink_resolve()` helper using `os.path.abspath` (string-only) and `_is_inside_root()` that mirrors Go's `filepath.Rel + HasPrefix` idiom. All places where the validator emulates the platform security check now use these helpers; `Path.resolve()` is reserved for cases that need realpath semantics (none currently). **Verified**: - Validator now passes on parent template's `dev-lead` symlink (was previously hard error). - Still rejects truly-out-of-root references. - dev-department `--strict` still 28/28 reachable / 0 orphans / 0 `..` / 0 dups. ## Local E2E setup script (DX win) New `.molecule-ci/scripts/local-e2e-setup.sh` — bootstraps the `/tmp/local-e2e-deploy/` sibling-clone fixture used by workspace-server's `TestLocalE2E_*` tests. Idempotent (pulls latest) with `--fresh` to wipe and re-clone. Exits non-zero with diagnostics if the parent template's `dev-lead` symlink is missing or broken (catches stale parent-template clones from before PR #5). ## Verified locally (2026-05-08) ``` $ ./local-e2e-setup.sh --fresh [fresh] wiping /tmp/local-e2e-deploy [clone] molecule-ai-org-template-molecule-dev → molecule-dev [clone] molecule-dev-department → molecule-dev-department == ready == symlink: ../molecule-dev-department/dev-lead $ cd <molecule-core>/workspace-server $ go test -v -run TestLocalE2E_ ./internal/handlers/ ok github.com/Molecule-AI/.../platform/internal/handlers 0.498s ``` ## Refs - internal#77 — extraction RFC - task #231 — validator-vs-platform symlink semantics - Hongming GO 2026-05-08
claude-ceo-assistant added 1 commit 2026-05-08 11:47:38 +00:00
Two follow-ups discovered while pre-flighting local platform spin-up
(internal#77 dev-department extraction):

VALIDATOR (closes task #231)
  Previous validate-tree.py used Path.resolve() everywhere — Python's
  realpath equivalent that follows symlinks. Caused false positives on
  parent template's cross-repo symlink (dev-lead → sibling repo):
  validator reported 'resolves outside repo root' even though the
  platform's resolveYAMLIncludes (workspace-server/internal/handlers/
  org_include.go) accepts the path because filepath.Abs/Rel operate on
  path STRINGS, not on the realpath.

  Fix: introduce _abs_no_symlink_resolve() helper using os.path.abspath
  (string-only) and _is_inside_root() that mirrors Go's filepath.Rel +
  HasPrefix idiom. All places where the validator emulates the platform
  security check now use these helpers; Path.resolve() is reserved for
  cases that need realpath semantics (none currently).

  Verified: validator now passes on parent template's dev-lead symlink
  (was previously a hard error), still rejects truly-out-of-root
  references (e.g. ../../../etc/passwd-style escapes).

LOCAL E2E SETUP SCRIPT (DX win)
  New .molecule-ci/scripts/local-e2e-setup.sh — bootstraps the
  /tmp/local-e2e-deploy/ sibling-clone fixture used by
  workspace-server's TestLocalE2E_* tests. Idempotent (pulls latest)
  with --fresh to wipe and re-clone. Exits non-zero with diagnostics
  if the parent template's dev-lead symlink is missing or broken
  (catches stale parent-template clones from before PR #5).

Refs:
  internal#77 — extraction RFC
  task #231 — validator-vs-platform symlink semantics
  Hongming GO 2026-05-08 ('go' on the 3 pre-spin-up optimizations)
claude-ceo-assistant merged commit dabfd2d1be into main 2026-05-08 11:47:40 +00:00
claude-ceo-assistant deleted branch fix/validator-symlink-semantics 2026-05-08 11:47:40 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-dev-department#4
No description provided.