Skip to content

Commit 28b9754

Browse files
authored
Merge pull request #1210 from BitterSecurity/fix/ci-terminal-status-20261120
fix(ci): reject abandoned and incomplete dependency results
2 parents a2f99ce + ee43eab commit 28b9754

7 files changed

Lines changed: 272 additions & 4 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: verify-ci-aggregate
3+
description: Verify the OSS required CI aggregate against real Bash and GitHub dependency outcomes without hosted jobs or application execution.
4+
---
5+
6+
1. Launch: use a latest-main task worktree. Reuse the repository's locked dev
7+
environment; Bash, jq and Python3 must be available. No service is started.
8+
2. Doctor: confirm this task's current workflow, clean/changed inputs and the
9+
locally available historical commit be0892d55187c2ebb9ee24109020558241eaab14.
10+
Fetch that immutable commit if a shallow checkout lacks it; never reset a
11+
working tree to reproduce the old behavior.
12+
3. Drive: run service-harness inspect, verify and status from the task root.
13+
The behavior helper executes the actual ci-ok shell block with22 fixtures:
14+
successful/scoped-out jobs, unassigned/unfinished/unknown statuses, and missing
15+
or malformed results. Its historical mode reads the real old workflow in
16+
memory. Exit1 proves assertion failures; setup/parse/timeout errors exit2.
17+
4. Evidence: retain the runner's exact source fingerprint, Bash outputs and
18+
expected historical failures outside worktree cleanup. This verifies result
19+
aggregation, not hosted runner capacity, a full application suite or CI/CD
20+
success. Repository protections remain separate.
21+
The pinned runner currently rejects this repository's existing benchmark
22+
submodule directories before gate execution. Preserve them and report the
23+
limitation; manual gate output is not a successful harness receipt. Keep
24+
this correction in progress until required qualification is complete.
25+
5. Cleanup: there are no servers, containers or provider requests. Preserve
26+
unrelated work and remove the task worktree only after actual merge and
27+
clean/pushed/inactive checks. Keep all evidence.

‎.github/workflows/ci.yml‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,9 @@ jobs:
621621
#
622622
# Semantics: `skipped` is a PASS (the path-gated lanes legitimately
623623
# skip when their scope is untouched — see the `changes` job);
624-
# `failure` and `cancelled` are FAILs. `coverage-report` is excluded
624+
# Only `success` and `skipped` are accepted. Missing, unfinished or unknown
625+
# outcomes (including an unassigned runner's `abandoned`) fail closed.
626+
# `coverage-report` is excluded
625627
# by design: it is the informational, non-blocking lane.
626628
ci-ok:
627629
name: CI OK (required status)
@@ -640,13 +642,18 @@ jobs:
640642
runs-on: ubuntu-latest
641643
timeout-minutes: 5
642644
steps:
643-
- name: Verify no needed job failed or was cancelled
645+
- name: Verify needed jobs succeeded or were intentionally skipped
644646
env:
645647
RESULTS: ${{ toJSON(needs) }}
646648
run: |
647649
echo "$RESULTS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
648-
bad=$(echo "$RESULTS" | jq -r '[to_entries[] | select(.value.result == "failure" or .value.result == "cancelled")] | length')
650+
bad=$(echo "$RESULTS" | jq -er '
651+
if type != "object" or length == 0 then
652+
error("Expected a nonempty GitHub needs result object")
653+
else
654+
[to_entries[] | select(.value.result != "success" and .value.result != "skipped")] | length
655+
end')
649656
if [ "$bad" != "0" ]; then
650-
echo "::error::$bad required job(s) failed or were cancelled."
657+
echo "::error::$bad required job(s) did not succeed or intentionally skip."
651658
exit 1
652659
fi

‎AGENTS.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ release or require a version bump. SaaS identifiers remain independent.
4141

4242
Use Axum when adding or porting Rust HTTP server code.
4343

44+
# Required CI results
45+
46+
| Rule | Enforcement |
47+
|---|---|
48+
| CI aggregation accepts only success or intentional skipped results; incomplete, unknown and missing results fail. | Actual workflow Bash exercised by tests/ci/test_ci_aggregate.py, including the historical abandoned-run reproduction. |
49+
4450
<!-- entire-agent:begin -->
4551
Read .entire/agent-guide.md for this repository's workflow, source inspection, and verification guidance.
4652
@.entire/agent-guide.md

‎CHAGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Keep proposed and unmerged changes out of released sections.
1515

1616
## [Unreleased]
1717

18+
- Proposed CI verification correction ([#1210](https://github.com/BitterSecurity/Decepticon/pull/1210)): require every declared dependency to succeed or intentionally skip before CI OK passes. Reject abandoned, unknown and missing outcomes while preserving existing scope skips and protections. This corrects a false-positive aggregate after a hosted macOS runner could not be assigned; runner availability and actual hosted CI remain separate. [Verification](docs/verification/ci-required-terminal-results-20261120.md).
19+
1820
- Proposed [PR #1209](https://github.com/BitterSecurity/Decepticon/pull/1209) on the rust-anything streaming text experiment. Recorded parity held for 231 cases, while the Node native binding was slower in the local microbenchmark. See the [measured results](docs/verification/rust-anything-streaming-text-20261120.md).
1921

2022
- Live-capture qualification ([#1206](https://github.com/BitterSecurity/Decepticon/pull/1206)) for [#1198](https://github.com/BitterSecurity/Decepticon/pull/1198), unreleased: the public README-only Codex session is actually recorded with one completed turn and zero pending turns. Preserve local-only checkpoint policy, generated hook bytes, trust records and the canonical OSS checkout. No runtime/package/release change; process exit and commit checkpoint creation are not claimed. [Evidence](docs/operations/entire-public-live-capture-20261118.json).
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Required CI aggregate rejects incomplete outcomes
2+
3+
Actual main run44314841378 at be0892d5 failed when GitHub could not assign the
4+
Launcher macOS runner. The platform reported the job cancelled and supplied
5+
`launcher.result = abandoned` to the required aggregate. Its blacklist checked
6+
only failure/cancelled, so CI OK incorrectly succeeded. Runner capacity is a
7+
separate infrastructure issue; this change does not claim to repair it.
8+
9+
Accept only success and intentionally skipped dependencies. Refuse all other
10+
results and empty input objects. Preserve the existing dependency set, scope
11+
skips, matrix, permissions, pinned actions and workflow triggers. No package,
12+
application, publishing or release-version changes are introduced.
13+
14+
The standalone helper executes the actual workflow Bash block with22 fixtures
15+
in three unittest methods. Before the correction,13 bad inputs falsely passed,
16+
including the actual abandoned result. The fixed source preserves all three
17+
successful/scoped-out fixtures and rejects all19 bad fixtures. Historical mode
18+
loads the real immutable pre-fix shell in memory; assertion failures exit1 and
19+
infrastructure/parse/timeout errors exit2. No source reset or synthetic CI status
20+
is used. The same aggregation commands run locally and in the hosted workflow.
21+
22+
Ruff, formatting, narrow type checking, workflow YAML parsing and the executable
23+
source/historical assertions are local checks. Hosted runner availability,
24+
full application tests/builds and hosted CI success are separate and are not
25+
claimed by this scoped correction. No application server, target, provider or
26+
production deployment is needed to verify result aggregation.
27+
28+
The service-harness contract and project-local verification skill describe the
29+
required gates. Qualification by the pinned runner is still blocked: inspect
30+
and verify exit2 before running any gate with `Submodules need an explicit
31+
verification contract: benchmark/MHBench`. These existing benchmark gitlinks
32+
are unrelated to this correction. The pinned Rust source rejects directory
33+
inputs in workspace snapshotting, and its contract schema exposes no submodule
34+
contract field. No benchmark, index entry, runner or protection was modified to
35+
bypass this limitation. Status has no receipt to read. Manual gate results are
36+
recorded separately and are not represented as a successful harness receipt.
37+
38+
The later documentation-only main run44573832461 actually succeeded, including
39+
all three Launcher platforms. Its Python/Docker/telemetry lanes intentionally
40+
skipped according to scope. That result does not reproduce or negate the older
41+
runner failure, nor does it qualify this proposed correction. The Entire Brain
42+
seed is older and returned no durable intent evidence for this defect; actual
43+
GitHub job/aggregate logs and current source establish the reported behavior.

‎service-harness.toml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version = 1
2+
intent = "Require every declared CI dependency to succeed or intentionally skip; reject abandoned, unknown and missing results without weakening scope skips or repository protections."
3+
4+
[[gates]]
5+
id = "ci-aggregate-lint"
6+
kind = "static"
7+
argv = [".venv/bin/ruff", "check", "tests/ci/test_ci_aggregate.py"]
8+
timeout_seconds = 30
9+
10+
[[gates]]
11+
id = "ci-aggregate-format"
12+
kind = "static"
13+
argv = [".venv/bin/ruff", "format", "--check", "tests/ci/test_ci_aggregate.py"]
14+
timeout_seconds = 30
15+
16+
[[gates]]
17+
id = "ci-aggregate-behavior"
18+
kind = "behavior"
19+
argv = ["python3", "tests/ci/test_ci_aggregate.py"]
20+
timeout_seconds = 30
21+
22+
[gates.regression]
23+
argv = ["python3", "tests/ci/test_ci_aggregate.py", "--historical"]
24+
expected_exit = 1
25+
26+
[[flows]]
27+
id = "required-ci-terminal-results"
28+
behavior = "The real workflow shell accepts successful and scoped-out jobs while refusing every other observed or future result."
29+
gate = "ci-aggregate-behavior"
30+
entrypoints = [".github/workflows/ci.yml jobs.ci-ok"]
31+
preconditions = ["Bash and jq installed", "Historical immutable source available locally"]
32+
actions = ["Execute actual workflow shell with 22 dependency-result fixtures", "Run identical assertions against the real historical shell"]
33+
expected = ["success and skipped remain accepted", "abandoned and all other non-success outcomes fail", "Missing or malformed results fail", "Infrastructure errors cannot establish a historical regression"]

‎tests/ci/test_ci_aggregate.py‎

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
"""Execute the real CI aggregation shell with GitHub dependency outcomes."""
2+
3+
from __future__ import annotations
4+
5+
import argparse
6+
import json
7+
import os
8+
import re
9+
import shutil
10+
import subprocess
11+
import sys
12+
import unittest
13+
from pathlib import Path
14+
from typing import ClassVar
15+
16+
ROOT = Path(__file__).resolve().parents[2]
17+
HISTORICAL_COMMIT = "be0892d55187c2ebb9ee24109020558241eaab14"
18+
HISTORICAL = False
19+
JOBS = (
20+
"changes",
21+
"compose-validate",
22+
"python",
23+
"cli",
24+
"launcher",
25+
"docker-build",
26+
"docker-build-arm64",
27+
"security",
28+
"telemetry",
29+
"actionlint",
30+
)
31+
32+
33+
def aggregate_script(historical: bool) -> str:
34+
"""Read the single literal shell block in the actual ci-ok job.
35+
36+
This deliberately accepts only this job's existing shape, rather than
37+
pretending to parse arbitrary YAML. A changed/ambiguous shape is an
38+
infrastructure error, never a successful historical reproduction.
39+
"""
40+
for binary in ("bash", "jq"):
41+
if shutil.which(binary) is None:
42+
raise RuntimeError(f"Required local executable missing: {binary}")
43+
content = (
44+
subprocess.check_output(
45+
["git", "show", f"{HISTORICAL_COMMIT}:.github/workflows/ci.yml"],
46+
cwd=ROOT,
47+
text=True,
48+
)
49+
if historical
50+
else (ROOT / ".github/workflows/ci.yml").read_text()
51+
)
52+
lines = content.splitlines()
53+
starts = [i for i, line in enumerate(lines) if line == " ci-ok:"]
54+
if len(starts) != 1:
55+
raise RuntimeError("Expected exactly one ci-ok job")
56+
start = starts[0]
57+
end = next(
58+
(i for i in range(start + 1, len(lines)) if re.match(r"^ [\w-]+:", lines[i])),
59+
len(lines),
60+
)
61+
job = lines[start:end]
62+
blocks = [i for i, line in enumerate(job) if line == " run: |"]
63+
if len(blocks) != 1:
64+
raise RuntimeError("Expected one literal aggregation shell block")
65+
body: list[str] = []
66+
for line in job[blocks[0] + 1 :]:
67+
if line and not line.startswith(" "):
68+
break
69+
body.append(line[10:] if line else "")
70+
script = "\n".join(body)
71+
if not script.strip():
72+
raise RuntimeError("Aggregation shell block is empty")
73+
subprocess.run(["bash", "-n", "-c", script], check=True, capture_output=True)
74+
return script
75+
76+
77+
class CiAggregateTests(unittest.TestCase):
78+
script: ClassVar[str]
79+
80+
@classmethod
81+
def setUpClass(cls) -> None:
82+
cls.script = aggregate_script(HISTORICAL)
83+
84+
def assert_outcome(self, payload: str, expected: bool) -> None:
85+
result = subprocess.run(
86+
["bash", "-e", "-c", self.script],
87+
cwd=ROOT,
88+
env={**os.environ, "RESULTS": payload},
89+
capture_output=True,
90+
text=True,
91+
timeout=5,
92+
)
93+
if result.returncode in (126, 127):
94+
raise RuntimeError("Aggregation shell could not execute a required command")
95+
self.assertEqual(result.returncode == 0, expected, result.stdout + result.stderr)
96+
97+
def test_success_and_intentional_scope_skips(self) -> None:
98+
for status in ("success", "skipped"):
99+
with self.subTest(status=status):
100+
self.assert_outcome(
101+
json.dumps({job: {"result": status, "outputs": {}} for job in JOBS}),
102+
True,
103+
)
104+
mixed = {job: {"result": "success"} for job in JOBS}
105+
for job in ("python", "docker-build", "docker-build-arm64", "telemetry"):
106+
mixed[job] = {"result": "skipped"}
107+
self.assert_outcome(json.dumps(mixed), True)
108+
109+
def test_unfinished_and_unknown_outcomes_are_refused(self) -> None:
110+
for status in (
111+
"failure",
112+
"cancelled",
113+
"abandoned",
114+
"timed_out",
115+
"neutral",
116+
"stale",
117+
"action_required",
118+
"queued",
119+
"in_progress",
120+
"unknown",
121+
"",
122+
):
123+
with self.subTest(status=status):
124+
needs = {job: {"result": "success"} for job in JOBS}
125+
needs["launcher"] = {"result": status}
126+
self.assert_outcome(json.dumps(needs), False)
127+
128+
def test_missing_or_invalid_results_are_refused(self) -> None:
129+
for payload in (
130+
"{}",
131+
"[]",
132+
"null",
133+
'"success"',
134+
"not json",
135+
"",
136+
'{"launcher":{}}',
137+
'{"launcher":{"result":null}}',
138+
):
139+
with self.subTest(payload=payload):
140+
self.assert_outcome(payload, False)
141+
142+
143+
if __name__ == "__main__":
144+
parser = argparse.ArgumentParser()
145+
parser.add_argument("--historical", action="store_true")
146+
HISTORICAL = parser.parse_args().historical
147+
suite = unittest.defaultTestLoader.loadTestsFromTestCase(CiAggregateTests)
148+
outcome = unittest.TextTestRunner(verbosity=2).run(suite)
149+
# Setup, executable, parse and timeout errors cannot prove a regression.
150+
sys.exit(2 if outcome.errors else 0 if outcome.wasSuccessful() else 1)

0 commit comments

Comments
 (0)