Skip to content

Conversation

@Matistjati
Copy link
Contributor

@Matistjati Matistjati commented Aug 19, 2025

As a follow-up to #347, make input fuzzing deterministic.

@Matistjati
Copy link
Contributor Author

We should probably merge #348 first. I based this PR off that one. I assumed Github would do something smart and only show the new changes w.r.t. the last one, but upon further thoughts, I don't know what I expected, really.

return (desc, p.search, lambda text: p.sub(repl, text))


rng = random.Random(42)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer not creating a variable rng for this, but instead do random.Random(42).choice(...) down where you use this variable.

If we create rng and multiple modifiers start using it, we lose determinism if they are reordered or removed (probably no big deal, but if the point of this PR is determinism... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to be a little careful: doing random.Random(42).choice(...) will make the same choice 200 times. I found that lambdas are expressive enough to do what we want inline!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good catch. I didn't think about the context with how it's called.

@gkreitz
Copy link
Contributor

gkreitz commented Aug 20, 2025

Yeah, github really could do better in dealing with follow-up PR:s. I'll hold off reviewing this until we merge #347 (as I think it's very close to mergeable).

@Matistjati Matistjati force-pushed the deterministic-input-fuzzing branch from 3662710 to 5cfac90 Compare August 20, 2025 12:00
@Matistjati Matistjati closed this Aug 20, 2025
@Matistjati Matistjati deleted the deterministic-input-fuzzing branch August 20, 2025 13:43
@Matistjati Matistjati restored the deterministic-input-fuzzing branch August 21, 2025 11:36
@Matistjati Matistjati reopened this Aug 21, 2025
@Matistjati
Copy link
Contributor Author

Uhh... accidentally deleted this branch when cleaning up old branches because I thought it was merged. Whoops.

@Matistjati
Copy link
Contributor Author

Closed; see #351 instead

@Matistjati Matistjati closed this Aug 21, 2025
@Matistjati Matistjati deleted the deterministic-input-fuzzing branch September 19, 2025 04:15
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.

2 participants