Skip to content

Conversation

@benjamin-stacks
Copy link

Description

Applicable issues

Additional info (benefits, drawbacks, caveats)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo

The observer is now a pure data struct without any methods. All
functionality lives in the dispatcher; the observer just contains the
info where to send the data.

This is a largely mechanical change: cut & paste; delete now duplicate
`delete_payload` method; fix references.
No functional changes, only moving things around
@@ -0,0 +1,322 @@
use std::path::PathBuf;
Copy link
Member

Choose a reason for hiding this comment

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

Hey! Please add the copyright header to each source file. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

Ah, good call, will do. Is "Stacks Open Internet Foundation" still the correct copyright holder?

Also, there's a whole bunch of files that lack that header, I'm wondering if there's a good way to automate this.

Copy link
Author

Choose a reason for hiding this comment

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

Since the code in new files is just cut & paste from
`event_dispatcher.rs`, I kept the same header from there, but bumped
the year to 2025.
This is the final step to making `EventObserver` a "dumb" data object
that simply reflects the configuration of the registered observer.

Most of this change is straightforward. There is one thing that's worth
a mention, and that's the `ProposalCallbackHandler`, a concept that was
added in stacks-network#4228.
Because block proposal validation happens on a dedicated thread, those
validation events are handled a little specially.

Since `send_payload` now needs a dispatcher instance as the source of
the `db_path`, the list of observers alone is no longer enough.

For now I've elected to simply add the DB path to the
ProposalCallbackHandler and keep a non-method version of `send_payload`
around that gets the DB path passed in. Eventually I may have to clone
the dispatcher, but for now this approach had the smallest blast radius.

There wasn't any test coverage for this special behavior (at least not
on the event dispatcher side -- there are [some tests](https://github.com/stacks-network/stacks-core/blob/45381558f5e79554fc6e7930b0c4091e739e4992/stackslib/src/net/api/tests/postblock_proposal.rs#L234)
on the API side of things), so I added that as well.
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 75.72816% with 275 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.73%. Comparing base (3da96c1) to head (35060dc).
⚠️ Report is 35 commits behind head on develop.

Files with missing lines Patch % Lines
stacks-node/src/event_dispatcher/payloads.rs 46.87% 119 Missing ⚠️
stacks-node/src/event_dispatcher/tests.rs 85.35% 93 Missing ⚠️
stacks-node/src/event_dispatcher/stacker_db.rs 9.43% 48 Missing ⚠️
stacks-node/src/event_dispatcher/db.rs 93.21% 15 Missing ⚠️

❌ Your project check has failed because the head coverage (67.73%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (3da96c1) and HEAD (35060dc). Click for more details.

HEAD has 50 uploads less than BASE
Flag BASE (3da96c1) HEAD (35060dc)
88 38
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #6762       +/-   ##
============================================
- Coverage    78.18%   67.73%   -10.46%     
============================================
  Files          580      584        +4     
  Lines       361096   361345      +249     
============================================
- Hits        282312   244741    -37571     
- Misses       78784   116604    +37820     
Files with missing lines Coverage Δ
stacks-node/src/event_dispatcher.rs 38.31% <ø> (-47.06%) ⬇️
stacks-node/src/event_dispatcher/db.rs 93.21% <93.21%> (ø)
stacks-node/src/event_dispatcher/stacker_db.rs 9.43% <9.43%> (ø)
stacks-node/src/event_dispatcher/tests.rs 85.35% <85.35%> (ø)
stacks-node/src/event_dispatcher/payloads.rs 46.87% <46.87%> (ø)

... and 316 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3da96c1...35060dc. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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