@@ -159,7 +159,49 @@ jobs:
159159 uses : actions/download-artifact@v4
160160 with :
161161 name : ${{ inputs.lifecycle_preflight_artifact }}
162- path : ${{ env.LIFECYCLE_LOCAL_ROOT }}
162+ path : ${{ runner.temp }}/lifecycle-preflight
163+
164+ - name : Restore lifecycle preflight inputs
165+ if : inputs.lifecycle_preflight_artifact != ''
166+ env :
167+ PREFLIGHT_BUNDLE_ROOT : ${{ runner.temp }}/lifecycle-preflight
168+ SNAPSHOT_CHECKOUT_PATH : ${{ inputs.snapshot_checkout_path }}
169+ shell : bash
170+ run : |
171+ set -euo pipefail
172+ case "$SNAPSHOT_CHECKOUT_PATH" in
173+ external/*) ;;
174+ *) echo "::error::snapshot_checkout_path must remain under external/"; exit 1 ;;
175+ esac
176+ if [[ "$SNAPSHOT_CHECKOUT_PATH" == *".."* ]]; then
177+ echo "::error::snapshot_checkout_path must not contain traversal segments"
178+ exit 1
179+ fi
180+ if find "$PREFLIGHT_BUNDLE_ROOT" -type l -print -quit | grep -q .; then
181+ echo "::error::lifecycle preflight artifact must not contain symlinks"
182+ exit 1
183+ fi
184+ lifecycle_source="$PREFLIGHT_BUNDLE_ROOT/data/lifecycle_store"
185+ snapshot_source="$PREFLIGHT_BUNDLE_ROOT/$SNAPSHOT_CHECKOUT_PATH/data/output"
186+ if [ ! -d "$lifecycle_source" ] || [ ! -d "$snapshot_source" ]; then
187+ echo "::error::lifecycle preflight artifact is missing required allowlisted directories"
188+ exit 1
189+ fi
190+ snapshot_root="$GITHUB_WORKSPACE/$SNAPSHOT_CHECKOUT_PATH"
191+ resolved_snapshot_root="$(realpath "$snapshot_root")"
192+ case "$resolved_snapshot_root" in
193+ "$GITHUB_WORKSPACE"/external/*) ;;
194+ *) echo "::error::snapshot checkout resolved outside the external workspace"; exit 1 ;;
195+ esac
196+ if find "$snapshot_root" -type l -print -quit | grep -q .; then
197+ echo "::error::snapshot checkout must not contain symlinks"
198+ exit 1
199+ fi
200+ snapshot_target="$snapshot_root/data/output"
201+ rm -rf -- "$LIFECYCLE_LOCAL_ROOT" "$snapshot_target"
202+ mkdir -p "$LIFECYCLE_LOCAL_ROOT" "$GITHUB_WORKSPACE/$SNAPSHOT_CHECKOUT_PATH/data/output"
203+ cp -a "$lifecycle_source/." "$LIFECYCLE_LOCAL_ROOT/"
204+ cp -a "$snapshot_source/." "$snapshot_target/"
163205
164206 - name : Build lifecycle performance snapshots
165207 run : quant-lifecycle monitor --domain ${{ inputs.strategy_domain }}
0 commit comments