load_yaml: Fix include spec parsing of pipes

_INCLUDE_PATH_RE allows the pipe character in the target-path part of
a jw.include spec such as 'target.path|file.yaml'.  The greedy match
then consumes further pipes, so a file name that itself contains a
pipe is misparsed: the target swallows part of the file name and the
remainder becomes the (nonexistent) file to open.  Dots are needed in
the target part for nested paths, but a pipe can never be part of a
target path.

Drop the pipe from the character class so that the first pipe always
separates the target path from the file name.  Add a regression test
with a pipe in the file name.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-08-16 12:19:23 +02:00
commit e6f3833716
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -14,7 +14,7 @@ IncludeSpec: TypeAlias = tuple[bool, Path, tuple[str, ...]]
Includes: TypeAlias = list[IncludeSpec]
_LINK_NAME_RE = re.compile(r'^([a-zA-Z0-9_-]+)\|')
_INCLUDE_PATH_RE = re.compile(r'^([a-zA-Z0-9_.|-]+)\|')
_INCLUDE_PATH_RE = re.compile(r'^([a-zA-Z0-9_.-]+)\|')
# -- Low-level helpers (call graph leaves) --------------------------------------