[feat][node] Add try_link/try_relink to Core - #133
Open
TheP2P (thep2p) wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new Core::try_link error documentation is inaccurate relative to the wrapped LookupTable::try_link contract (notably out-of-range level), which can mislead callers about how to handle errors.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR expands the node-local Core API surface with try_link/try_relink decision helpers, implemented as thin delegations to the underlying LookupTable primitives, and adds unit tests to validate the delegation behavior.
Changes:
- Added
Core::try_link/Core::try_relinkmethods returningLinkOutcome/RelinkOutcome. - Implemented the new methods on
BaseCoreas direct pass-through calls toLookupTable. - Added unit tests covering basic delegation behavior and out-of-range error propagation.
File summaries
| File | Description |
|---|---|
src/node/core.rs |
Extends the Core trait and BaseCore implementation with try_link/try_relink wrappers. |
src/node/core_test.rs |
Adds unit tests for the new wrapper methods and adjusts test setup patterns. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+69
to
+71
| /// **CRITICAL, INTERNAL** — propagated from a failed decision on the local | ||
| /// lookup table: a broken local invariant, not evidence of anything a | ||
| /// peer sent. |
Comment on lines
+24
to
+29
| let core = BaseCore::new( | ||
| span_fixture(), | ||
| origin_id, | ||
| random_membership_vector(), | ||
| Box::new(ArrayLookupTable::new()), | ||
| ); |
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.
Summary
try_link/try_relinkto theCoretrait andBaseCore, thin pass-throughs toLookupTable::try_link/try_relinkreturningLinkOutcome/RelinkOutcome.try_link/try_relinkonArrayLookupTableremain the sole write path.Test plan
cargo fmt --checkmake lintcargo testCloses #94