fix: relax hwlab v02 web asset probe

This commit is contained in:
Codex
2026-06-04 17:31:15 +00:00
parent f287720d75
commit fe1d034504
2 changed files with 22 additions and 2 deletions
+16
View File
@@ -174,6 +174,7 @@ assertCondition(gitMirrorSummary.githubInSync === false, "git mirror status summ
assertCondition(gitMirrorSummary.sourceInSync === true && gitMirrorSummary.gitopsInSync === false, "git mirror status must split source and gitops GitHub sync state", gitMirrorSummary);
const renderScript = v02ControlPlaneRenderScript("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
const renderScriptHash = v02ControlPlaneRefreshScriptHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
const sourceText = await Bun.file(new URL("./src/hwlab-g14.ts", import.meta.url)).text();
assertCondition(
renderScript.includes("git clone --shared --no-checkout \"$cicd_repo\" \"$worktree_dir\"")
&& renderScript.includes("git -C \"$worktree_dir\" checkout --detach \"$source_commit\"")
@@ -275,6 +276,21 @@ assertCondition(
"v0.2 PipelineRun service matrix must not build hwlab-cli because cli is short-connection source tool",
v02PipelineServiceIds(),
);
assertCondition(
sourceText.includes("curl -fsS --connect-timeout 2 --max-time 10")
&& !sourceText.includes("curl -fsS --connect-timeout 2 --max-time 5"),
"v0.2 web asset probes must not use a 5s app.js timeout that creates false deployment failures",
);
assertCondition(
sourceText.includes("printf 'probeElapsedMs\\\\t%s\\\\n'")
&& sourceText.includes("probeElapsedMs: numericField(fields.probeElapsedMs)"),
"v0.2 web asset probes must expose probeElapsedMs for timeout diagnostics",
);
assertCondition(
sourceText.includes("probe_start_s=$(date +%s")
&& !sourceText.includes("date +%s%3N"),
"v0.2 web asset elapsed timing must avoid non-portable date +%s%3N in k3s probe shells",
);
const staleSuccessAlignment = v02CommitAlignment({
expectedSourceHead: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+6 -2
View File
@@ -1073,15 +1073,16 @@ function v02WebAssetsProbeScript(): string {
`api=${shellQuote(V02_CLOUD_API_URL)}`,
"fetch_url() {",
" if command -v curl >/dev/null 2>&1; then",
" curl -fsS --connect-timeout 2 --max-time 5 \"$1\"",
" curl -fsS --connect-timeout 2 --max-time 10 \"$1\"",
" elif command -v wget >/dev/null 2>&1; then",
" wget -q -T 5 -O - \"$1\"",
" wget -q -T 10 -O - \"$1\"",
" else",
" return 127",
" fi",
"}",
"printf 'baseUrl\\t%s\\n' \"$base\"",
"printf 'apiUrl\\t%s\\n' \"$api\"",
"probe_start_s=$(date +%s 2>/dev/null || printf '0')",
"html=$(fetch_url \"$base/\" 2>/dev/null)",
"html_code=$?",
"printf 'htmlOk\\t%s\\n' \"$html_code\"",
@@ -1102,8 +1103,10 @@ function v02WebAssetsProbeScript(): string {
"printf 'cssBytes\\t%s\\n' \"$(printf '%s' \"$css\" | wc -c | tr -d ' ')\"",
"app_js=$(fetch_url \"$base/app.js\" 2>/dev/null)",
"app_js_code=$?",
"probe_end_s=$(date +%s 2>/dev/null || printf '0')",
"printf 'appJsOk\\t%s\\n' \"$app_js_code\"",
"printf 'appJsBytes\\t%s\\n' \"$(printf '%s' \"$app_js\" | wc -c | tr -d ' ')\"",
"printf 'probeElapsedMs\\t%s\\n' \"$(((probe_end_s - probe_start_s) * 1000))\"",
"fetch_url \"$base/styles.css\" >/dev/null 2>&1",
"legacy_styles_code=$?",
"if [ \"$legacy_styles_code\" = \"0\" ]; then legacy_styles_absent=1; else legacy_styles_absent=0; fi",
@@ -1284,6 +1287,7 @@ function v02WebAssetsFromText(
css: numericField(fields.cssBytes),
appJs: numericField(fields.appJsBytes),
},
probeElapsedMs: numericField(fields.probeElapsedMs),
apiRevision,
note: webAssetsRevisionNote(apiRevision, sourceCommit, activePipelineRuns),
exitCode,