test(integration): take the suite's ports from the environment - #434
Conversation
|
Warning Review limit reached
Next review available in: 36 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (49)
📝 WalkthroughWalkthroughIntegration-test ports now resolve from environment variables with defaults, and all affected proxy/Postgres connection helpers and tests dereference the new lazy port values. ChangesRuntime integration test port configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cipherstash-proxy-integration/src/common.rs`:
- Around line 67-72: Update the environment-variable parsing match around
std::env::var in the port configuration logic to distinguish
VarError::NotPresent from VarError::NotUnicode. Return the default only for
NotPresent, and panic with a clear misconfiguration message for NotUnicode
instead of silently using the default port.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 57d425b3-424d-411d-9b31-8cd230844ffb
📒 Files selected for processing (49)
packages/cipherstash-proxy-integration/src/common.rspackages/cipherstash-proxy-integration/src/connection_resilience.rspackages/cipherstash-proxy-integration/src/decrypt/insert_returning.rspackages/cipherstash-proxy-integration/src/diagnostics.rspackages/cipherstash-proxy-integration/src/disable_mapping.rspackages/cipherstash-proxy-integration/src/empty_result.rspackages/cipherstash-proxy-integration/src/encryption_sanity.rspackages/cipherstash-proxy-integration/src/eql_regression.rspackages/cipherstash-proxy-integration/src/extended_protocol_error_messages.rspackages/cipherstash-proxy-integration/src/insert/insert_domain_type.rspackages/cipherstash-proxy-integration/src/insert/insert_with_params.rspackages/cipherstash-proxy-integration/src/map_concat.rspackages/cipherstash-proxy-integration/src/map_literals.rspackages/cipherstash-proxy-integration/src/map_match_index.rspackages/cipherstash-proxy-integration/src/map_nulls.rspackages/cipherstash-proxy-integration/src/map_ope_index_order.rspackages/cipherstash-proxy-integration/src/map_ope_index_where.rspackages/cipherstash-proxy-integration/src/map_ore_index_order.rspackages/cipherstash-proxy-integration/src/map_ore_index_where.rspackages/cipherstash-proxy-integration/src/map_params.rspackages/cipherstash-proxy-integration/src/map_unique_index.rspackages/cipherstash-proxy-integration/src/migrate/mod.rspackages/cipherstash-proxy-integration/src/multitenant/contention.rspackages/cipherstash-proxy-integration/src/multitenant/ore_order.rspackages/cipherstash-proxy-integration/src/multitenant/set_keyset_id.rspackages/cipherstash-proxy-integration/src/multitenant/set_keyset_name.rspackages/cipherstash-proxy-integration/src/passthrough.rspackages/cipherstash-proxy-integration/src/pipeline.rspackages/cipherstash-proxy-integration/src/schema_change.rspackages/cipherstash-proxy-integration/src/select/distinct_order_by.rspackages/cipherstash-proxy-integration/src/select/indexing.rspackages/cipherstash-proxy-integration/src/select/jsonb_array_elements.rspackages/cipherstash-proxy-integration/src/select/jsonb_containment_index.rspackages/cipherstash-proxy-integration/src/select/jsonb_fusion_gaps.rspackages/cipherstash-proxy-integration/src/select/jsonb_path_query.rspackages/cipherstash-proxy-integration/src/select/jsonb_selector_param_types.rspackages/cipherstash-proxy-integration/src/select/operator_backed_predicates.rspackages/cipherstash-proxy-integration/src/select/operator_class_shapes.rspackages/cipherstash-proxy-integration/src/select/pg_catalog.rspackages/cipherstash-proxy-integration/src/select/select_where_in.rspackages/cipherstash-proxy-integration/src/select/select_where_jsonb.rspackages/cipherstash-proxy-integration/src/select/unmappable.rspackages/cipherstash-proxy-integration/src/set_keyset_error.rspackages/cipherstash-proxy-integration/src/simple_protocol/error_handling.rspackages/cipherstash-proxy-integration/src/simple_protocol/map_literals.rspackages/cipherstash-proxy-integration/src/simple_protocol/map_nulls.rspackages/cipherstash-proxy-integration/src/simple_protocol/multiple_statements.rspackages/cipherstash-proxy-integration/src/update/update_domain_type.rspackages/cipherstash-proxy-integration/src/update/update_with_reused_param.rs
The four ports the integration suite connects to were hardcoded, so only one copy of the suite could run at a time. Several agents each working on a different Proxy defect need their own Proxy and PostgreSQL, which means their own ports. Each port now reads an environment variable and falls back to the current value, so an unconfigured run behaves exactly as before. A malformed value panics rather than falling back: silently retargeting the whole suite at whatever else is listening on 6432 is the one failure that looks like a pass.
bf72e2f to
94ab953
Compare
…efaulting std::env::var returns NotUnicode when the variable is set but not valid UTF-8; treating every Err as unset silently fell back to the default port — the exact silent-misdirection port_from_env exists to prevent. Addresses review feedback on #434.
Prerequisite for the three plaintext-leak fixes stacked on top of this branch (CIP-3680, CIP-3682, CIP-3688). Small and standalone.
Why
The four ports the integration suite connects to were hardcoded (
pub const PROXY: u16 = 6432), so only one copy of the suite could run at a time. Fixing three separate Proxy defects in parallel needs three Proxy instances against three databases, which needs three sets of ports.What
PROXY,PROXY_METRICS_PORT,PG_PORTandPG_TLS_PORTbecomeLazyLock<u16>readingCS_TEST_PROXY_PORT,CS_TEST_PROXY_METRICS_PORT,CS_TEST_PG_PORTandCS_TEST_PG_TLS_PORT, each falling back to its current value. An unconfigured run behaves exactly as before.A malformed value panics rather than falling back to the default. Silently retargeting the whole suite at whatever else happens to be listening on 6432 is the one failure mode that looks like a pass.
Note for anyone running the suite on custom ports
mise execoverridesCS_DATABASE__PORTfrom the parent shell, becausemise.tomlsets it to5532:Re-assert it inside:
mise exec -- env CS_DATABASE__PORT=5541 cargo …. TheCS_TEST_*variables introduced here are not set inmise.toml, so they pass through fine. Tests that run the migrate CLI in-process also needCS_SERVER__PORTset, since that CLI reads it to find Proxy.Testing
cargo check -p cipherstash-proxy-integration --testsclean;cargo fmtclean. Behaviour with no environment variables set is unchanged by construction.Acknowledgment
By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.
Summary by CodeRabbit