Skip to content

Commit cd89f02

Browse files
yasinBursaliclaude
andcommitted
test(scripts): scaffold extension dir with literal space to exercise NUL stream
CG follow-up: the original 8-case test scaffolded a script-dir whose parent path contained a space, but the resolver emits paths RELATIVE to script-dir, so the NUL stream never actually contained a literal space. The test was effectively only exercising "resolver runs in a spaced parent dir". Add a 9th case that creates `extensions/services/space ext/manifest.json` with `compose_file: compose.yaml`, drops a stub compose.yaml, and runs the resolver. The resolver enumerates the extension and emits `extensions/services/space ext/compose.yaml` as a relative path containing a literal space. The test asserts that exactly one token in the NUL-delimited stream matches that path verbatim — proving the end-to-end producer→consumer round-trip preserves embedded whitespace. Uses manifest.json (not yaml) so the test is independent of PyYAML. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e341cc2 commit cd89f02

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

dream-server/tests/test-resolve-compose-null.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,43 @@ else
125125
fail "default mode output changed: '$default_text'"
126126
fi
127127

128+
# 5. End-to-end: an extension whose own directory name contains a
129+
# space produces a relative compose path with a literal space, and
130+
# that path survives the NUL round-trip as a single token.
131+
EXT_NAME="space ext"
132+
mkdir -p "$SCRIPT_DIR_WITH_SPACE/extensions/services/$EXT_NAME"
133+
cat > "$SCRIPT_DIR_WITH_SPACE/extensions/services/$EXT_NAME/manifest.json" <<EOF
134+
{
135+
"schema_version": "dream.services.v1",
136+
"service": {
137+
"id": "space-ext",
138+
"compose_file": "compose.yaml",
139+
"gpu_backends": ["all"]
140+
}
141+
}
142+
EOF
143+
touch "$SCRIPT_DIR_WITH_SPACE/extensions/services/$EXT_NAME/compose.yaml"
144+
145+
ext_arr=()
146+
while IFS= read -r -d '' tok; do
147+
ext_arr+=("$tok")
148+
done < <("$RESOLVER" --script-dir "$SCRIPT_DIR_WITH_SPACE" \
149+
--tier 1 --gpu-backend nvidia --null)
150+
151+
# Find the token that points at the space-ext compose file. It should
152+
# be exactly one element with the literal space preserved.
153+
expected_path="extensions/services/$EXT_NAME/compose.yaml"
154+
match_count=0
155+
for t in "${ext_arr[@]}"; do
156+
[[ "$t" == "$expected_path" ]] && match_count=$((match_count + 1))
157+
done
158+
159+
if [[ "$match_count" -eq 1 ]]; then
160+
pass "extension dir with space round-trips as a single token: '$expected_path'"
161+
else
162+
fail "expected exactly one token '$expected_path', got $match_count matches in [${ext_arr[*]}]"
163+
fi
164+
128165
echo ""
129166
echo "Result: $PASSED passed, $FAILED failed"
130167
[[ $FAILED -eq 0 ]]

0 commit comments

Comments
 (0)