Skip to content

Conversation

@andresilva
Copy link
Collaborator

This PR extends the select_loop! macro with optional on_start and on_end blocks, enabling cleaner patterns for code that needs to run at the beginning or end of each loop iteration.

The on_start block executes before the select, allowing variable initialization that's visible to all arms. The on_end block runs after any non-shutdown arm completes but is skipped when shutdown triggers, which is useful for cleanup or post-processing logic. Both blocks share lexical scope with the select arms.

This allows migrating some more places to use the select_loop! macro.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 2, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp a59d60b Jan 02 2026, 08:02 PM

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 2, 2026

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

Latest commit: a59d60b
Status: ✅  Deploy successful!
Preview URL: https://b6781f02.monorepo-eu0.pages.dev
Branch Preview URL: https://andre-select-loop-start-end.monorepo-eu0.pages.dev

View logs

@andresilva andresilva marked this pull request as draft January 2, 2026 17:35
@andresilva andresilva marked this pull request as ready for review January 2, 2026 19:26
@andresilva
Copy link
Collaborator Author

andresilva commented Jan 2, 2026

For the places where I updated the code to use select_loop! this is much easier to review by using difftastic locally (although this will ignore whitespace changes).

@andresilva andresilva force-pushed the andre/select-loop-start-end branch from 8f82089 to 101b82d Compare January 2, 2026 19:40
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 86.50307% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.62%. Comparing base (82547f4) to head (a59d60b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
consensus/src/marshal/actor.rs 87.40% 32 Missing ⚠️
consensus/src/aggregation/engine.rs 65.43% 28 Missing ⚠️
consensus/src/ordered_broadcast/engine.rs 70.83% 28 Missing ⚠️
consensus/src/simplex/actors/batcher/actor.rs 93.27% 15 Missing ⚠️
consensus/src/simplex/actors/voter/actor.rs 90.34% 14 Missing ⚠️
broadcast/src/buffered/engine.rs 78.12% 7 Missing ⚠️
resolver/src/p2p/engine.rs 95.37% 5 Missing ⚠️
macros/src/lib.rs 92.30% 3 Missing ⚠️
@@           Coverage Diff            @@
##             main    #2671    +/-   ##
========================================
  Coverage   92.62%   92.62%            
========================================
  Files         357      357            
  Lines      102996   103136   +140     
========================================
+ Hits        95396    95534   +138     
- Misses       7600     7602     +2     
Files with missing lines Coverage Δ
macros/src/lib.rs 78.20% <92.30%> (+2.82%) ⬆️
resolver/src/p2p/engine.rs 96.65% <95.37%> (-0.02%) ⬇️
broadcast/src/buffered/engine.rs 94.01% <78.12%> (+0.40%) ⬆️
consensus/src/simplex/actors/voter/actor.rs 95.67% <90.34%> (-0.02%) ⬇️
consensus/src/simplex/actors/batcher/actor.rs 94.58% <93.27%> (-0.02%) ⬇️
consensus/src/aggregation/engine.rs 85.17% <65.43%> (+0.17%) ⬆️
consensus/src/ordered_broadcast/engine.rs 86.24% <70.83%> (+0.16%) ⬆️
consensus/src/marshal/actor.rs 92.63% <87.40%> (-0.15%) ⬇️

... and 7 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 82547f4...a59d60b. 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.

@patrick-ogrady patrick-ogrady added this to the v0.1.0 milestone Jan 5, 2026
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