-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add external repair API (Phase 4) #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a0f6009 to
9d61aac
Compare
5033582 to
11bc499
Compare
9d61aac to
71e3120
Compare
17d3865 to
210adfe
Compare
71e3120 to
18bce8f
Compare
210adfe to
b3a914c
Compare
18bce8f to
dd564b5
Compare
Review: PR #6 - External Repair API (Phase 4)Verdict: ✅ Approve with minor suggestions This provides the operator "escape hatch" for manual recovery when automatic mechanisms fail. Strengths
API DesignPOST /api/v1/repair
{
"source": "mainnet",
"integration": "seaport",
"start_block": 18000000,
"end_block": 18000100,
"force_all_providers": true,
"dry_run": false
}Clean, RESTful, well-documented. Issues Found
Suggestions
Main Routesmux.Handle("/api/v1/repair", wh.Authn(wh.HandleRepairRequest))
mux.Handle("/api/v1/repair/", wh.Authn(wh.HandleRepairStatus))
mux.Handle("/api/v1/repairs", wh.Authn(wh.HandleListRepairs))Properly behind authentication. Good Phase 4 implementation. Minor fix needed for force_all_providers. |
|
Review findings:
Suggest clarifying intended behavior (delete-only vs delete+reindex) and aligning code + runbook/spec before merge. |
dd564b5 to
aef31d2
Compare
b3a914c to
4d3526b
Compare
aef31d2 to
65772b6
Compare
4d3526b to
08230d4
Compare
Merge activity
|
Important improvements: - Fix context cancellation in background goroutine with timeout - Add table name validation for SQL injection hardening - Fix block verification idempotency to preserve audit progress - Add force_all_providers parameter test Context management: - Background repairs now derive context from HTTP request with generous timeout - Prevents resource leaks when clients disconnect mid-repair - Timeout scales with block range (1 hour per 1000 blocks, minimum 10 minutes) SQL injection hardening: - Validate table names against integration config before SQL interpolation - Defense-in-depth approach protects against future refactoring risks State machine idempotency: - Block verification updates now preserve non-terminal audit states - Only resets 'failed', 'receipt_unverified', 'retrying' states to 'pending' - Preserves 'healthy', 'verifying', 'pending' states during repairs Test improvements: - Add unit test validating force_all_providers parameter acceptance - Integration test in repair_integration_test.go covers full execution path - All existing repair tests pass with race detector Addresses important issues from professional code review. Co-Authored-By: Warp <agent@warp.dev>
65772b6 to
a81af2c
Compare

Why:
Implements the External Repair API (Phase 4 of SEN-68) to allow manual
re-verification and re-indexing of block ranges. This provides an
operator "escape hatch" for correcting data inconsistencies that automatic
mechanisms might miss or fail to recover.
Includes:
Test plan: