feat(twap-monitor): PollOutcome lifecycle dispatch (BLEU-830)#7
Open
brunota20 wants to merge 2 commits into
Open
feat(twap-monitor): PollOutcome lifecycle dispatch (BLEU-830)#7brunota20 wants to merge 2 commits into
brunota20 wants to merge 2 commits into
Conversation
After poll_one, the non-Ready arms now reach a typed lifecycle
step instead of dead-ending in the log:
- TryNextBlock -> NoOp — re-poll next block
- TryOnBlock(n) -> SetNextBlock(n) -> persist next_block:{...}
- TryAtEpoch(t) -> SetNextEpoch(t) -> persist next_epoch:{...}
- DontTryAgain -> DropWatch -> delete watch:{...} +
best-effort delete of the
stale next_block: /
next_epoch: gates
The decision is split out as a pure `outcome_to_update` returning
a `WatchUpdate` enum, with the impure `apply_watch_update`
performing the local-store writes. That partition lets the four
host-free tests assert the mapping exhaustively without
wit-bindgen scaffolding.
`Ready` is deliberately mapped to `NoOp` here as a safety net —
poll_all_watches routes Ready to submit_ready, which owns the
post-submit book-keeping (submitted: marker + retry / drop). If
a future refactor accidentally pipes Ready through the lifecycle
path, the watch must NOT be erased.
Wire-format conventions (u64 LE bytes, key shape watch:{owner}:
{params_hash} and parallel next_block: / next_epoch:) stay the
same as BLEU-827; no consumer changes required.
Tests: 5 new (Ready, TryNextBlock, TryOnBlock, TryAtEpoch,
DontTryAgain). Total 34 host tests.
Linear: BLEU-830.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After `poll_one`, the non-Ready arms now reach a typed lifecycle step:
Decision is split out as the pure `outcome_to_update` returning a `WatchUpdate` enum; the impure `apply_watch_update` performs the local-store writes. That partition lets the four host-free tests assert the mapping exhaustively without wit-bindgen scaffolding.
`Ready` is mapped to `NoOp` as a safety net — `poll_all_watches` routes Ready to `submit_ready`, which owns the post-submit book-keeping. If a future refactor pipes Ready through the lifecycle path, the watch must NOT be erased.
Wire-format conventions (u64 LE, key shape `watch:{owner}:{params_hash}` + parallel `next_block:` / `next_epoch:`) stay the same as BLEU-827; no consumer changes required.
Stacks on #6 (BLEU-829 retry).
Linear: BLEU-830.
Test plan