Skip to content

Add HeterogeneousListGene for mixed-type lists and refactor TupleGene on top of it - #1962

Open
aschenzle wants to merge 1 commit into
feat/protected-unique-array-genefrom
feat/heterogeneous-list-gene
Open

aschenzle wants to merge 1 commit into
feat/protected-unique-array-genefrom
feat/heterogeneous-list-gene

Conversation

@aschenzle

Copy link
Copy Markdown
Collaborator

Introduces HeterogeneousListGene, supporting ordered lists of mixed-type Gene elements in both fixed-size (isFixed = true) and variable-size (isFixed = false, backed by a template gene) modes (needed for heterogeneous list structures such as DynamoDB L attributes). Refactors TupleGene as a fixed-size specialization of HeterogeneousListGene, shares collection size-bound validation on CollectionGene, and incorporates the impact/comparison fixes from discarded PRs #1935 and #1936 to avoid merge conflicts.

Changes

  • Adds HeterogeneousListGeneImpact (tracking size and no-impact/impact counters via CollectionImpact without assuming stable per-name child slots) and wires ImpactUtils for HeterogeneousListGene.

  • Refactors TupleGene to extend HeterogeneousListGene(name, elements, isFixed = true, template = null) while preserving tuple-specific lastElementTreatedSpecially formatting and per-element name-keyed TupleGeneImpact tracking.

  • Hardens TupleGene.containsSameValueAs and TupleGeneImpact against mismatched element sizes, names, and runtime types.

  • Shared CollectionGene size-bound validation:

    • Extracts CollectionGene.validateCollectionSizeBounds and reuses it across HeterogeneousListGene, ArrayGene, and MapGene
  • Tests:

    • Adds HeterogeneousListGeneTest and ImpactUtilsTest, extends TupleGeneTest, and registers HeterogeneousListGene in GeneSamplerForTests and GeneNumberOfGenesTest.

@aschenzle
aschenzle changed the base branch from master to feat/protected-unique-array-gene November 27, 2026 20:38
@aschenzle
aschenzle added this pull request to stack #1960 November 27, 2026 20:39
@jgaleotti

jgaleotti commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

@arcuri82 : I think that the impact part of this PR should also be reviewed by @man-zhang

@arcuri82
arcuri82 force-pushed the feat/heterogeneous-list-gene branch from d88b4bc to b946a1e Compare November 30, 2026 09:22

@man-zhang man-zhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!
the impact collection for the HeterogeneousListGene looks good to me.

@arcuri82
arcuri82 force-pushed the feat/heterogeneous-list-gene branch from b946a1e to 2f01d51 Compare December 1, 2026 07:01
@aschenzle
aschenzle force-pushed the feat/heterogeneous-list-gene branch from 2f01d51 to 95a73a5 Compare December 2, 2026 06:25
name: String,
elements: List<Gene>,
isFixed: Boolean = true,
val template: Gene? = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of a single template, shouldn't maybe pass an array of templates. when a new gene needs to be added, we could choose one of the provided templates at random

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrea, this is because I'm just using ChoiceGene with the scalar values inside a list. I want Evomaster to just mutate leaves and not the structure. On the other hand I see the flexibility and benefits of your proposal, would you be ok with me adding a TODO here and once everything merges I can do A/B testing on your proposed solution and if it doesn't break any of my results I will adopt your cleaner solution. If it breaks something I will still adopt your solution but I might add some other feature to optionally protect the structure and avoid Evomaster adding nested collections.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, when constructing this ListGene from existing data, nested lists are supported.

@aschenzle
aschenzle requested a review from arcuri82 December 3, 2026 23:43
@aschenzle
aschenzle force-pushed the feat/heterogeneous-list-gene branch from 95a73a5 to 7b2c33b Compare December 4, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants