Fix boundary parser Docker path: handle /app/sx/boundary.sx layout
In Docker, each service's sx/ dir is copied directly to /app/sx/,
not /app/{service}/sx/. Add fallback search for /app/sx/boundary.sx
alongside the dev glob pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,13 +36,22 @@ def _ref_dir() -> str:
|
|||||||
|
|
||||||
|
|
||||||
def _project_root() -> str:
|
def _project_root() -> str:
|
||||||
"""Return the project root (3 levels up from shared/sx/ref/)."""
|
"""Return the project root containing service directories.
|
||||||
|
|
||||||
|
Dev: shared/sx/ref -> shared/sx -> shared -> project root
|
||||||
|
Docker: /app/shared/sx/ref -> /app (shared is inside /app)
|
||||||
|
"""
|
||||||
ref = _ref_dir()
|
ref = _ref_dir()
|
||||||
# shared/sx/ref -> shared/sx -> shared -> project root
|
# Go up 3 levels: shared/sx/ref -> project root
|
||||||
root = os.path.abspath(os.path.join(ref, "..", "..", ".."))
|
root = os.path.abspath(os.path.join(ref, "..", "..", ".."))
|
||||||
# In Docker the layout is /app/shared/sx/ref -> /app
|
# Verify by checking for a known service directory or shared/
|
||||||
if not os.path.isdir(root):
|
if os.path.isdir(os.path.join(root, "shared")):
|
||||||
root = os.path.abspath(os.path.join(ref, "..", ".."))
|
return root
|
||||||
|
# Docker: /app/shared/sx/ref -> /app
|
||||||
|
# shared is INSIDE /app, not a sibling — go up to parent of shared
|
||||||
|
root = os.path.abspath(os.path.join(ref, "..", ".."))
|
||||||
|
if os.path.isdir(os.path.join(root, "sx")): # /app/sx exists in Docker
|
||||||
|
return root
|
||||||
return root
|
return root
|
||||||
|
|
||||||
|
|
||||||
@@ -98,12 +107,25 @@ def _extract_declarations(
|
|||||||
|
|
||||||
|
|
||||||
def _find_service_boundary_files() -> list[str]:
|
def _find_service_boundary_files() -> list[str]:
|
||||||
"""Find all {service}/sx/boundary.sx files in the project."""
|
"""Find service boundary.sx files.
|
||||||
|
|
||||||
|
Dev: {project}/{service}/sx/boundary.sx (e.g. blog/sx/boundary.sx)
|
||||||
|
Docker: /app/sx/boundary.sx (service's sx/ dir copied directly into /app/)
|
||||||
|
"""
|
||||||
root = _project_root()
|
root = _project_root()
|
||||||
pattern = os.path.join(root, "*/sx/boundary.sx")
|
files: list[str] = []
|
||||||
files = glob.glob(pattern)
|
|
||||||
# Exclude shared/sx/ref/ — that's the core boundary
|
# Dev layout: {root}/{service}/sx/boundary.sx
|
||||||
return [f for f in files if "/shared/" not in f]
|
for f in glob.glob(os.path.join(root, "*/sx/boundary.sx")):
|
||||||
|
if "/shared/" not in f:
|
||||||
|
files.append(f)
|
||||||
|
|
||||||
|
# Docker layout: service's sx/ dir is at {root}/sx/boundary.sx
|
||||||
|
docker_path = os.path.join(root, "sx", "boundary.sx")
|
||||||
|
if os.path.exists(docker_path) and docker_path not in files:
|
||||||
|
files.append(docker_path)
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user