Epic: Hydration System Refactor #153

Open
opened 2026-03-15 23:08:32 +00:00 by freemo · 0 comments
Owner

Background and Context

The current Hydration module uses a class variable @@volatile that is shared across the entire inheritance hierarchy. When Publisher declares volatile :@local_registrations and Player declares volatile :@help_library, :@player, both write to the same @@volatile array. This leaks volatile declarations across unrelated classes — any class that includes Hydration sees every other class's volatiles.

The specification (Persistence and Storage section) prescribes replacing @@volatile with @_volatile_vars (a per-class instance variable), adding ancestor chain traversal via collect_volatile_vars, and protecting the dehydrate/rehydrate cycle with a SERIALIZATION_MUTEX.

Demonstrable Outcome

Volatile variable declarations are per-class, collected via ancestor chain traversal, and protected by a mutex during serialization. No class sees another class's volatile declarations unless it is a descendant.

Acceptance Criteria

  • @@volatile replaced with @_volatile_vars per-class instance variable
  • collect_volatile_vars walks ancestor chain to build union of volatile sets
  • SERIALIZATION_MUTEX guards dehydrate/rehydrate cycle
  • No volatile declaration leaks between unrelated classes
  • All persistence and serialization tests pass
## Background and Context The current `Hydration` module uses a class variable `@@volatile` that is shared across the entire inheritance hierarchy. When `Publisher` declares `volatile :@local_registrations` and `Player` declares `volatile :@help_library, :@player`, both write to the same `@@volatile` array. This leaks volatile declarations across unrelated classes — any class that includes Hydration sees every other class's volatiles. The specification (Persistence and Storage section) prescribes replacing `@@volatile` with `@_volatile_vars` (a per-class instance variable), adding ancestor chain traversal via `collect_volatile_vars`, and protecting the dehydrate/rehydrate cycle with a `SERIALIZATION_MUTEX`. ## Demonstrable Outcome Volatile variable declarations are per-class, collected via ancestor chain traversal, and protected by a mutex during serialization. No class sees another class's volatile declarations unless it is a descendant. ## Acceptance Criteria - `@@volatile` replaced with `@_volatile_vars` per-class instance variable - `collect_volatile_vars` walks ancestor chain to build union of volatile sets - `SERIALIZATION_MUTEX` guards dehydrate/rehydrate cycle - No volatile declaration leaks between unrelated classes - All persistence and serialization tests pass
freemo added this to the v1.0.0 milestone 2026-03-15 23:19:40 +00:00
freemo self-assigned this 2026-03-16 01:26:56 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#153
No description provided.