Skip to content

feat(grouping): Add replacement callback option to parameterizer#111352

Draft
lobsterkatie wants to merge 8 commits intokmclb-more-parameterizer-refactorsfrom
kmclb-add-replacement-callback-to-parameterizer
Draft

feat(grouping): Add replacement callback option to parameterizer#111352
lobsterkatie wants to merge 8 commits intokmclb-more-parameterizer-refactorsfrom
kmclb-add-replacement-callback-to-parameterizer

Conversation

@lobsterkatie
Copy link
Member

This adds the ability to specify a replacement callback when defining a regex for the parameterizer. For example, a regex can now be defined like this:

ParameterizationRegex(
    name="dog",
    raw_pattern=r"some pattern",
    replacement_callback=lambda orig_value: "<dog>" if some_condition else orig_value,
)

When the parameterizer finds a matching value, instead of just reflexively replacing it with the regex's name, it'll pass the original value to the callback, and let it decide what the replacement value will be. (This is going to be necessary for us to fix our IPv6 parameterization.)

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 23, 2026
@lobsterkatie lobsterkatie force-pushed the kmclb-more-parameterizer-refactors branch from 25abad3 to 9bd39e2 Compare March 23, 2026 22:11
@lobsterkatie lobsterkatie force-pushed the kmclb-add-replacement-callback-to-parameterizer branch from c851f10 to c4ee25e Compare March 23, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant