Use ADT instead of sentinel values for weave control flow #140
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#140
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
PR #138 uses sentinel values (
i64::MINandi64::MIN + 1) to signal weave completion and cancellation through channels.Current State
In
crates/runtime/src/weave.rs:These are sent as
Value::Int(DONE_SENTINEL)through channels and detected via pattern matching.Problem
While unlikely, a user could legitimately yield
i64::MINori64::MIN + 1, causing:This is documented as a limitation, but it's a design smell.
Proposed Solution
Replace sentinel values with an internal enum:
Channel type changes from
mpmc::channel::<Value>()tompmc::channel::<WeaveMessage>().Benefits
i64::MINTrade-offs
Acceptance Criteria
DONE_SENTINELandCANCEL_SENTINELconstantsWeaveMessageenumi64::MINsuccessfullyRelated
https://github.com/navicore/patch-seq/pull/143