Fix: Prevent cancelled jobs from appearing as failures in CI#137
Fix: Prevent cancelled jobs from appearing as failures in CI#137
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request refactors SyntaxKit's architecture by introducing new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant SyntaxParser
participant SwiftSyntax as SwiftParser/SwiftSyntax
participant TokenVisitor
participant TreeNode
participant JSONEncoder
Client->>SyntaxParser: parse(code: String)
SyntaxParser->>SwiftSyntax: SwiftParser.parse(source:)
SwiftSyntax-->>SyntaxParser: SourceFileSyntax AST
SyntaxParser->>TokenVisitor: TreeNodeProtocol.parseTree(from:)
TokenVisitor->>TokenVisitor: Create SourceLocationConverter
TokenVisitor->>TokenVisitor: Instantiate TokenVisitor<TreeNode>
TokenVisitor->>SwiftSyntax: rewrite(syntax) via SyntaxRewriter
loop for each Syntax node
SwiftSyntax->>TokenVisitor: visitPre(node)
TokenVisitor->>TreeNode: Create NodeType instance
TokenVisitor->>TokenVisitor: appendStructure(from:allChildren:)
TokenVisitor->>TokenVisitor: Link parent/child relationships
SwiftSyntax->>TokenVisitor: visit(token) for leaf nodes
TokenVisitor->>TreeNode: Store token kind + trivia
SwiftSyntax->>TokenVisitor: visitPost(node)
TokenVisitor->>TokenVisitor: Restore parent context
end
TokenVisitor-->>SyntaxParser: [TreeNode] array
SyntaxParser->>JSONEncoder: encode([TreeNode])
JSONEncoder-->>Client: [TreeNode] (or deprecated JSON)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v0.0.4 #137 +/- ##
==========================================
+ Coverage 78.00% 78.13% +0.13%
==========================================
Files 126 126
Lines 4555 4555
==========================================
+ Hits 3553 3559 +6
+ Misses 1002 996 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Review: Fix: Prevent cancelled jobs from appearing as failures in CIThe core change — the Critical: Build failures silently bypass the aggregatorFile: If any build job (e.g. if: ${{ !cancelled() && !failure() && ... }}When Fix option A — have all-done:
if: always()
needs: [lint, docs, build-ubuntu, build-macos, build-macos-full, build-windows, build-android]Fix option B — treat skipped lint/docs as a signal of upstream failure: - name: Check for failures
run: |
lint_result="${{ needs.lint.result }}"
docs_result="${{ needs.docs.result }}"
failures="${{ contains(needs.*.result, 'failure') }}"
if [[ "$failures" == "true" ]]; then
echo "One or more required jobs failed."
exit 1
fi
if [[ "$lint_result" == "skipped" || "$docs_result" == "skipped" ]]; then
echo "lint or docs were skipped, likely due to an upstream build failure."
exit 1
fiOption A is simpler and more robust — it covers any future jobs added to Minor: Shell expression interpolation styleThe - name: Fail on job failures
if: contains(needs.*.result, 'failure')
run: |
echo "One or more required jobs failed."
exit 1
- name: All checks passed
run: echo "All required checks passed, were skipped, or were cancelled."cleanup-caches.yml — looks goodThe cleanup-pr-caches.yml — looks goodTriggered on codeql.yml — looks goodThe Summary
The |
Code ReviewSummaryTheall-done aggregator pattern is the right approach for making required status checks work correctly with matrix/conditional jobs. A few things to consider.Issues1. The PR description says this fixes cancelled jobs appearing as failures, but the aggregator only monitors 2. All-cancelled scenario passes silently The current check only fails on 3. Branch protection rules not updated This job works as a required check only if All Done is added as a required status check in the GitHub repo branch protection settings. That is a manual step outside this PR — worth noting in the PR description or follow-up so it does not get forgotten. Positives
|
PR Review: Fix: Prevent cancelled jobs from appearing as failures in CIThe approach is sound - an aggregator job with Issue: Incomplete
|
Code Review: Prevent cancelled jobs from appearing as CI failuresClear intent, well-known pattern. A few notes: Positives
Concerns
Summary: Pattern is sound. The main question is whether all-cancelled-passes is acceptable for branch protection policy here. |
Code ReviewSummary: Adds an all-done aggregator job so that cancelled jobs do not surface as failures in PR checks. This is a well-known pattern for GitHub Actions and the implementation is correct. What looks good:
One question worth confirming: The aggregator depends on Verdict: Looks correct and addresses the false-failure problem cleanly. No changes needed. |
|
PR 137 Code Review - Fix: Prevent cancelled jobs from appearing as failures in CI The implementation follows the standard pattern for this problem and is correct for the stated goal. Logic analysis
Minor gap: all-skipped case If both lint and docs are skipped due to event filtering, all-done will succeed with no jobs having actually run. A stricter check would also verify Important follow-up action The fix is only effective if All Done is configured as the sole required status check in branch protection. Without that, individual cancelled job statuses will still be evaluated. Consider adding a comment in the workflow documenting this requirement so future maintainers understand why the aggregator exists. No test changes needed - purely CI configuration. |
Code Review: Fix - Prevent cancelled jobs from appearing as failures in CIThis is a targeted, well-understood fix for a common GitHub Actions pain point. Positives
Issues / Suggestions
Summary: This is correct and follows the standard GitHub Actions aggregator pattern. The concern about cancellation-only runs is edge-case and likely acceptable given the PR's intent. Approve. |
|
Title: PR Review: Fix: Prevent cancelled jobs from appearing as failures in CI Content: Incomplete needs list in all-done job Positives
The PR achieves its stated goal. The main suggestion is to widen the needs list if build jobs should also be gated. |
PR Review: Fix: Prevent cancelled jobs from appearing as failures in CIThe aggregator pattern is the correct solution here — using Correctness
The job depends on Cancelled jobs treated as success — this is intentional and correct per the PR description. The Minor IssuesPR description / CodeRabbit summary is misleading The auto-generated CodeRabbit summary mentions features that don't appear in this diff: CodeQL security analysis, cache cleanup workflows, new module architecture ( Nits
Summary: The change is correct and minimal. Main ask is to verify the transitive dependency chain covers all required build jobs, and to clean up the PR description. |
- configure outputs separate ubuntu-os/swift/type arrays (matching MonthBar pattern) - build-ubuntu composes matrix from all three outputs; wasm/wasm-embedded types use swift:6.3-noble container; type and wasmtime-version: 41.0.3 passed to swift-build - Remove separate build-wasm job - Android: add swift 6.3 alongside 6.2, add free-disk-space step, android-swift-version/android-api-level/android-run-tests parameters, coverage upload Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix Windows matrix to use proper cross-product (runs-on × swift) instead of mismatched include entries - Fix lint/docs if conditions to guard against null head_commit on PR events - Fix cache cleanup to skip tag deletions (only process branch deletes) - Add cancellation guard to build-macos-full - Remove hardcoded swift:6.3-noble container for WASM builds; use matrix version - Add paths-ignore to CodeQL to skip doc-only commits Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
swift-docc-plugin 1.4.6 is incompatible with Swift 6.1 on Windows (missing Lock, SnippetExtractor, ParsedSymbolGraphArguments types). Windows matrix now covers 6.2 and 6.3 only. WASM/wasm-embedded tooling does not support Swift 6.0 or 6.1 on Ubuntu, so those combinations are excluded from the build matrix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ilures Cancelled jobs from concurrent workflow runs show as red failures in PR checks. The all-done job depends on lint and docs (which aggregate all build jobs), runs with if: always(), and only fails on real failures — not cancellations or skips. Configure branch protection to require All Done as the single required check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3bd7913 to
89776f7
Compare
Code ReviewOverviewThis PR adds an What Works Well
Issues and Suggestions1. Aggregator may miss upstream build failures
Recommended fix: include all build jobs in all-done:
needs: [lint, docs, build-ubuntu, build-macos, build-windows, build-macos-full, build-android]2. Skipped jobs silently treated as success The success message groups passed, skipped, and cancelled jobs together, but these have meaningfully different causes. A skipped job often signals an upstream failure. Consider whether unexpected skips should also trigger a failure. 3. Branch protection rules For this aggregator to protect branches, the SummaryThe core approach is correct. The main concern is that upstream build failures may not reach |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code ReviewPR: Fix: Prevent cancelled jobs from appearing as failures in CI Summary of ChangeThe final diff is a focused 6-line change to the push trigger in Before: FeedbackCorrectness - addresses the root cause well Switching from an exclusion list to an explicit allowlist is the right fix. Cancelled jobs are typically caused by concurrent runs on short-lived feature branches triggering CI unnecessarily. Restricting push-based CI to Potential concern - PR checks With this change,
If Simplification win The commit history shows an earlier, more complex approach (an Minor: tag pattern coverage The pattern VerdictCorrect and well-motivated change. Primary thing to verify before merging: |
Summary
Test plan
🤖 Generated with Claude Code
Perform an AI-assisted review on
Summary by CodeRabbit
New Features
Chores
Tests