mirror of
https://scm.tikali.ai/tikali/applications/monky/monky-deployd.git
synced 2026-09-18 05:36:15 +00:00
fix(bundle): ${VAR} inside comment lines is not a reference
The renderer's .env.template header literally says "substitutes every
${VAR}", which the refusal check counted as an unresolved variable
(ENV_INCOMPLETE: unresolved: VAR) — env-qa-02's first bundle was refused.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KLB7jieMNRkTsJ2epr4Ds1
This commit is contained in:
@@ -144,12 +144,18 @@ def parse(data: bytes, *, max_bytes: int = 4 * 1024 * 1024) -> Bundle:
|
||||
# --- refusal checks (pure; names only, never values) -----------------------------------------
|
||||
|
||||
|
||||
def _code_lines(text: str) -> str:
|
||||
"""Drop comment lines: a `# … ${VAR} …` remark in .env.template (the renderer writes one)
|
||||
is not a reference. Compose/dotenv comments start with `#` after optional whitespace."""
|
||||
return "\n".join(ln for ln in text.splitlines() if not ln.lstrip().startswith("#"))
|
||||
|
||||
|
||||
def referenced_vars(text: str) -> set[str]:
|
||||
return {m.group(1) for m in _VAR_RE.finditer(text)}
|
||||
return {m.group(1) for m in _VAR_RE.finditer(_code_lines(text))}
|
||||
|
||||
|
||||
def defaulted_vars(text: str) -> set[str]:
|
||||
return {m.group(1) for m in _VAR_DEFAULTED_RE.finditer(text)}
|
||||
return {m.group(1) for m in _VAR_DEFAULTED_RE.finditer(_code_lines(text))}
|
||||
|
||||
|
||||
def unresolved_vars(bundle: Bundle, provided: set[str]) -> list[str]:
|
||||
|
||||
Reference in New Issue
Block a user