fix(github): preserve large numeric IDs during sync - #179
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed September 9, 2026, 7:05 AM ET / 11:05 UTC. ClawSweeper reviewWhat this changesPreserves exact GitHub numeric IDs during REST and GraphQL syncs and adds decoding and SQLite persistence regression coverage. Merge readiness⛔ Needs changes before merge - 1 item remains The fix remains necessary: main and v0.9.5 still decode provider IDs through floating point. No blocking correctness defect was found in this focused patch. Priority: P2 Review scores
Verification
How this fits togetherGitcrawl fetches GitHub repository, discussion, and workflow data into a local SQLite archive. Its JSON decoder feeds sync mappers that assign provider identities and preserve raw responses. flowchart LR
A[GitHub REST responses] --> C[Lossless JSON decoding]
B[GitHub GraphQL responses] --> C
C --> D[Sync field mapping]
D --> E[SQLite archive]
E --> F[Local search and exports]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep lossless decoding at the acquisition boundary and retain the explicit separation between preventing new corruption and repairing historical archives. Do we have a high-confidence way to reproduce the issue? Yes, from source: numeric IDs 9007199254740992 and 9007199254740993 collapse during current-main decoding and then collide in workflow snapshot validation. This review did not execute the regression. Is this the best way to solve the issue? Yes. A shared UseNumber decoder prevents precision loss before the existing compatible mappers and storage receive data, without introducing a competing ID conversion path. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against ad1b6f2f1241. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where users synchronizing GitHub data could archive rounded numeric IDs, merge distinct comments under one identity, or fail sync with a duplicate workflow-run error when IDs exceed floating-point precision.
Why This Change Was Made
Preserve JSON numbers at the GitHub acquisition boundary before untyped response maps reach the existing sync mappers and SQLite storage. One private decoder covers REST objects, paginated lists, envelope collections, and inner GraphQL data; it retains existing error wrapping, response closure, pagination, typed rate-limit decoding, and trailing-data behavior.
No mapper, schema, dependency, configuration, or workflow changes. Production delta is +11/-4 (net +7) for the shared lossless decode boundary; tests add 529 lines.
User Impact
Newly fetched repository, issue/PR, comment, review, and workflow IDs retain their exact numeric values, including adjacent IDs above the floating-point precision limit.
Previously stored suspect IDs remain unknown and unrepaired. This change does not rewrite existing archives, decode opaque GraphQL IDs, delete rows, or make a blanket resync a historical-repair procedure.
Evidence
9007199254740993decoded as9007199254740992; real HTTP-client-to-SQLite sync failed withworkflow snapshot contains duplicate run 9007199254740992.9007199254740991,9007199254740992,9007199254740993, and9223372036854775807remain exact across REST and GraphQL paths.GOWORK=off GOPROXY=off go test ./internal/github ./internal/syncer -run '^TestProviderIDs' -count=1: PASS.GOWORK=off GOPROXY=off go test ./internal/github ./internal/syncer -count=1: PASS (GitHub 5.448s; syncer 4.006s).git diff --checkand scopedgofmt -l: PASS.No release, runtime deployment, or production archive mutation is included.