-
-
Notifications
You must be signed in to change notification settings - Fork 346
Refine complex_graph regex_matches
partial suppressions
#1719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine complex_graph regex_matches
partial suppressions
#1719
Conversation
This builds on GitoxideLabs#1635 by: - Updating the comment about GitoxideLabs#1622, including by adding links to Git mailing list posts by Aarni Koskela, who discovered the bug that turns out to be the cause of this, and Patrick Steinhardt, who analyzed the bug and wrote a fix (currently in testing); and GitoxideLabs#1622 (comment), which summarizes that and reports on its connection to GitoxideLabs#1622. - Narrowing the partial suppression of the failing test code (which consists of conditionally using `parse_spec_no_baseline` instead of `parse_spec` in some assertions) so that it is only done if Git is at one of the versions that is known to be affected. If any future Git versions are affected, such as by the currently cooking patch not being merged as soon as I expect, then this could potentially fail on CI again. But that is something we would probably want to find out about.
72eacb8
to
f4b4bf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the perfect implementation to solve the problem at hand!
I had something much more simplistic in mind, but also something that would have been very broken :D.
The pure-rust-build job is stalled on the This occasionally happens locally but I don't think I've seen it on CI before. Maybe using the |
Thanks for the hint - I cancelled and restarted and would think that it will go through now. From my experience it's very rare indeed, and I'd hope it stays that way. |
The bug in Git that causes GitoxideLabs#1622 has been fixed since 2.48.0 and does not affect any versions prior to 2.47, but the fix is not backported to subsequent 2.47.* point releases. In particular, 2.47.2 has been released, with backported security fixes, but it does not have backported fixes for this non-security bug. This builds on GitoxideLabs#1635 and GitoxideLabs#1719 by updating the range of Git versions where we skip the affected baseline checks on CI (for platforms this affects on our CI) from `(2, 47, 0)..(2, 47, 2)` to `(2, 47, 0)..(2, 48, 0)`, i.e., with the exclusive upper bound changed from 2.47.2 to the correct value of 2.48.0. This also revises the comments accordingly. For further details, see: GitoxideLabs#1622 (comment) (This change is item (1) there.)
For GitoxideLabs#1622, baseline comparisons in `find_youngest_matching_commit` where Git 2.47.* produces incorrect results were conditionally suppressed in the `regex_matches` test case in GitoxideLabs#1635. That was refined in GitoxideLabs#1719, and further refined in GitoxideLabs#1774. This builds on those, making substantial changes, in view of how: - We expect that CI have a very recent Git. The runners have been past 2.47.* for some time, and now have 2.49.*. Therefore it is no longer desirable to suppress the baseline comparison on CI. - GitoxideLabs#1774 only examined the `regex_matches` test case. That test runs when the `revparse-regex` feature, which is a default `gix` feature, is enabled. But when `revparse-regex` is not enabled, the `contained_string_matches` test case runs instead. This test suffers the same baseline comparison failures with the same Git versions, due to assertions analogous to those that were adjusted to let `regex_matches` proceed and pass. This can be verified by running PATH="$HOME/git-2.47.2/bin:$PATH" GIX_TEST_IGNORE_ARCHIVES=1 \ cargo nextest run -p gix \ revision::spec::from_bytes::regex::find_youngest_matching_commit \ --no-fail-fast --no-default-features \ --features max-performance-safe,comfort,basic where the `PATH` environment variable is set differently if the `git` command provided in a Git 2.47.* installation is elsewhere than `~/git-2.47.2/bin`. Output from such a run can be seen in: https://gist.github.com/EliahKagan/bd8525d048350fc80a7666d8819089db Therefore, if a conditional suppression of the baseline comparison is to be preserved in `regex_matches`, then an analogous suppression under the same conditions should be added to `contained_string_matches`. - Although most operating systems that package Git seem not to have 2.47.* as their latest available downstream version in any release, it seems a few do. In particular, Alpine Linux v3.21 has git 2.47.2-r0, as shown at: https://pkgs.alpinelinux.org/packages?name=git&branch=v3.21&repo=&arch=x86_64&origin=&flagged=&maintainer= Therefore, if it is desirable to work with as wide a range as possible of (currently supported) operating system releases as development environments, there may be a benefit to conditionally suppressing the baseline tests when Git 2.47.* is used *locally*. - However, doing this locally carries two downsides. First, the test code (even if refactored to decrease duplication) will be more complicated than if this is not done. Second, such an environment will still not be suitable for all development tasks, because generating the relevant test fixtures on it will contain incorrect baselines and therefore must not be committed. If they were to be committed by accident, then the problem would most likely be caught, because the tests would fail on CI, in other environments, and even in the same environment when run without `GIX_TEST_IGNORE_ARCHIVES` (in the absence of which the baseline comparisons are not suppressed). So this is not likely to have severely harmful effects. But it could be frustrating, because suppressing the baseline comparisons locally hides the usual evidence that the generated archives might not be suitable for committing. This commit keeps the baseline comparison in `regex_matches` but inverts its CI check so the suppression is only done locally rather than only on CI, adds the same (modified) suppression to the analogous `contained_string_matches` test case, and updates comments accordingly. We may or may not keep this approach.
For GitoxideLabs#1622, baseline comparisons in `find_youngest_matching_commit` where Git 2.47.* produces incorrect results were conditionally suppressed in the `regex_matches` test case in GitoxideLabs#1635. That was refined in GitoxideLabs#1719, and further refined in GitoxideLabs#1774. This builds on those, making substantial changes, in view of how: - We expect that CI have a very recent Git. The runners have been past 2.47.* for some time, and now have 2.49.*. Therefore it is no longer desirable to suppress the baseline comparison on CI. - GitoxideLabs#1774 only examined the `regex_matches` test case. That test runs when the `revparse-regex` feature, which is a default `gix` feature, is enabled. But when `revparse-regex` is not enabled, the `contained_string_matches` test case runs instead. This test suffers the same baseline comparison failures with the same Git versions, due to assertions analogous to those that were adjusted to let `regex_matches` proceed and pass. This can be verified by running PATH="$HOME/git-2.47.2/bin:$PATH" GIX_TEST_IGNORE_ARCHIVES=1 \ cargo nextest run -p gix \ revision::spec::from_bytes::regex::find_youngest_matching_commit \ --no-fail-fast --no-default-features \ --features max-performance-safe,comfort,basic where the `PATH` environment variable is set differently if the `git` command provided in a Git 2.47.* installation is elsewhere than `~/git-2.47.2/bin`. Output from such a run can be seen in: https://gist.github.com/EliahKagan/bd8525d048350fc80a7666d8819089db Therefore, if a conditional suppression of the baseline comparison is to be preserved in `regex_matches`, then an analogous suppression under the same conditions should be added to `contained_string_matches`. - Although most operating systems that package Git seem not to have 2.47.* as their latest available downstream version in any release, it seems a few do. In particular, Alpine Linux v3.21 has git 2.47.2-r0, as shown at: https://pkgs.alpinelinux.org/packages?name=git&branch=v3.21&repo=&arch=x86_64&origin=&flagged=&maintainer= Therefore, if it is desirable to work with as wide a range as possible of (currently supported) operating system releases as development environments, there may be a benefit to conditionally suppressing the baseline tests when Git 2.47.* is used *locally*. - However, doing this locally carries two downsides. First, the test code (even if refactored to decrease duplication) will be more complicated than if this is not done. Second, such an environment will still not be suitable for all development tasks, because generating the relevant test fixtures on it will contain incorrect baselines and therefore must not be committed. If they were to be committed by accident, then the problem would most likely be caught, because the tests would fail on CI, in other environments, and even in the same environment when run without `GIX_TEST_IGNORE_ARCHIVES` (in the absence of which the baseline comparisons are not suppressed). So this is not likely to have severely harmful effects. But it could be frustrating, because suppressing the baseline comparisons locally hides the usual evidence that the generated archives might not be suitable for committing. This commit keeps the baseline comparison in `regex_matches` but inverts its CI check so the suppression is only done locally rather than only on CI, adds the same (modified) suppression to the analogous `contained_string_matches` test case, and updates comments accordingly. We may or may not keep this approach.
This rolls back all changes made to work around the Git 2.47.* bug that underlies GitoxideLabs#1622, including the change made in the immediately preceding commit. This undoes the changes to `regex.rs` from GitoxideLabs#1635, GitoxideLabs#1719, GitoxideLabs#1774, and 2400158 (which is the immediately preceding commit). That file is now as it was in 3745212. The rationale is that the disadvantages of inverting the CI check and extending the suppresson, as described in the previous commit, really outweigh the advantages. This is mainly due to the risk of generating archives that should not be committed but seem based on test results like they could be committed. (The suppressions being removed here will most likely not be needed in the future, but if they are then this commit can be reverted, and the suppression will be done locally but on on CI, consistently across feature for which the relevant tests are run, and only when Git is found to be a version in the 2.47.* range.) Closes GitoxideLabs#1622
This builds on #1635 along the lines of the suggestion in #1622 (comment), by:
Updating the comment about #1622, including by adding links to Git mailing list posts by Aarni Koskela, who discovered the bug that turns out to be the cause of this, and Patrick Steinhardt, who analyzed the bug and wrote a fix (currently in testing); and #1622 (comment), which summarizes that and reports on its connection to #1622.
Narrowing the partial suppression of the failing test code (which consists of conditionally using
parse_spec_no_baseline
instead ofparse_spec
in some assertions) so that it is only done if Git is at one of the versions that is known to be affected.If any future Git versions are affected, such as by the currently cooking patch not being merged as soon as I expect, then this could potentially fail on CI again. But that is something we would probably want to find out about.