fix: import GitHub thread resolved state on crit pull#462
Merged
tomasz-tomczyk merged 1 commit intomainfrom May 5, 2026
Merged
fix: import GitHub thread resolved state on crit pull#462tomasz-tomczyk merged 1 commit intomainfrom
tomasz-tomczyk merged 1 commit intomainfrom
Conversation
REST /pulls/{n}/comments returns no thread-level isResolved bit, so when
a reviewer clicked Resolve on github.com (or invoked resolveReviewThread
via GraphQL), `crit pull` left local Comment.Resolved at false. The local
review file silently disagreed with the PR.
Fix: add a GraphQL fetch over reviewThreads { isResolved comments {
databaseId } } and join isResolved onto each imported comment by
databaseID. The bit is shared across the whole thread (root + replies),
so only the root's Resolved / ResolvedRound is updated; replies inherit
thread state implicitly via the parent. ResolvedRound is stamped from
cj.ReviewRound, mirroring the local `crit comment --resolve` semantics.
Conflict semantics (asymmetric, follows Body precedent):
- remote resolved + local unresolved -> set Resolved=true
- remote unresolved + local resolved -> KEEP local (no clobber)
- both same -> no-op
The asymmetry matters because crit doesn't push resolved state back to
GitHub, and a local user may resolve a thread via crit / crit-web
independently. A symmetric merge would silently undo that.
The GraphQL fetch is best-effort: a failure prints a warning and
proceeds with the existing REST-only merge, so token-scope or transient
GraphQL outages don't block a comment pull.
The previously-skipped roundtrip scenario
TestRoundtrip_GitHubThreadResolvedOnWeb is unskipped and passes against
crit-md/crit-roundtrip-sandbox.
Closes #453
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (32.35%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #462 +/- ##
==========================================
- Coverage 69.10% 68.75% -0.36%
==========================================
Files 36 36
Lines 10546 10634 +88
==========================================
+ Hits 7288 7311 +23
- Misses 2697 2762 +65
Partials 561 561
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:
|
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.
Summary
crit pullnow reads thread-levelisResolvedvia GraphQL (reviewThreads) and joins it onto imported comments by databaseID. Previously, resolves done on github.com (or via theresolveReviewThreadmutation) silently leaked past the localComment.Resolvedflag.TestRoundtrip_GitHubThreadResolvedOnWebin the e2e harness.Review
Test plan
go test -race -count=1 ./...green.crit-md/crit-roundtrip-sandboxpasses.Closes #453
🤖 Generated with Claude Code