Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a backend-agnostic repository test suite (run against the Postgres implementation) and refactors parts of the Postgres repository layer for consistency and improved transactional behavior, alongside a small service lifecycle tweak and optional Go test coverage reporting.
Changes:
- Introduces
internal/repository/repotestsuites + Postgres harness to exercise repository behavior end-to-end. - Refactors Postgres repository methods to use consistent
uint64SQL expressions, consistent sentinel errors (repository.ErrNotFound/repository.ErrNoUpdate), and improved transaction handling (including row-iterationrows.Err()checks). - Improves node/service creation error handling (avoid
os.Exit) and adds an optional Makefile coverage workflow.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/service/service.go | Avoids calling the first tick if the service context is already canceled. |
| internal/validator/validator_test.go | Trims whitespace in tests (no behavior change). |
| internal/repository/repotest/repotest.go | Adds shared repository test harness with per-subtest repo isolation. |
| internal/repository/repotest/builders.go | Adds builders + seeding helpers for repository integration tests. |
| internal/repository/repotest/application_test_cases.go | Adds application repository test coverage. |
| internal/repository/repotest/epoch_test_cases.go | Adds epoch repository test coverage. |
| internal/repository/repotest/input_test_cases.go | Adds input repository test coverage. |
| internal/repository/repotest/output_test_cases.go | Adds output repository test coverage (including transactional update assertions). |
| internal/repository/repotest/report_test_cases.go | Adds report repository test coverage. |
| internal/repository/repotest/state_hash_test_cases.go | Adds state-hash repository test coverage. |
| internal/repository/repotest/node_config_test_cases.go | Adds node-config repository test coverage. |
| internal/repository/repotest/claimer_test_cases.go | Adds claimer query/update repository test coverage. |
| internal/repository/repotest/commitment_test_cases.go | Adds commitment repository test coverage. |
| internal/repository/repotest/match_test_cases.go | Adds match repository test coverage. |
| internal/repository/repotest/match_advanced_test_cases.go | Adds match-advanced repository test coverage. |
| internal/repository/repotest/tournament_test_cases.go | Adds tournament repository test coverage. |
| internal/repository/repository.go | Introduces consistent sentinel errors (ErrNotFound, ErrNoUpdate) and minor parameter naming cleanup. |
| internal/repository/postgres/util.go | Simplifies application lookup predicate building and adds uint64Expr helper. |
| internal/repository/postgres/application.go | Adopts uint64Expr, adds rows.Err() checks, and aligns “not found” behavior for updates. |
| internal/repository/postgres/epoch.go | Uses uint64Expr, improves transaction rollback/commit patterns, adds batching for input inserts, and adds rows.Err() checks. |
| internal/repository/postgres/input.go | Uses uint64Expr and adds rows.Err() checks. |
| internal/repository/postgres/output.go | Uses uint64Expr, improves transaction handling, and adds rows.Err() checks. |
| internal/repository/postgres/report.go | Uses uint64Expr and adds rows.Err() checks. |
| internal/repository/postgres/state_hash.go | Uses uint64Expr and adds rows.Err() checks. |
| internal/repository/postgres/tournament.go | Uses uint64Expr, adds rows.Err() checks, and aligns “not found” error. |
| internal/repository/postgres/commitment.go | Uses uint64Expr and adds rows.Err() checks. |
| internal/repository/postgres/match.go | Uses uint64Expr, adds rows.Err() checks, and aligns “not found” error. |
| internal/repository/postgres/match_advanced.go | Uses uint64Expr and adds rows.Err() checks. |
| internal/repository/postgres/claimer.go | Runs read queries inside a transaction snapshot and uses repository.ErrNoUpdate for no-op updates. |
| internal/repository/postgres/bulk.go | Uses uint64Expr, improves transaction handling, and introduces batching for some updates. |
| internal/repository/postgres/repository.go | Makes retry sleeps context-aware to prevent long hangs on shutdown/cancel. |
| internal/repository/postgres/repository_error_test.go | Adds coverage for Postgres repository construction failure modes. |
| internal/repository/postgres/postgres_repo_test.go | Adds an integration harness that runs all repotest suites against Postgres. |
| internal/repository/factory/factory.go | Improves error messaging for unsupported connection string schemes. |
| internal/node/node.go | Refactors child service creation to return errors instead of exiting the process. |
| internal/claimer/claimer.go | Renames parameters to match repository interface changes. |
| Makefile | Adds optional coverage output generation and cleans coverage artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6d14d93 to
847f21d
Compare
renatomaia
previously approved these changes
Mar 2, 2026
847f21d to
0c869cb
Compare
0c869cb to
e865eec
Compare
renatomaia
previously approved these changes
Mar 2, 2026
e865eec to
c690c8c
Compare
renatomaia
approved these changes
Mar 2, 2026
mpolitzer
reviewed
Mar 2, 2026
mpolitzer
approved these changes
Mar 2, 2026
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.
No description provided.