Skip to content

Refactor: audit and correctly classify transformers vs persisters in extension.ex #144

@matt-beanland

Description

@matt-beanland

Motivation

TransformBehaviour is currently registered under persisters: in extension.ex but does transformer work (injects action arguments). This is misclassified. Spark runs transformers and persisters in separate pipelines — before?/after? ordering declarations on a persister targeting a transformer are silently ignored.

Background

Spark pipeline order:

  1. Transformers — run in dependency order via before?/after?; can modify DSL state; may also persist
  2. Persisters — always run after ALL transformers; before?/after? only works relative to other persisters
  3. Verifiers — read-only, run last

A transformer that needs to expose baked state should call Transformer.persist/3 inline — no separate persister needed.

Work

  1. Audit each Persist* module — confirm it only reads DSL state and bakes module functions (true persister), or identify if it computes/modifies state (should be a transformer)
  2. Audit TransformBehaviour — identify what persisted state it reads; determine if dependencies exist on Persist* modules running first
  3. Move TransformBehaviour to transformers: — if it reads persisted state from a Persist* module, fold that persisting work into TransformBehaviour directly
  4. Any other misclassified modules: fold their persisting into the transformer that needs the result, or confirm they are true persisters and leave them

Caution

Moving a module from persisters: to transformers: changes when it runs relative to Ash's own transformers. If it currently relies on Ash transformer output being available, moving it may break things silently. Audit dependencies before moving.

Out of scope

Adding new DSL features — this is a structural correctness fix only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringImproving existing code without changing functionality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions