Skip to content

AshPaperTrail Errors with Managed Relationships (?) #171

@DGollings

Description

@DGollings

Issue Description

After adding the ash_paper_trail extension to our resources, operations that use managed relationships :direct_control are failing.

Error Details

When attempting operations that create/update associated resources via managed relationships, we encounter
the following error:

  %Ash.Error.Unknown{
    bread_crumbs: ["Error returned from: Order.create"],
    changeset: "#Changeset<>",
    errors: [%Ash.Error.Unknown.UnknownError{
      error: "** (ArgumentError) unknown field `:paper_trail_versions` in schema Address 
  given to insert_all. Unwritable fields, such as virtual and read only fields are not supported. 
  Associations are also not supported",
      field: nil,
      value: nil,
      splode: Ash.Error,
      bread_crumbs: ["Error returned from: Order.create"],
      vars: [],
      path: [:address, 0],
      stacktrace: #Splode.Stacktrace<>,
      class: :unknown
    }]
  }

When It Occurs

  • During operations using direct_control managed relationships
  • When creating resources that have nested resources managed via relationships
  • Specifically with operations that might trigger bulk database operations

Steps to Reproduce

  1. Add the AshPaperTrail.Resource extension to resources
  2. Configure appropriate domain extensions and version table resources
  3. Perform operations that use direct_control relationships to create/update nested resources

Environment Details

  • ash_paper_trail version: 0.5.3
  • Ash version: 3.5.5

Notes

  • The error specifically mentions the :paper_trail_versions virtual field during insert_all operations
  • Standard create/update operations work fine
  • Only fails with operations that trigger bulk processing of managed relationships
  • Other resources without :direct_control seem to work fine

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