Skip to content

feat(discovery-core): add incoming state sync orchestrator - #472

Merged
m-kus merged 1 commit into
mainfrom
pr-split/11-incoming-sync
Feb 18, 2026
Merged

m-kus merged 1 commit into
mainfrom
pr-split/11-incoming-sync

Conversation

@m-kus

@m-kus m-kus commented Feb 11, 2026 •

Copy link
Copy Markdown

TL;DR

Added a new sync module with an orchestrator for incoming state discovery that efficiently processes channels, subchannels, and notes.

What changed?

  • Created a new sync module in the discovery-core crate
  • Implemented incoming_state.rs with a hierarchical discovery system that:
    • Discovers incoming channels, subchannels, and notes in a coordinated way
    • Uses cursor-based pagination to handle large datasets efficiently
    • Processes channels and subchannels concurrently using FuturesUnordered
    • Tracks completion state to avoid redundant work
  • Added comprehensive tests that verify pagination behavior with precise budget control

This change is Reviewable

@m-kus
m-kus marked this pull request as ready for review February 11, 2026 16:09
@m-kus
m-kus requested a review from Yoni-Starkware February 11, 2026 16:09
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from 40a6e4f to 30a7894 Compare February 11, 2026 19:10
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from af02396 to 89e874c Compare February 11, 2026 19:10
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from 30a7894 to 7b2de5f Compare February 13, 2026 01:49
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch 2 times, most recently from 02f3de4 to e645277 Compare February 13, 2026 02:02
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch 2 times, most recently from 92649eb to b691a09 Compare February 13, 2026 02:07
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from e645277 to a115d06 Compare February 13, 2026 02:07
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from b691a09 to 75b642b Compare February 13, 2026 02:23
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from a115d06 to 51c907b Compare February 13, 2026 02:23
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from 75b642b to bffcfed Compare February 13, 2026 02:29
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from bc2e5e3 to f24f78e Compare February 17, 2026 13:56
@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from b31abb3 to 76537a9 Compare February 17, 2026 17:10
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from f24f78e to 3346354 Compare February 17, 2026 17:10

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Yoni-Starkware reviewed 4 files and all commit messages, and made 3 comments.
Reviewable status: 4 of 5 files reviewed, 3 unresolved discussions (waiting on m-kus).


crates/discovery-core/src/sync/incoming_state.rs line 91 at r2 (raw file):

    // On a fresh cursor this is vacuously true; on subsequent calls it fires
    // once all previously discovered channels have been fully processed.
    let channels = if cursor.all_channels_processed() {

Suggestion:

 let new_channels = 

crates/discovery-core/src/sync/incoming_state.rs line 115 at r2 (raw file):

    }

    let mut subchannels: Vec<IncomingSubchannel> = Vec::new();

Suggestion:

    let mut new_subchannels: Vec<IncomingSubchannel> = Vec::new();

crates/discovery-core/src/sync/incoming_state.rs line 211 at r2 (raw file):

            note.token = token;
            notes.push(note);
        }

For sanity, please check that they both were zeros before.
Or, have two structs - with and without these two fields

Code quote:

        // Enrich notes with sender and token context.
        for mut note in new_notes {
            note.sender_addr = sender_addr;
            note.token = token;
            notes.push(note);
        }

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:lgtm:

@Yoni-Starkware reviewed 1 file and made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on m-kus).

@m-kus
m-kus force-pushed the pr-split/10-last-note-index branch from 76537a9 to ca63ab0 Compare February 18, 2026 15:12
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from 3346354 to 2c854d5 Compare February 18, 2026 15:12
@m-kus
m-kus changed the base branch from pr-split/10-last-note-index to graphite-base/472 February 18, 2026 15:38
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from 2c854d5 to 3e19abe Compare February 18, 2026 15:59
@m-kus
m-kus force-pushed the graphite-base/472 branch from ca63ab0 to 32b8a83 Compare February 18, 2026 15:59
@m-kus
m-kus changed the base branch from graphite-base/472 to pr-split/10-last-note-index February 18, 2026 15:59

@m-kus m-kus left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@m-kus resolved 3 discussions.
Reviewable status: 4 of 6 files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@Yoni-Starkware Yoni-Starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:lgtm:

@Yoni-Starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on m-kus).

@m-kus
m-kus changed the base branch from pr-split/10-last-note-index to graphite-base/472 February 18, 2026 16:48
@m-kus
m-kus force-pushed the pr-split/11-incoming-sync branch from 3e19abe to 8190ce6 Compare February 18, 2026 16:52
@m-kus
m-kus force-pushed the graphite-base/472 branch from 32b8a83 to 633e7ec Compare February 18, 2026 16:52
@m-kus
m-kus changed the base branch from graphite-base/472 to main February 18, 2026 16:52
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.

2 participants