Capture content-addressed Issue lifecycle preflight - #610
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesLifecycle capture
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
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/scripts/issue-lifecycle-preflight.rb (1)
527-529: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the shadowed exception class.
OptionParser::ParseErrorinherits fromRuntimeError, soStandardErroralready covers it. RuboCop reportsLint/ShadowedExceptionhere. Keep onlyStandardError.♻️ 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
📒 Files selected for processing (3)
.github/scripts/issue-lifecycle-preflight.rb.github/scripts/test-issue-lifecycle-preflight.sh.github/workflows/ploy-ci.yml
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-ghnonzero 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.shruby .github/scripts/test-issue-lifecycle-workflow.rbruby .github/scripts/test-issue-lifecycle-reconcile-workflow.rbruby -c,bash -n,shellcheck,actionlint, andgit diff --checkThe 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
Bug Fixes
Tests