Skip to content

Conversation

@Matistjati
Copy link
Contributor

At the time of writing, 16 Aug 2025, both https://open.kattis.com/problems/procrastination and https://open.kattis.com/problems/ekkiminnforseti have trailing whitespaces in their samples. This is very minor, but should IMO not happen.

This PR adds tests that check the input validator will reject this.

@Matistjati
Copy link
Contributor Author

On another note, as far as I can tell, we use random without seeding. This seems like it could be extremely annoying in some edge-case. Do you see any problems in naively adding random.seed(42) to the top of verifyproblem.py @gkreitz ?

@gkreitz
Copy link
Contributor

gkreitz commented Aug 17, 2025

On another note, as far as I can tell, we use random without seeding. This seems like it could be extremely annoying in some edge-case. Do you see any problems in naively adding random.seed(42) to the top of verifyproblem.py @gkreitz ?

I'm not sure fixing a seed at the start of execution is great, as adding a new junk case (or any other use of random) can then change all values. I would prefer that for the cases where we want to fix a seed (probably all of them), we do random.Random(0).<call>, as is already done on https://github.com/Kattis/problemtools/blob/master/problemtools/verifyproblem.py#L958 . 0 could of course very well be replaced by 42.

For a couple of the cases, where we're adding whitespace, I also feel we could simply skip randomness. If we want the input validator to catch trailing whitespace, why are we adding 1-5 spaces, instead of always adding the smallest amount we want it to catch (1)? I would be surprised if there are common bugs where you properly forbid 1 trailing space, but catch 2...

@gkreitz
Copy link
Contributor

gkreitz commented Aug 17, 2025

While I added a comment about how we do random, I think this is a very good addition by itself, so I'll merge it now, and then we can do a separate PR if we want to adjust randomness per my comment above (explicit seeding in a few places, and just adding a single space/newline in a couple of cases).

@gkreitz gkreitz merged commit 626400f into Kattis:master Aug 17, 2025
5 checks passed
@Matistjati Matistjati deleted the fuzz-extra-spaces branch August 20, 2025 13:43
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