feat: add optional --summaries semantic layer for PR deltas - #14
Merged
Conversation
Derive typed, normalized semantic facts (ciRollup, reviewDecision, mergeable,
state, isDraft, unresolvedReviewThreads, headSha) from the SAME observation that
produces the opaque change-detection fingerprints, so a fail-closed consumer can
read the observed semantic PR state without a second GitHub fetch.
- ciRollup: green|failed|pending|none. A PR with ZERO checks is 'none', never
'green', so fail-closed gates decide what no-CI means; fail-closed precedence
is failed > pending > green.
- Sibling delta.summary (never nested in `to`): delta.id and the report body are
byte-identical whether or not --summaries is set, so existing consumers see
zero diff; schemaVersion stays 1 per the additive-never-bumps policy.
- mergeable and reviewDecision kept as honest enums (unknown / none) rather than
collapsed to booleans, preserving GitHub's tri-state / not-yet-computed truth.
- Mirrored onto the outpost webhook payload under the same flag.
- Contract advertises DELTA_SUMMARY_FIELDS / DELTA_SUMMARY_ENUMS via
gh-delta/contract and --help-json, enough to build a Zod/JSON-Schema validator.
TDD against REAL captured GraphQL payloads (test/fixtures/summaries/, recorded
from live PRs on 2026-07-11) exercised through the real fetch->normalize->
fingerprint->summary path, covering none/green/pending/failed including the
in-progress {status:IN_PROGRESS, conclusion:''} shape. Adds CLI acceptance
(none->green ci-changed) and --help-json schema tests. 211 tests pass.
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.
Why
A downstream consumer (batutas) runs a fail-closed merge gate needing semantic facts —
ciRollup === 'green',mergeable,unresolvedThreads === 0. The v0.2 per-deltatofingerprint can't supply them:ci/review/reviewsare opaque change-detection digests (--detailmarks themopaque: true). Correct for "did CI change?", useless for "is CI green?" — forcing consumers into a second GitHub fetch.What
--summariesattaches an optional, normalizeddelta.summaryto every PR delta with an observedtostate, derived purely from the same observation that produced the fingerprints (no second fetch):Design invariants
delta.summary, never nested into.deltaIdentity()hashes onlyto/from/classes/missingTicks, so the content-addresseddelta.idand the whole report body stay byte-identical whether or not the flag is set. Existing consumers see zero diff.ciRollup: 'none', never'green'— fail-closed gates decide what "no CI" means. Precedence:failed > pending > green. Classification keys on bothstatusandconclusion, so an in-progress{status:'IN_PROGRESS', conclusion:''}CheckRun ispending, notgreen.mergeable:'unknown'/reviewDecision:'none'preserve GitHub's tri-state / not-yet-computed truth (merged PRs legitimately reportunknown).schemaVersionstays1per the repo's additive-never-bumps policy. Only--help-jsongrows (deltaSummaryFields/deltaSummaryEnums).Testing
TDD against real captured GraphQL payloads (
test/fixtures/summaries/, recorded from live PRs on 2026-07-11) run through the realfetchPRs → normalizePr → prFingerprint → prSummarypath, coveringnone(nodejs/node#64097),green(this repo #12),pending(nodejs/node#63949, real in-progress CheckRun),failed(react/react#36863). Plus CLI acceptance (none→greenci-changed, additive byte-stability) and--help-jsonschema tests. 211 tests pass; lint + prettier clean.Acceptance
ciRollup: 'none'; a green status ⇒ci-changeddelta withsummary.ciRollup: 'green'delta.id+ all fields byte-identical)docs/contract.mddocument the schema precisely enough to build a Zod/JSON-Schema validator (also machine-readable viagh-delta/contractand--help-json)Validated with a Codex blind-debate peer review (classification table checked against live GitHub enums; three scope gaps — outpost propagation,
DELTA_FIELDSexhaustiveness test, in-progress fixture coverage — folded in).Version bump is release-please-owned: this
feat:will drive0.2.0 → 0.3.0.