Skip to content
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

Fix flaky simplicial set test #38940

Merged
merged 2 commits into from
Dec 8, 2024

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Nov 8, 2024

Fixes #38888 .

This test has been failing sporadically recently e.g. https://github.com/sagemath/sage/actions/runs/11733902583/job/32689016794?pr=38938 .

From my understanding of simplicial set, the two sigma_1 are actually representing two different cells (the wedge looks like a "8" shape), but because they both come from S1 (the 1-sphere i.e. circle), they get the same name.

SageMath does some magic during doctest so that dict entries are sorted, but the problem is

        At this point, comparison between v and w is random, based on
        their location in memory. ::

so with some chance it fails.

This change should make it deterministic --- since the two faces are named sigma_1 and sigma_1', the comparison should be by custom name…?

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes. (not applicable)
  • I have updated the documentation and checked the documentation preview.

@user202729 user202729 force-pushed the fix-simplicial-set-flaky branch from df9ba13 to 1830861 Compare November 8, 2024 14:34
Copy link

github-actions bot commented Nov 8, 2024

Documentation preview for this PR (built with commit f070aa3; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@user202729
Copy link
Contributor Author

The failed test is

2024-11-08T15:09:09.5768206Z **********************************************************************
2024-11-08T15:09:09.5893109Z File "src/sage/groups/finitely_presented_named.py", line 489, in sage.groups.finitely_presented_named.AlternatingPresentation
2024-11-08T15:09:09.5894783Z Failed example:
2024-11-08T15:09:09.5895452Z     A1.is_isomorphic(A2), A1.order()
2024-11-08T15:09:09.5896032Z Expected:
2024-11-08T15:09:09.5896389Z     (True, 1)
2024-11-08T15:09:09.5896732Z Got:
2024-11-08T15:09:09.5897089Z     #I  Forcing finiteness test
2024-11-08T15:09:09.5897589Z     (True, 1)
2024-11-08T15:09:11.2068744Z **********************************************************************

This is obviously #38889 instead.

By the way, GitHub Actions doesn't seem to be able to report test failure to the GitHub interface?

@orlitzky
Copy link
Contributor

This is obviously #38889 instead.

Potential solution: #38956

Copy link
Contributor

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

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

Thanks! The change looks good to me, as far as I understand the problem. But it would be good if someone more familiar with the code has a look at well.

Marking it already as "ci fix" so that other PRs don't keep falling because of this issue.

@tobiasdiez tobiasdiez added the p: CI Fix merged before running CI tests label Nov 18, 2024
@miguelmarco
Copy link
Contributor

Since there is no actual code being changed (just doctests), I see no risk in accepting it.

@user202729
Copy link
Contributor Author

There's always the risk of accidentally telling the user "this is the right way to do things" while it actually relies on dangerous internal implementation detail e.g. are you sure that the 1-cell is not shared between different objects, and mutate it is safe?

@miguelmarco
Copy link
Contributor

I am not 100% sure it is safe in any circumstance, but at the same time cannot think of a scenario where it is not safe.

Maybe @jhpalmieri can have a deeper insight.

@jhpalmieri
Copy link
Member

It looks okay to me (after a quick glance).

@tobiasdiez
Copy link
Contributor

I didn't see these test failures pop up again, so this PR is definitely achieving its goal. Since there were no objections, let's get it in.

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 6, 2024
    
Fixes sagemath#38888 .

This test has been failing sporadically recently e.g. https://github.com
/sagemath/sage/actions/runs/11733902583/job/32689016794?pr=38938 .

From my understanding of simplicial set, the two `sigma_1` are actually
representing two different cells (the wedge looks like a "8" shape), but
because they both come from `S1` (the 1-sphere i.e. circle), they get
the same name.

SageMath does some magic during doctest so that dict entries are sorted,
but the problem is

```
        At this point, comparison between v and w is random, based on
        their location in memory. ::
```

so with some chance it fails.

This change should make it deterministic --- since the two faces are
named `sigma_1` and `sigma_1'`, the comparison should be by custom
name…?

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes. (not applicable)
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#38940
Reported by: user202729
Reviewer(s): Tobias Diez
vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 8, 2024
    
Fixes sagemath#38888 .

This test has been failing sporadically recently e.g. https://github.com
/sagemath/sage/actions/runs/11733902583/job/32689016794?pr=38938 .

From my understanding of simplicial set, the two `sigma_1` are actually
representing two different cells (the wedge looks like a "8" shape), but
because they both come from `S1` (the 1-sphere i.e. circle), they get
the same name.

SageMath does some magic during doctest so that dict entries are sorted,
but the problem is

```
        At this point, comparison between v and w is random, based on
        their location in memory. ::
```

so with some chance it fails.

This change should make it deterministic --- since the two faces are
named `sigma_1` and `sigma_1'`, the comparison should be by custom
name…?

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes. (not applicable)
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#38940
Reported by: user202729
Reviewer(s): Tobias Diez
@vbraun vbraun merged commit 2fe0ab0 into sagemath:develop Dec 8, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: CI Fix merged before running CI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random test failure in simplicial_sets
6 participants