Conversation
REV Review — fix/743-multihostAPPROVE Clean implementation. The approach is correct and minimal. What's good
Notes
No SOC2 items. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #751 +/- ##
==========================================
+ Coverage 67.40% 67.52% +0.13%
==========================================
Files 52 52
Lines 33667 33792 +125
==========================================
+ Hits 22690 22817 +127
+ Misses 10977 10975 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review: PR #751 — feat(connection): multi-host failoverRepo: NikolayS/rpg SummaryAdds CLI-level multi-host support ( BLOCKINGB1 — Priority inversion: CLI multi-host fires after conninfo single-host (confidence: 8)The priority comment says: But the actual code does not enforce this. Both URI and conninfo blocks The real bug: if a user passes Either the priority list is wrong, or the implementation is wrong. They need to be consistent. Pick one and document it clearly. B2 — Silent port parse failure: invalid port strings are silently dropped (confidence: 9)let port_parts: Vec<u16> = raw_ports
.split(',')
.filter_map(|s| s.trim().parse::<u16>().ok())
.collect();
Fix: Collect into B3 —
|
|
Fixed REV blocking findings:
All tests pass. |
REV Code Review Report
BLOCKING ISSUES (1)MEDIUM
NON-BLOCKING (2)LOW
LOW
POTENTIAL ISSUES (2)MEDIUM
LOW
Summary
Notes:
REV-assisted review (AI analysis by postgres-ai/rev) |
1 similar comment
REV Code Review Report
BLOCKING ISSUES (1)MEDIUM
NON-BLOCKING (2)LOW
LOW
POTENTIAL ISSUES (2)MEDIUM
LOW
Summary
Notes:
REV-assisted review (AI analysis by postgres-ai/rev) |
REV Code Review — PR #751PR: #751 — feat(connection): multi-host failover BLOCKING ISSUESHIGH
NON-BLOCKINGLOW
LOW
LOW
POTENTIAL ISSUESMEDIUM
MEDIUM
Summary
The core logic is solid — URI and conninfo multi-host paths are unchanged; the new CLI path is additive and well-guarded. The CI is currently red (cargo fmt only — fixed in latest push). Re-run expected to pass. REV-assisted review (AI analysis by postgres-ai/rev) |
|
REV PR #751 — feat(connection): multi-host failover Summary: Adds CLI-level multi-host support ( Observations:
Verdict: Logic is sound, tests are thorough. Points 1–2 are worth addressing before or shortly after merge. No blockers. |
|
REV #751 — feat(connection): multi-host failoverThis is the most consequential PR of the batch. Connection handling is a correctness-critical path. The implementation is generally sound but has a few things worth checking carefully. What's good
Concerns
Minor
Verdict: approve with caveats. Issue 2 (eprintln in resolver) is worth cleaning up. Issue 4 (IPv6) should be documented. The rest are acceptable for now. |
REV Code Review — PR #751: feat(connection): multi-host failoverCI: green | Diff scope: Blocking findingsNone. Non-blocking findings[BUG / LOW] In params.hosts = vec![(params.host.clone(), params.port)];
return;
[STYLE / LOW] The let port_parts: Result<Vec<u16>, _> = raw_ports
.split(',')
.filter(|s| !s.trim().is_empty())
.map(|s| s.trim().parse::<u16>())
.collect();This avoids the side-effect-in-closure pattern and makes the error path clearer. [DOCS / LOW] The comment says Potential issues (low confidence)[BEHAVIOR] Comma in host string is not validated at the single-host path If a user passes SummarySolid implementation. The |
REV Re-Review — PR #751 (fix/743-multihost)Branch: Changes reviewed in this passTwo commits since the last review (
BLOCKINGNone. NON-BLOCKING[BUG / LOW]
The let port_parts: Result<Vec<u16>, _> = raw_ports
.split(',')
.filter(|s| !s.trim().is_empty())
.map(|s| s.trim().parse::<u16>())
.collect();
match port_parts {
Ok(parts) => { /* use parts */ }
Err(_) => {
eprintln!("rpg: invalid port value in -p '{}'", raw_ports);
params.hosts = vec![(params.host.clone(), params.port)];
return;
}
}This also improves the error message: currently it prints the specific bad token but the POTENTIAL[BEHAVIOR / MEDIUM] No test for CLI multi-host + conninfo single-host combined (confidence: 6/10) The priority comment at line 808-811 says CLI [DOCS / LOW]
What's fixedBoth blocking findings from the previous review pass are resolved:
Summary
LGTM for merge. The core logic is correct and the previous blocking issues are resolved. The non-blocking REV-assisted review (AI analysis by postgres-ai/rev) |
|
CI is green and REV review found no blocking findings. This PR is ready for merge — awaiting Nik's approval. |
|
REV PR #751 — feat(connection): multi-host failover Good work. The Observations:
Nothing blocking. |
Testing evidence — multi-host failoverTested on Environment:
Test A: Two valid hosts — connects to first✅ First host wins, as expected. Test B: First host invalid — failover to second✅ Test C: Single host — backward compat✅ Single-host path unchanged. Code path: |
dbe403a to
d437864
Compare
Implements comma-separated multi-host connection with failover, matching psql/libpq semantics. - `rpg -h host1,host2 -p 5432` tries hosts in order, uses first that accepts a connection - Per-host ports supported: `-h host1,host2 -p 5432,5433` - Port reuse: fewer ports than hosts reuses the last port - URI and connstring forms already worked; now CLI flags work too - `-p` flag now accepts comma-separated port list (single port still works — backward-compatible) - resolve_hosts() extended with priority 3: CLI multi-host - 5 new unit tests covering single-port, per-host, port-reuse, positional args, and single-host regression - Integration tests i1/i2/i3 added (run via connection-tests CI job)
d437864 to
db25b59
Compare
Closes #743
Implements comma-separated multi-host connection with failover, matching psql/libpq semantics.
rpg -h host1,host2 -p 5432tries hosts in order, uses first that accepts connection-h host1,host2 -p 5432,5433-pflag accepts comma-separated port list (single port still works — fully backward-compatible)resolve_hosts()extended with priority 3: CLI multi-host (after URI and conninfo)Tests
5 new unit tests in
src/connection.rs:test_resolve_params_cli_multihost_single_port— single port applied to all hoststest_resolve_params_cli_multihost_per_host_ports— per-host port assignmenttest_resolve_params_cli_multihost_port_reuse— last port reused when fewer ports than hoststest_resolve_params_cli_multihost_positional— positional HOST arg with commastest_resolve_params_cli_single_host_regression— single-host path unchanged3 new integration tests in
tests/connection_paths.rs(Group I, run via connection-tests CI):i1_multihost_first_fails_second_succeeds— failover to second hosti2_multihost_all_fail— error message when all hosts unreachablei3_single_host_regression— single host still connects normallyExisting
f7_multihost_failovercanary test (issue #724) now exercises the same code path.All 1814 unit tests pass.