Skip to content

Capture content-addressed Issue lifecycle preflight - #610

Merged
proerror77 merged 1 commit into
mainfrom
codex/issue-lifecycle-evidence-export
Aug 2, 2026
Merged

Capture content-addressed Issue lifecycle preflight#610
proerror77 merged 1 commit into
mainfrom
codex/issue-lifecycle-evidence-export

Conversation

@proerror77

@proerror77 proerror77 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Change contract

Add one read-only capture command that writes a canonical, scope-bound, content-addressed snapshot of the complete GitHub Issue/PR lifecycle graph and fails closed on incomplete or concurrent input.

Issue relationship

Closes #607

Out of scope

Dependencies and merge order

None.

Focused validation

  • .github/scripts/test-issue-lifecycle-preflight.sh: canonical byte identity and SHA sidecars; complete Issue/PR metadata; same-blob file handling; pagination closure and new-page race; missing relationship identity; comment/header/Issue-detail/closed-PR drift; real-gh nonzero 304 handling; and zero mutating GitHub routes.
  • .github/scripts/test-issue-lifecycle-audit.sh
  • .github/scripts/test-select-rust-ci-scope.sh
  • .github/scripts/test-issue-lifecycle-contract.sh
  • ruby .github/scripts/test-issue-lifecycle-workflow.rb
  • ruby .github/scripts/test-issue-lifecycle-reconcile-workflow.rb
  • ruby -c, bash -n, shellcheck, actionlint, and git diff --check
  • Read-only live seams: GraphQL relationship identity fields resolve; Issue, PR, commits, files, reviews, review-comments, check-runs, and statuses endpoints expose ETags; an authenticated matching conditional GET returns 304 without consuming core quota.

The formal full live capture is deliberately deferred to the separate retained evidence branch/PR after #607-#609 land.

Rollout and rollback

No runtime rollout. CI only executes the fixture test; the capture command has no write/apply operation and runs only when explicitly invoked. Roll back by reverting this PR.

Scope exception

None. The diff is 3 files and 747 non-generated lines.

Summary by CodeRabbit

  • New Features

    • Added a read-only tool to capture issue and pull-request lifecycle evidence, including repository relationships, request metadata, and integrity checks.
    • Produces validated, checksummed evidence bundles with consistent JSON manifests.
  • Bug Fixes

    • Prevents incomplete or unstable captures from producing partial output and reports clear validation errors.
  • Tests

    • Added comprehensive integration coverage for pagination, reordered data, concurrent changes, incomplete responses, checksums, and failure handling.
    • Added the capture contract test to continuous integration.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a read-only Ruby tool that captures GitHub issue and pull-request lifecycle data into canonical, checksummed evidence bundles. It adds integration coverage for deterministic output, validation failures, API safety, and CI execution.

Changes

Lifecycle capture

Layer / File(s) Summary
Read-only API and canonical data handling
.github/scripts/issue-lifecycle-preflight.rb
The tool canonicalizes JSON and reads paginated REST and GraphQL data. It validates identities, relationships, completeness, API metadata, and readback stability.
Issue graph and pull-request evidence
.github/scripts/issue-lifecycle-preflight.rb
The capture flow assembles issue relationships and metadata. It collects pull-request commits, files, reviews, comments, checks, and statuses with counts and hashes.
Capture workflow and evidence bundle
.github/scripts/issue-lifecycle-preflight.rb
The CLI validates options, builds manifests, writes canonical JSON and SHA-256 sidecars atomically, and reports errors with exit status 2.
Integration contract and CI execution
.github/scripts/test-issue-lifecycle-preflight.sh, .github/workflows/ploy-ci.yml
The integration test validates normal, reordered, incomplete, and drifted responses. It checks bundle schemas, checksums, counts, request safety, and cleanup. CI runs the test.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant CaptureCLI
  participant GitHubReadOnly
  participant GitHubAPI
  participant EvidenceBundle
  Operator->>CaptureCLI: run capture with repository and scope options
  CaptureCLI->>GitHubReadOnly: capture issue graph and pull-request evidence
  GitHubReadOnly->>GitHubAPI: perform paginated GET and GraphQL reads
  GitHubAPI-->>GitHubReadOnly: return lifecycle data and request metadata
  GitHubReadOnly->>GitHubAPI: perform stability readback
  GitHubAPI-->>GitHubReadOnly: return comparison data
  GitHubReadOnly-->>CaptureCLI: return validated graph and evidence
  CaptureCLI->>EvidenceBundle: write canonical JSON and SHA-256 manifests
  EvidenceBundle-->>Operator: report capture result
Loading

Possibly related issues

  • proerror77/monday issue 608: Its verification operation is designed to validate the evidence bundle produced by this PR.
  • proerror77/monday issue 459: This PR implements the immutable preflight export required for the evidence workflow.
  • proerror77/monday issue 455: This PR provides the read-only lifecycle capture used by the planned audit and validation flow.
  • proerror77/monday issue 609: This PR produces the read-only evidence bundle required as input for restoration planning.

Possibly related PRs

  • proerror77/monday#470: It provides a related GitHubReadOnly abstraction and overlapping issue/PR relationship capture, while this PR adds canonical evidence bundling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main capture functionality added by the pull request.
Description check ✅ Passed The description includes all required sections and provides clear scope, validation, dependency, rollout, and rollback details.
Linked Issues check ✅ Passed The implementation and tests address the capture, canonicalization, completeness, stability, manifest, and read-only requirements in #607.
Out of Scope Changes check ✅ Passed The changes are limited to the capture command, its focused integration test, and CI execution of that test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-lifecycle-evidence-export

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proerror77
proerror77 enabled auto-merge (squash) August 2, 2026 13:15
@proerror77
proerror77 merged commit 071a38b into main Aug 2, 2026
46 of 47 checks passed
@proerror77
proerror77 deleted the codex/issue-lifecycle-evidence-export branch August 2, 2026 13:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
.github/scripts/issue-lifecycle-preflight.rb (1)

527-529: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the shadowed exception class.

OptionParser::ParseError inherits from RuntimeError, so StandardError already covers it. RuboCop reports Lint/ShadowedException here. Keep only StandardError.

♻️ Proposed simplification
-rescue OptionParser::ParseError, StandardError => error
+rescue StandardError => error
   warn "ERROR issue lifecycle preflight: #{error.message}"
   exit 2
 end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/issue-lifecycle-preflight.rb around lines 527 - 529, Update
the rescue clause in the issue lifecycle preflight error handling to remove the
redundant OptionParser::ParseError entry and rescue only StandardError,
preserving the existing error message and exit behavior.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/issue-lifecycle-preflight.rb:
- Around line 51-75: Update the GraphQL request handling for RELATIONSHIP_QUERY
to send the `GraphQL-Features: sub_issues` header whenever querying `parent`,
`subIssues`, or other sub-issue relationship fields. Ensure the existing
relationships flow consistently includes this header for live requests,
including calls made through `relationships`.
- Around line 433-441: Update the count validations in the pull-request capture
flow around commits, files, and review_comments so GitHub’s capped API lists are
not treated as incomplete when pagination ends normally. Use an appropriate
truncation-aware signal or alternate cap source, and record the condition
explicitly or otherwise avoid raising a hard failure while preserving genuine
incomplete-response detection.
- Around line 500-504: The manifest currently asserts the hardcoded "github.v4"
value instead of the captured GraphQL response value. Update the configuration
around graphql_media_type to derive it from the observed media_type stored by
record_page, while leaving rest_version and rest_accept unchanged.

---

Nitpick comments:
In @.github/scripts/issue-lifecycle-preflight.rb:
- Around line 527-529: Update the rescue clause in the issue lifecycle preflight
error handling to remove the redundant OptionParser::ParseError entry and rescue
only StandardError, preserving the existing error message and exit behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aef136a6-07bd-4615-abec-cf07a007d4f1

📥 Commits

Reviewing files that changed from the base of the PR and between 69e42c1 and e24e922.

📒 Files selected for processing (3)
  • .github/scripts/issue-lifecycle-preflight.rb
  • .github/scripts/test-issue-lifecycle-preflight.sh
  • .github/workflows/ploy-ci.yml

Comment thread .github/scripts/issue-lifecycle-preflight.rb
Comment thread .github/scripts/issue-lifecycle-preflight.rb
Comment thread .github/scripts/issue-lifecycle-preflight.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capture content-addressed Issue lifecycle preflight evidence

1 participant