-
-
Notifications
You must be signed in to change notification settings - Fork 105
fix(connectivity): restore peer mesh after aggregator #2041
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
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 introduces a #[freenet_test] macro that dramatically simplifies integration test authoring for the Freenet project. The macro automates boilerplate setup including node configuration, event aggregation, TestLogger initialization, and comprehensive failure reporting.
Key Changes:
- New
freenet-macroscrate with procedural macro for test setup automation - Comprehensive documentation in markdown files explaining macro usage and enhanced reporting
- Conversion of existing integration tests to use the new macro, reducing test code by ~50+ lines per test
- Addition of flush handle support in node building for proper event aggregation
- Deletion of docs/TESTING.md file (315 lines removed)
Reviewed Changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/freenet-macros/Cargo.toml | New crate configuration with dependencies for procedural macro support |
| crates/freenet-macros/src/lib.rs | Main macro entry point and documentation |
| crates/freenet-macros/src/parser.rs | Attribute parsing logic for macro configuration |
| crates/freenet-macros/src/codegen.rs | Code generation for expanded test functions |
| crates/freenet-macros/README.md | Comprehensive documentation for the macro |
| docs/debugging/testing-logging-guide.md | Updated guide with macro usage and enhanced reporting features |
| docs/TESTING.md | Deleted - content likely consolidated elsewhere |
| crates/core/tests/operations.rs | Converted tests to use new macro, significant code reduction |
| crates/core/tests/isolated_node_regression.rs | Converted tests to use new macro |
| crates/core/tests/error_notification.rs | Converted tests to use new macro |
| crates/core/tests/test_macro_example.rs | Example tests demonstrating macro features |
| crates/core/src/node/mod.rs | Added build_with_flush_handle method for event aggregation |
| crates/core/src/ring/mod.rs | Minor whitespace cleanup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e590035 to
33a7a18
Compare
|
@claude there will be any issues with reservations by doing this change? |
|
Claude finished @iduartgomez's task —— View job Analyzing reservation impact
AnalysisGood question! I've analyzed the changes and the reservation system. The short answer is: No, there should not be any issues with reservations from this change. Here's why: How Reservations WorkThe reservation system in
The Change in This PRThe key change in const EARLY_NETWORK_THRESHOLD: usize = 4;
let has_capacity = num_connections + num_reserved < max_connections;
if is_gateway
&& accepted
&& (num_connections == 0 || (num_connections < EARLY_NETWORK_THRESHOLD && has_capacity))
{
// Accept directly and register immediately
let connectivity_info = ConnectivityInfo::new_bootstrap(joiner.clone(), 1);
return Ok(Some(ConnectState::AwaitingConnectivity(connectivity_info)));
}Why This is Safe
Trace Through Early Network FormationLet's trace what happens when a gateway with 0 connections receives a join request:
ConclusionThe change is safe because it operates within the existing reservation framework rather than bypassing it. The early network acceptance logic only triggers when there's capacity ( |
Summary
FindOptimalPeerrequests have a viable candidate for peer↔peer linkstest_three_node_network_connectivityto require public peer ports and fail fast if the full mesh never forms, logging the final topology snapshot for triageKey Changes
Testing
cargo test --test connectivity test_three_node_network_connectivity -- --nocapturecargo make testNotes
op_state_manager.rsduring shutdown reproduces on the base branch and is outside the scope of this fix.