Repository navigation
feat(context-engine): D3 P1 — fail-closed CI-status resolver (sha → tests_green) - #45
Merged
Merged
Conversation
…ests_green) Resolve the CI half of consolidate.py's deferred §9 attribution item: given owner/repo + a commit sha, report whether that commit's CI is green as the verbatim True | False | "unknown" contract cold.py stores. Queries GitHub's check-runs API via `gh api` (CL's subprocess idiom, no new dependency) behind an injectable seam so tests never touch the network; rollup mirrors OperationsCenter's get_failed_checks/get_incomplete_checks. Fail-closed: True only when >=1 run AND all completed cleanly; False on any failing conclusion; "unknown" on no runs, in-flight, unknown sha, missing token, non-zero exit, malformed JSON, or ANY exception — never raises, never True on doubt. Standalone + fully unit-tested; no caller wires it yet and the promotion gate is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ProtocolWarden
force-pushed
the
feat/d3-p1-ci-status
branch
from
July 17, 2026 01:23
1d97fd5 to
5317e62
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A small, read-only, fail-closed CI-status resolver: given
owner/repo+ a commitsha,resolve_ci_status(...)reports whether that commit's CI is green as the verbatimTrue | False | "unknown"valuecold.pystores.New module:
src/context_lifecycle/context_engine/ci_status.py.Why
consolidate._is_real_shadocuments itself as "a v1 stand-in … does NOT yet resolve the sha against the repo … the deferred §9 attribution item." The cold-store item (cold.py:66-67) already declares the target fieldsacted_on_commitandtests_green(true | false | "unknown", stored verbatim). This PR resolves the CI half of that §9 item, to feed the future D3 consequence-writer'stests_greenfield.Fail-closed rules (the whole point — never
Trueon doubt)commits/{sha}/check-runsviagh api(matches CL's subprocess idiom — no new dependency), behind an injectable_run_ghseam so tests never touch the network. Rollup (dedupe by name, keep newest run id) mirrors OperationsCenter'sget_failed_checks/get_incomplete_checks.tests_green = Trueiff ≥1 check run AND every runcompletedAND none failing/incomplete/doubtful.tests_green = Falseon any failing conclusion (failure/timed_out/cancelled/action_required/stale).tests_green = "unknown"on: no runs, a still-running run, a completed run with an unmodelled/null conclusion, an unknown sha, a missing token, a non-zeroghexit, malformed JSON, or any exception. The call is wrapped so it never raises to the caller.Scope
tests/test_ci_status.py, full doubt matrix). A later PR feeds the D3 consequence-writer.consolidate.gate_promotions/_is_real_sha)..custodian/config.yaml: the module's singleos.environ.copy()is the process-spawn layer forgh(inherits PATH/HOME, injects the caller's token asGH_TOKEN) — added toc13_allowed_pathswith the same spawn-layer rationale already granted topseudo_operator/sessions.py.Full suite green (429 passed);
ruff check .clean; custodian pre-push audit clean (0 findings).🤖 Generated with Claude Code