Skip to content

feat: cascade TTL to container sub-tasks (rapyer >=1.3.4) #136

Description

@yedidyakfir

Summary

Upgrade rapyer to >=1.3.4 and use its new action-scoped refresh_ttl + Reference[T] / CascadeTTL features so that any write to a container signature (swarm / chain) refreshes its TTL and cascades that refresh to all of its sub-tasks. This keeps a container and its whole subtree alive together while the container is being actively updated.

No explicit update_ttl method and no client method — the behavior is purely declarative model config.

Approach

  1. Upgrade rapyer to >=1.3.4,<1.4.0 in all libs (third-magic, mageflow-mcp, mage-voyance) and re-lock every uv workspace.
  2. Foreign-key the child edges so cascade has something to walk:
    • swarm/chain tasksReference[TaskSignature]
    • swarm publishing_state_idReference[PublishState] (retires the existing # TODO ... once we use foreign key)
  3. Configure the containers with refresh_ttl = ActionGroup.<all writes> + cascade_ttl = CascadeTTL() on their Meta.
  4. Refactor the spots that read self.tasks as raw keys to go through task_ids / target_key.
  5. Breaking-change review for rapyer 1.3.0→1.3.4 (apipeline no longer auto-refreshes TTL, afind_one→None, afind key/expr mixing, mark_actions MarkVersion) with a full-suite regression pass.

Cascade semantics

rapyer's cascade re-arms each reached child to its own Meta.ttl (keep-the-subtree-alive-together), not "copy one number onto every child". With mageflow's uniform active TTL this is the desired behavior.

Tasks

  • Upgrade rapyer + re-lock all workspaces
  • Convert swarm/chain tasks and swarm publishing_state_id to Reference[T]
  • Configure refresh_ttl (write ActionGroup) + cascade_ttl on swarm/chain
  • Refactor self.tasks key consumers to task_ids
  • Breaking-change review + cascade-TTL tests + full-suite regression

Verify at implementation

  • Confirm action-scoped refresh_ttl cascades to Reference children on ordinary writes/atomic ops (not only asave/explicit aset_ttl(cascade=True)).
  • Confirm Reference works inside a RedisList (swarm does atomic ops on tasks).
  • Confirm cascade works under fakeredis[lua].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions