Skip to content

fix: propagate local comment deletes to GitHub on push#461

Merged
tomasz-tomczyk merged 1 commit intomainfrom
fix-449-local-delete
May 5, 2026
Merged

fix: propagate local comment deletes to GitHub on push#461
tomasz-tomczyk merged 1 commit intomainfrom
fix-449-local-delete

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

Closes #449.

When a comment with GitHubID != 0 is deleted locally, append its GitHubID to a top-level pending_github_deletes list. crit push drains this list by issuing DELETE for each ID; crit pull's merge filters upstream comments whose ID is pending so they aren't resurrected before push runs.

Replies use the same mechanism — GitHub treats them as comments on the same /pulls/comments/{id} endpoint, so one list covers both.

omitempty on the slice ensures a fully-drained list disappears from review.json entirely; agents reading the file directly never see a stale empty array or per-record tombstone fields.

Race fix included

The daemon (long-lived process) and crit push (separate CLI invocation) both own a copy of the queue. The daemon's in-memory snapshot used to clobber disk on the next debounced write, resurrecting IDs that push had just drained. Reconciliation in buildCritJSON now treats disk as authoritative for the queue: in-memory IDs that vanished from disk (push drained them) are dropped from the snapshot; freshly-queued local deletes are preserved.

Exit-code fix included

Per-ID DELETE failures no longer fail the whole push when posts/patches succeeded. Exit 1 only when nothing succeeded AND something failed. Failed deletes stay in the queue for next-push retry.

Review

  • Code review: passed (go-expert)
  • Intent audit: passed
  • e2e roundtrip: TestRoundtrip_LocalDeletePropagates PASS

Test plan

  • `go test -race -count=2 ./...` — clean
  • `golangci-lint run ./...` — 0 issues
  • `./scripts/e2e-roundtrip.sh -run TestRoundtrip_LocalDeletePropagates` — PASS (deleted comment removed from upstream PR)

🤖 Generated with Claude Code

Closes #449

When a comment with GitHubID != 0 is deleted locally, append its
GitHubID to a top-level pending_github_deletes list. crit push drains
this list by issuing DELETE for each ID; pull's merge filters upstream
comments whose ID is pending so they aren't resurrected before push runs.

Replies use the same mechanism — GitHub treats them as comments on the
same /pulls/comments/{id} endpoint, so one list covers both.

omitempty on the slice ensures a fully-drained list disappears from
review.json entirely; agents reading the file directly never see a
stale empty array or per-record tombstone fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 76.27119% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.13%. Comparing base (ccd6e1f) to head (702c1fa).

Files with missing lines Patch % Lines
main.go 42.50% 21 Missing and 2 partials ⚠️
github.go 84.50% 6 Missing and 5 partials ⚠️
session.go 78.94% 2 Missing and 2 partials ⚠️
session_write.go 91.48% 2 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (76.27%) 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     #461      +/-   ##
==========================================
+ Coverage   68.94%   69.13%   +0.18%     
==========================================
  Files          36       36              
  Lines       10401    10546     +145     
==========================================
+ Hits         7171     7291     +120     
- Misses       2680     2695      +15     
- Partials      550      560      +10     
Flag Coverage Δ
e2e 33.00% <16.94%> (-0.28%) ⬇️
unit 66.61% <76.27%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk tomasz-tomczyk merged commit 67e1709 into main May 5, 2026
7 of 8 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix-449-local-delete branch May 5, 2026 12:00
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.

crit push does not propagate locally-deleted comments to GitHub

1 participant