-
-
Notifications
You must be signed in to change notification settings - Fork 107
fix(test): change auto_connect_peers default to true #2221
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
The freenet_test macro now defaults to auto_connect_peers = true, eliminating the need to explicitly set this in most tests. Changes: - Default auto_connect_peers from false to true in parser.rs - Remove redundant auto_connect_peers = true from 15 test attributes - Update test_macro_example.rs comments to reflect new default This simplifies test configuration since the majority of tests want peers to auto-connect to gateways. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR changes the default value of auto_connect_peers from false to true in the #[freenet_test] macro, reflecting the common usage pattern where most tests need peers to auto-connect to gateways.
Key Changes
- Updated default
auto_connect_peersvalue in macro parser - Removed 15 redundant explicit
auto_connect_peers = truedeclarations from test files - Updated comments in example tests to reflect the new default behavior
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/freenet-macros/src/parser.rs |
Changed default value of auto_connect_peers from false to true in the macro parser |
crates/core/tests/operations.rs |
Removed 10 redundant auto_connect_peers = true declarations |
crates/core/tests/connectivity.rs |
Removed 3 redundant auto_connect_peers = true declarations |
crates/core/tests/test_macro_example.rs |
Removed 2 redundant declarations and updated comments to indicate auto_connect_peers is now the default |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude Please do a critical review of this PR |
|
Claude finished @sanity's task —— View job Critical Review of PR #2221SummaryThis PR changes the default value of ✅ Strengths
❌ Critical Issues - Documentation Not Updated1. lib.rs Documentation Incorrect (BLOCKING)Location: Current (WRONG): /// - `auto_connect_peers` (optional): If true, peer nodes are configured to connect to all gateway nodes (default: false)
Should be: /// - `auto_connect_peers` (optional): If true, peer nodes are configured to connect to all gateway nodes (default: true)
2. lib.rs Example Misleading (BLOCKING)Location: Current example shows: /// ## Auto-Connect Peers to Gateways
/// ```ignore
/// #[freenet_test(
/// nodes = ["gateway", "peer-1", "peer-2"],
/// auto_connect_peers = true, // Peers will connect to gateway
Since
3. README.md Documentation Incorrect (BLOCKING)Location: Current (WRONG): #### `auto_connect_peers`
Automatically configure all peer nodes to connect to all gateway nodes.
#[freenet_test(
nodes = ["gateway", "peer-1", "peer-2"],
auto_connect_peers = true // Peers auto-connect to gateway
)]
**Behavior:**
- When `true`: Peers are pre-configured with gateway connection info
- When `false` (default): You must manually configure peer connectionsIssues:
Should be: #### `auto_connect_peers`
Automatically configure all peer nodes to connect to all gateway nodes.
**Behavior:**
- When `true` (default): Peers are pre-configured with gateway connection info
- When `false`: You must manually configure peer connections
**Example - Using the default**:
#[freenet_test(
nodes = ["gateway", "peer-1", "peer-2"]
// auto_connect_peers defaults to true
)]
**Example - Disabling auto-connect**:
#[freenet_test(
nodes = ["gateway", "peer-1", "peer-2"],
auto_connect_peers = false // Manual connection setup required
)]4. README.md Multiple Redundant Examples (MINOR)Locations: Lines 37, 92, 117 Several examples throughout the README show 🔍 Code Quality AssessmentImplementation (parser.rs)✅ Correct: The change on line 53 from Test CleanupI verified the following test files were correctly updated:
Observation: The comments in 🧪 Impact AnalysisI searched the entire codebase for tests using
🎯 Required Changes Before MergeAll of these are BLOCKING - the documentation must match the implementation:
🤔 Edge Cases ConsideredI specifically checked for scenarios where this change could break things:
Final VerdictCHANGES REQUESTED - Documentation Must Be Updated The core implementation is solid and well-tested. The change itself is a clear improvement that reduces boilerplate and better reflects common usage patterns. However, the documentation is critically out of sync with the code change. Three separate documentation files need updates to reflect the new default value. This is blocking because:
Once all documentation is updated to reflect |
- Update lib.rs to show default: true - Change lib.rs example to show how to disable auto_connect_peers - Update README.md to document true as default - Remove redundant auto_connect_peers = true from README examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for the thorough review! I've addressed all the documentation issues: Commit 23db769e:
[AI-assisted - Claude] |
|
The whole point of thee tests is to tedt network with partial connectivity @sanity |
Problem
Most tests in the codebase need
auto_connect_peers = truein the#[freenet_test]macro to work properly. The previous default wasfalse, requiring explicit configuration in nearly every test.This supersedes #2031 which was based on a stale branch from November 21, 2025 (96+ commits behind main).
This Solution
Change the default value of
auto_connect_peersfromfalsetotruein the freenet_test macro parser. This better reflects the common usage pattern where tests want peers to auto-connect to gateways.Changes
crates/freenet-macros/src/parser.rs: Change defaultauto_connect_peersfromfalsetotruecrates/core/tests/operations.rs: Remove 10 redundantauto_connect_peers = truelinescrates/core/tests/connectivity.rs: Remove 3 redundantauto_connect_peers = truelinescrates/core/tests/test_macro_example.rs: Remove 2 redundant lines and update commentsTesting
test_put_with_subscribe_flagpasses locally (this was the failing test in PR fix(test): convert multi-gateway test to use freenet_test macro with partial connectivity #2031)Notes
The original PR #2031 also included a
peer_connectivity_ratiofeature for partial connectivity testing. That feature is not included here as it wasn't essential for the fix and can be added in a follow-up PR if needed.Closes #2031
🤖 Generated with Claude Code