Skip to content

[feat][node] Add try_link/try_relink to Core - #133

Open
TheP2P (thep2p) wants to merge 2 commits into
mainfrom
thep2p/94-link-relink-decision-handlers
Open

[feat][node] Add try_link/try_relink to Core#133
TheP2P (thep2p) wants to merge 2 commits into
mainfrom
thep2p/94-link-relink-decision-handlers

Conversation

@thep2p

Copy link
Copy Markdown
Collaborator

Summary

  • Add try_link/try_relink to the Core trait and BaseCore, thin pass-throughs to LookupTable::try_link/try_relink returning LinkOutcome/RelinkOutcome.
  • No lock/decision logic duplicated; try_link/try_relink on ArrayLookupTable remain the sole write path.

Test plan

  • cargo fmt --check
  • make lint
  • cargo test

Closes #94

@thep2p
TheP2P (thep2p) requested a lite review from Copilot September 4, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_relink methods returning LinkOutcome / RelinkOutcome.
  • Implemented the new methods on BaseCore as direct pass-through calls to LookupTable.
  • 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 thread src/node/core.rs
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 thread src/node/core_test.rs
Comment on lines +24 to +29
let core = BaseCore::new(
span_fixture(),
origin_id,
random_membership_vector(),
Box::new(ArrayLookupTable::new()),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Node] Add: link/relink-decision handlers to Core

2 participants