Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
ci: degrade an unreadable checks response to a full run instead of a hard failure
[._.]/ Adam Eivya0bc19e66fe0
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex c01a993ccc..9506e64243 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -57,7 +57,11 @@ jobs:- name: Select affected test surfacesid: planenv:- CI_FORCE_FULL: ${{ github.event_name != 'pull_request' }}+ # `inputs.full` is only decisive for a caller that invokes this+ # reusable workflow from a pull_request-triggered workflow — every+ # call site in this repo comes from a push, which the first clause+ # already covers. It stays honored so the declared input is real.+ CI_FORCE_FULL: ${{ github.event_name != 'pull_request' || inputs.full == true }}# The planner turns a PR into `release` into a full plan: that PR is# the single gate a release ships behind, so it never runs scoped.CI_BASE_REF: ${{ github.base_ref }}diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 9aa0defb05..95fac783e7 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -465,7 +465,7 @@ function main() {const base = process.env.CI_BASE_SHA;const head = process.env.CI_HEAD_SHA || 'HEAD';if (!forceFull && !base) {- throw new Error('CI_BASE_SHA is required unless CI_FORCE_FULL=true.');+ throw new Error('CI_BASE_SHA is required unless the run is forced full (CI_FORCE_FULL=true or CI_BASE_REF=release).');}const changedFiles = forceFull? []diff --git a/scripts/verify-ci-status.js b/scripts/verify-ci-status.jsindex dc21bcf94c..17eaf66885 100644--- a/scripts/verify-ci-status.js+++ b/scripts/verify-ci-status.js@@ -71,8 +71,13 @@ const capture = (command, args) => {return result.stdout.trim();};-// null = the checks API could not be reached, [] = it answered with no gate.-// Both end the release at "unverified", but only the first is worth a warning.+// null = the checks API could not be answered for this sha, [] = it answered+// with no gate. Both end the release at "unverified", but only the first warns.+//+// The parse is guarded because an unreadable answer must degrade to "run the+// full suite", not throw: an uncaught throw here fails the verify job, and the+// release then reports a hard error instead of simply re-testing the tree.+// A 200 carrying non-JSON (proxy/captive-portal HTML) is the realistic case.function fetchCheckRuns(repo, sha) {const query = `check_name=${encodeURIComponent(FULL_CI_GATE_CHECK_NAME)}&filter=latest`;const body = capture('gh', ['api', `repos/${repo}/commits/${sha}/check-runs?${query}`]);@@ -80,7 +85,19 @@ function fetchCheckRuns(repo, sha) {console.warn(`⚠️ Checks API unreachable for ${sha.slice(0, 8)} — treating it as unverified.`);return null;}- return JSON.parse(body).check_runs || [];+ return parseCheckRuns(body, sha);+}++/** check_runs from a `/check-runs` response body, or null when unreadable. */+export function parseCheckRuns(body, sha = '') {+ let parsed;+ try {+ parsed = JSON.parse(body);+ } catch {+ console.warn(`⚠️ Unreadable checks response for ${String(sha).slice(0, 8)} — treating it as unverified.`);+ return null;+ }+ return Array.isArray(parsed?.check_runs) ? parsed.check_runs : [];}function emit(verified, reason) {diff --git a/scripts/verify-ci-status.test.js b/scripts/verify-ci-status.test.jsindex 47d05859db..a53ef3f100 100644--- a/scripts/verify-ci-status.test.js+++ b/scripts/verify-ci-status.test.js@@ -8,6 +8,7 @@ import {FULL_CI_GATE_CHECK_NAME,findVerifiedSha,hasPassingGate,+ parseCheckRuns,parseCommitSummary,} from './verify-ci-status.js';@@ -63,6 +64,25 @@ describe('hasPassingGate', () => {});});+describe('parseCheckRuns', () => {+ it('returns the check runs from a well-formed response', () => {+ expect(parseCheckRuns(JSON.stringify({ check_runs: [passingGate] }))).toEqual([passingGate]);+ });++ it('reads a gate-less answer as empty, not unreadable', () => {+ expect(parseCheckRuns(JSON.stringify({ check_runs: [] }))).toEqual([]);+ expect(parseCheckRuns(JSON.stringify({ total_count: 0 }))).toEqual([]);+ });++ it('degrades an unreadable body to null instead of throwing', () => {+ // A 200 carrying non-JSON (proxy / captive-portal HTML) must fall back to+ // running the full suite, not fail the verify job and block the release.+ expect(() => parseCheckRuns('<html>nope</html>')).not.toThrow();+ expect(parseCheckRuns('<html>nope</html>')).toBeNull();+ expect(parseCheckRuns('null')).toEqual([]);+ });+});+describe('findVerifiedSha', () => {const headTree = 'tree-head';const gated = (...shas) => vi.fn((sha) => (shas.includes(sha) ? [passingGate] : []));