Skip to content

Conversation

@benjamin-stacks
Copy link
Contributor

@benjamin-stacks benjamin-stacks commented Jan 9, 2026

I recommend commit-by-commit review.

  1. a48a100: uses a less brittle mechanism to find out what the id of the just-inserted DB record is
  2. 41717b4: just some refactoring that bundles multiple individual parameters into a single struct
  3. 0d62bd4: add a time stamp column to the event observer DB so we know when an event payload was stored

... instead of using unnamed tuples and long parameter lists.
This will allow us to output warnings if the (non-blocking) delivery
gets too far behind, because we can tell how long it took between
enqueuing the event and actually sending it.

This commit adds another migration to said database, so I slightly
refactored the migration code.
Ok((name, col_type))
})?;

let mut payload_is_blob = None;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to modify the database to actually store a database number now?? cause then you just would check "If version exists, use version, if not, its database schema 0?" Unless we don't anticipate any further database changes in which case maybe this is just fine, but I could see this getting needlessly complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea if this DB is going to change much in the future. I also wasn't sure there should really be a one-off migration mechanism for this one DB; it seems like that should be shared functionality.

That's why I went with the compromise: Split out the detection of the current migration version from the migration itself. Since that detection is contained completely inside get_schema_version, it would make it easy to later replace it with a DB-stored identifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think we might as well version it.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 96.63462% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.39%. Comparing base (4f535d8) to head (b2ca7d7).

Files with missing lines Patch % Lines
stacks-node/src/event_dispatcher/db.rs 97.57% 4 Missing ⚠️
stacks-node/src/event_dispatcher.rs 89.65% 3 Missing ⚠️

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

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6795      +/-   ##
===========================================
- Coverage    77.77%   72.39%   -5.39%     
===========================================
  Files          585      585              
  Lines       361916   362030     +114     
===========================================
- Hits        281498   262089   -19409     
- Misses       80418    99941   +19523     
Files with missing lines Coverage Δ
stacks-node/src/event_dispatcher/tests.rs 89.58% <100.00%> (-9.13%) ⬇️
stacks-node/src/event_dispatcher.rs 71.00% <89.65%> (-7.15%) ⬇️
stacks-node/src/event_dispatcher/db.rs 95.16% <97.57%> (+1.95%) ⬆️

... and 279 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 4f535d8...b2ca7d7. 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.

Copy link
Contributor

@brice-stacks brice-stacks left a comment

Choose a reason for hiding this comment

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

This looks good. Just noticed one typo and I like the idea of adding a version to the DB

}

fn get_payload_column_type(&self) -> Result<Option<String>, db_error> {
/// The initial schema of the datebase when this code was first created
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: database

Ok((name, col_type))
})?;

let mut payload_is_blob = None;
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think we might as well version it.

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.

3 participants