From 96d1bb212eb2dca9b1ea6abbe3172ed09dbdec36 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 16 Jun 2026 21:52:47 -0400 Subject: [PATCH] fix(ci): weekly cron drift detection fires on audit failure (iter 70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iter 69 wired drift detection into the weekly cron. But the conditional `if: steps.prior-artifact.outputs.has_prior == 'true'` skipped the drift steps whenever the audit step exited non-zero — i.e., whenever the audit alerted on HIGH severity. Result: drift detection ran on healthy weeks but SKIPPED on the weeks that mattered most. The drift report would be missing exactly when forensics needed it. WHAT SHIPPED .github/workflows/oia-audit-weekly.yml — three step conditionals upgraded: - Download prior week's audit artifact: Before iter 70: default conditional (skipped on audit-step failure) After iter 70: if: always() - Compute structural drift vs prior week: Before: if: steps.prior-artifact.outputs.has_prior == 'true' After: if: always() && steps.prior-artifact.outputs.has_prior == 'true' - Upload drift trend artifact: Same upgrade. The `always() && ` syntax fires the step in BOTH success and failure cases of prior steps, AS LONG AS the prior-artifact download succeeded. This is the documented GHA idiom for "this step is forensic and should run even when upstream failed". WHY THIS IS THE LOAD-BEARING SCENARIO A regression that adds a HIGH-severity finding is exactly the case where drift evidence is most valuable: - The audit step says "HIGH worst severity → workflow fails" - The user opens the Actions tab to see what broke - Pre-iter-70: drift report is missing → user has to manually diff against prior artifact - Post-iter-70: drift report is one click away, and the comparison shows whether this regression is a sudden spike or a gradual creep The drift-trend artifact's 90-day retention means even if the user notices weeks later, the structural-distance log is intact. SMOKE STEP 17z33 anchors: - `if: always() && steps.prior-artifact.outputs.has_prior == 'true'` literal present (catches the 3 drift-step conditionals as a group) - Download step has `if: always()` (line after id: prior-artifact) - Rationale comment present ("skipped drift exactly when it was most valuable") GATES THIS ITER smoke: 72 → 73 (step 17z33 green) yaml: python yaml.safe_load passes workflow: 3 conditionals upgraded, no schema break ITER 69-70 ARC 69 — wired drift detection into the weekly cron 70 — ensured drift detection ALSO fires on the failure path The autonomous drift-detection promise from iter 69 is now ACTUALLY autonomous — including the weeks where someone needs the evidence most urgently. Co-Authored-By: RuFlo --- .github/workflows/oia-audit-weekly.yml | 12 ++++++++++-- plugins/ruflo-metaharness/scripts/smoke.sh | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oia-audit-weekly.yml b/.github/workflows/oia-audit-weekly.yml index 73a2dd040d..648e038d8e 100644 --- a/.github/workflows/oia-audit-weekly.yml +++ b/.github/workflows/oia-audit-weekly.yml @@ -73,8 +73,13 @@ jobs: # fastpath made it cheap (~1.4s). Now every Sunday's run diffs # against the most recent prior weekly artifact and surfaces the # structural distance + alert. + # iter 70 — `if: always()` so drift detection fires EVEN when the + # audit step exits non-zero (HIGH alert). The pre-iter-70 default + # conditional skipped drift exactly when it was most valuable: + # the weeks where something was breaking. - name: Download prior week's audit artifact (if any) id: prior-artifact + if: always() continue-on-error: true run: | set +e @@ -102,7 +107,8 @@ jobs: GH_TOKEN: ${{ github.token }} - name: Compute structural drift vs prior week (iter 69) - if: steps.prior-artifact.outputs.has_prior == 'true' + # iter 70 — always() AND has-prior: fires on the failure path too + if: always() && steps.prior-artifact.outputs.has_prior == 'true' run: | set -e # iter-67 fastest path: --baseline-file skips audit-list + memory roundtrip @@ -129,7 +135,9 @@ jobs: echo "Alert status: \`$ALERT\`" >> $GITHUB_STEP_SUMMARY - name: Upload drift trend artifact - if: steps.prior-artifact.outputs.has_prior == 'true' + # iter 70 — same always() pattern; the trend artifact is most + # useful for forensics when the workflow has failed. + if: always() && steps.prior-artifact.outputs.has_prior == 'true' uses: actions/upload-artifact@v4 with: name: drift-trend-${{ github.run_id }} diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh index f915a807d5..abf138eee0 100755 --- a/plugins/ruflo-metaharness/scripts/smoke.sh +++ b/plugins/ruflo-metaharness/scripts/smoke.sh @@ -191,6 +191,17 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \ grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough" [[ -z "$miss" ]] && ok || bad "$miss" +step "17z33. weekly cron drift detection fires even on audit failure (iter 70)" +miss="" +F="$ROOT/../../.github/workflows/oia-audit-weekly.yml" +# All 3 drift steps now use always() so audit-step exit-1 doesn't skip them +grep -q "if: always() && steps.prior-artifact.outputs.has_prior == 'true'" "$F" 2>/dev/null || miss="$miss no-conditional-always" +# Download step also has if: always() (line AFTER id: prior-artifact) +grep -A1 "id: prior-artifact" "$F" 2>/dev/null | grep -q "if: always()" || miss="$miss no-download-always" +# Comment explains the rationale +grep -q "skipped drift exactly when it was most valuable" "$F" 2>/dev/null || miss="$miss no-rationale-comment" +[[ -z "$miss" ]] && ok || bad "$miss" + step "17z32. weekly cron computes drift vs prior artifact (iter 69)" miss="" F="$ROOT/../../.github/workflows/oia-audit-weekly.yml"