Skip to content

Releases: joelhelbling/shifty

shifty 0.6.0 — handoff immutability policies

Choose a tag to compare

@joelhelbling joelhelbling released this 10 Jul 22:47
42c423d

Values crossing worker boundaries are now governed by a handoff policy, and the default changed from raw shared references to deeply frozen values. Mutation bugs that used to surface as mysterious downstream corruption now either cannot happen or raise immediately at the worker responsible.

Breaking changes

  • :frozen is the new default policy — every value a worker receives is deeply frozen at intake; a task that mutates its input raises Shifty::PolicyViolation with diagnostics naming the worker and the mutated object. Opt out per worker (policy: :shared/policy: :isolated), per pipeline (.with_policy(...)), or globally (Shifty.configure).
  • Unshareable values (IO handles, procs, lazy enumerators) raise Shifty::UnshareableValue at default-policy boundaries — declare policy: :shared on those workers.
  • The task's second argument is now a policy-governed supply proxy (#shift only).
  • Ruby floor: 3.2. Older Rubies stay on shifty 0.5.0.

Deprecations

  • side_worker mode: :hardenedpolicy: :isolated (same Marshal mechanism, same semantics); warns now, removed in 1.0.0.

Added

  • Three policies (:frozen / :isolated / :shared) with worker > pipeline > global precedence
  • Shifty::Testing.run + mutates_input? mutation detector; mutate_input matcher and "a policy-safe worker" shared example (opt-in requires)
  • #freeze! topology locking
  • Worker name: for diagnostics
  • Benchmarks: steady-state :frozen costs ~71ns per handoff regardless of value size, with zero allocations — the safe default is also the cheapest (benchmark/RESULTS.md)

Docs

In-depth guides on the wiki: Handoff Policies · Coding Idioms Under :frozen · Migration Guide · Testing Workers · Worker Types · Performance

Full details in CHANGELOG.md.