Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(node/actor): abstract UnsafeHeadPublisher from EngineActor#3255

Open
Farukest wants to merge 1 commit intoop-rs:mainfrom
Farukest:unsafe-head-publisher-trait
Open

feat(node/actor): abstract UnsafeHeadPublisher from EngineActor#3255
Farukest wants to merge 1 commit intoop-rs:mainfrom
Farukest:unsafe-head-publisher-trait

Conversation

@Farukest
Copy link
Copy Markdown

Summary

This PR abstracts the unsafe head publishing mechanism from EngineActor by introducing an UnsafeHeadPublisher trait.

Changes

  • Add UnsafeHeadPublisher trait: Defines a publish_if_modified method that publishes a new unsafe head only when it differs from the previous value
  • Add WatchUnsafeHeadPublisher: Concrete implementation using tokio::sync::watch::Sender
  • Make EngineProcessor generic over UnsafeHeadPublisher: Allows different publishing strategies to be injected
  • Add MockUnsafeHeadPublisher: For unit testing via mockall

As noted in #3214, EngineActor was directly creating and managing a watch::Sender for publishing unsafe head updates, but it doesn't need to control how that publishing occurs. This refactor decouples the publishing mechanism, making the code cleaner and more versatile.

Test plan

  • Unit tests for WatchUnsafeHeadPublisher (publish returns true/false correctly)
  • All existing tests pass (108/108)
  • cargo fmt check passes
  • cargo clippy passes for modified files

Closes #3214

Introduce UnsafeHeadPublisher trait to decouple unsafe head publishing
from EngineActor. This allows different publishing strategies to be
injected into EngineProcessor.

- Add UnsafeHeadPublisher trait with publish_if_modified method
- Add WatchUnsafeHeadPublisher implementation using watch::Sender
- Make EngineProcessor generic over UnsafeHeadPublisher
- Add MockUnsafeHeadPublisher for testing

Closes op-rs#3214
@wiz-b4c72f16a4
Copy link
Copy Markdown

wiz-b4c72f16a4 Bot commented Jan 14, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Supply Chain Finding Software Supply Chain Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@Farukest Farukest force-pushed the unsafe-head-publisher-trait branch from bce3f31 to 1014ad7 Compare January 14, 2026 23:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an UnsafeHeadPublisher trait make EngineActor generic over it

1 participant