From ceddd060b036584684ef81afc8ffa3e5467af27b Mon Sep 17 00:00:00 2001 From: Molecule AI Core-DevOps Date: Mon, 11 May 2026 21:44:24 +0000 Subject: [PATCH] fix(ci): strip JSON5 comments from manifest.json before jq parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Integration Tester appends a trailing JSON5 comment (// Triggered by Integration Tester at ...) to manifest.json. Standard jq rejects this as invalid JSON with: jq: parse error: Invalid numeric literal at line 47, column 3 Fix: add a _strip_comments() helper using sed to remove full-line // comments before feeding to jq. Safe — sed only removes lines that are entirely a comment; embedded // within strings are unaffected because the lines containing them are not pure comments. Fixes publish-workspace-server-image run 9982 pre-clone failure. Co-Authored-By: Claude Opus 4.7 --- scripts/clone-manifest.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/clone-manifest.sh b/scripts/clone-manifest.sh index d6e343c8..396d5f6b 100755 --- a/scripts/clone-manifest.sh +++ b/scripts/clone-manifest.sh @@ -34,6 +34,17 @@ WS_DIR="${2:?Missing workspace-templates dir}" ORG_DIR="${3:?Missing org-templates dir}" PLUGINS_DIR="${4:?Missing plugins dir}" +# Strip JSON5-style // comments from manifest.json before parsing. +# The automated Integration Tester appends a trailing comment +# (// Triggered by ... ) which is valid JSON5 but not standard JSON. +# jq's default parser rejects it. This sed removes only full-line comments +# (lines starting with optional whitespace followed by //) before jq reads the file. +_strip_comments() { + # Remove full-line // comments (whitespace-safe); pass-through for non-comment lines + sed 's/^[[:space:]]*\/\/.*//' "$MANIFEST" +} +MANIFEST_JSON="$(_strip_comments)" + EXPECTED=0 CLONED=0 @@ -88,15 +99,15 @@ clone_category() { mkdir -p "$target_dir" local count - count=$(jq -r ".${category} | length" "$MANIFEST") + count=$(echo "$MANIFEST_JSON" | jq -r ".${category} | length") EXPECTED=$((EXPECTED + count)) local i=0 while [ "$i" -lt "$count" ]; do local name repo ref - name=$(jq -r ".${category}[$i].name" "$MANIFEST") - repo=$(jq -r ".${category}[$i].repo" "$MANIFEST") - ref=$(jq -r ".${category}[$i].ref // \"main\"" "$MANIFEST") + name=$(echo "$MANIFEST_JSON" | jq -r ".${category}[$i].name") + repo=$(echo "$MANIFEST_JSON" | jq -r ".${category}[$i].repo") + ref=$(echo "$MANIFEST_JSON" | jq -r ".${category}[$i].ref // \"main\"") # Idempotent: skip if the target already looks populated. Lets the # README quickstart rerun setup.sh safely without having to delete