Skip to content

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable:

Summary

This fixes a test that became flaky after #1302.

The logic in #1302 isn't the problem. The problem is that this test was unrealistically mixing snippet symbols with real symbols in the same symbol graph file.

Depending on which symbol appears first in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph. This works for real symbol graph files because snippets symbol graphs files are created by a different tool than the module symbol graph files.

Dependencies

None.

Testing

Run this test (testContextDoesNotRecognizeNonOverloadableSymbolKinds) repeatedly with relaunching the test for each repetition so that the symbols order differently based on their hashes in the dictionary. The test should always pass.

I ran this test 1500 times and it always passed.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added Updated tests
  • Ran the ./bin/test script and it succeeded
  • [ ] Updated documentation if necessary

Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph.
However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols.
It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

d-ronnqvist commented Sep 29, 2025

Based on a basic code search, this was the only place that checked !$0.isOverloadableKind, thus potentially including snippets with other symbols.

@d-ronnqvist d-ronnqvist merged commit 3dc6dd0 into swiftlang:main Sep 29, 2025
2 checks passed
@d-ronnqvist d-ronnqvist deleted the fix-flaky-overload-test branch September 29, 2025 15:33
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request Sep 29, 2025
Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph.
However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols.
It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request Sep 29, 2025
Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph.
However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols.
It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
d-ronnqvist added a commit that referenced this pull request Sep 29, 2025
* Improve handling of snippet symbol graph files (#1302)

* Separate snippets from other symbols

rdar://147926589 rdar://161164434 #1280

* Rename tests to clarify what they're verifying

* Improve tests around optional snippet prefix components

* Add additional test about resolving and rendering snippets

* Make it easier to verify the diagnostic log output in tests

* Add additional test about snippet warnings

Also, update the behavior when a snippet slice is misspelled to match what's described in the warning.

* Move snippet diagnostic creation to resolver type

* Add near-miss suggestions for snippet paths and slices

* Only highlight the misspelled portion of snippet paths

* Update user-facing documentation about optional snippet paths prefixes

* Clarify that Snippet argument parsing problems are reported elsewhere

* Fix typo in code comment

* Update docs about earliest version with an optional snippet path prefix

* Fix test that became flaky after recent snippets change (#1308)

Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph.
However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols.
It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
d-ronnqvist added a commit that referenced this pull request Sep 29, 2025
* Improve handling of snippet symbol graph files (#1302)

* Separate snippets from other symbols

rdar://147926589 rdar://161164434 #1280

* Rename tests to clarify what they're verifying

* Improve tests around optional snippet prefix components

* Add additional test about resolving and rendering snippets

* Make it easier to verify the diagnostic log output in tests

* Add additional test about snippet warnings

Also, update the behavior when a snippet slice is misspelled to match what's described in the warning.

* Move snippet diagnostic creation to resolver type

* Add near-miss suggestions for snippet paths and slices

* Only highlight the misspelled portion of snippet paths

* Update user-facing documentation about optional snippet paths prefixes

* Clarify that Snippet argument parsing problems are reported elsewhere

* Fix typo in code comment

* Update docs about earliest version with an optional snippet path prefix

* Fix test that became flaky after recent snippets change (#1308)

Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph.
However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols.
It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
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