Resolve "Fix detection of invalid goals after fouls"

Closes #1738

See merge request main/Sumatra!1509

sumatra-commit: a0f25f9b31882470ef5221f6f08ecd3680178406
2 jobs for master in 4 minutes and 52 seconds (queued for 1 second)