Skip to content

Clean mode drops authored nested dataclass subtypes with default fields #1

Closed

Description

@trissim

Clean-mode nested dataclass formatting omits a child whenever its own fields all match its own defaults. This silently discards an explicitly authored nominal subtype when the parent field defaults to a different type.

For example, a field annotated/defaulted as SourceSpatialDomain() can contain VolumeSourceSpatialDomain(). The subtype declares intrinsic 3D semantics even with all fields at defaults. Rendering a containing OpenHCS configuration currently produces GlobalPipelineConfig(), which reconstructs an XY domain instead of the authored volume.

Default omission must preserve the nominal type of the actual child. The existing generic dataclass formatter should omit an empty nested constructor only when its owner matches the containing field's default owner. No OpenHCS-specific formatter or type-name special case is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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