-
Notifications
You must be signed in to change notification settings - Fork 0
fix(source-control): exclude self-login from babysit new_human_blocking_feedback #494
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d4cb160
fix(source-control): exclude self-login from babysit new_human_blocki…
kyle-sexton 9a9c991
test(source-control): cover self-login exclusion on non-blocking huma…
kyle-sexton 116337a
fix(source-control): resolve self logins independently of discovery a…
kyle-sexton ddfd248
Merge remote-tracking branch 'origin/main' into fix/473-babysit-self-…
kyle-sexton a64efe1
fix(source-control): drop tracker ref from babysit delta test comment
kyle-sexton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
plugins/source-control/skills/babysit-prs/scripts/tests/test_pr_queue_snapshot.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| """Snapshot config assembly: self-login resolution and ClassifyConfig mapping. | ||
|
|
||
| Covers the decoupling of the self-identity suppression set from the discovery | ||
| `--author` filter. `@me` resolution is stubbed by monkeypatching the `babysit_gh` | ||
| seam; no real gh process is spawned. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import pathlib | ||
| import sys | ||
| import unittest | ||
| from unittest import mock | ||
|
|
||
| sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent)) | ||
|
|
||
| import babysit_gh as gh # noqa: E402 | ||
| import pr_queue_snapshot as snapshot # noqa: E402 | ||
|
|
||
|
|
||
| class ResolveSelfLoginsTests(unittest.TestCase): | ||
| def test_autopilot_empty_authors_still_yields_authenticated_login(self) -> None: | ||
| with mock.patch.object(gh, "resolve_author", return_value="kyle-sexton"): | ||
| self.assertEqual(snapshot.resolve_self_logins([]), ["kyle-sexton"]) | ||
|
|
||
| def test_discovery_authors_are_unioned_with_the_self_login(self) -> None: | ||
| with mock.patch.object(gh, "resolve_author", return_value="kyle-sexton"): | ||
| self.assertEqual( | ||
| snapshot.resolve_self_logins(["alice", "bob"]), | ||
| ["alice", "bob", "kyle-sexton"], | ||
| ) | ||
|
|
||
| def test_self_login_already_present_is_not_duplicated(self) -> None: | ||
| with mock.patch.object(gh, "resolve_author", return_value="Kyle-Sexton"): | ||
| self.assertEqual( | ||
| snapshot.resolve_self_logins(["alice", "kyle-sexton"]), | ||
| ["alice", "kyle-sexton"], | ||
| ) | ||
|
|
||
| def test_input_author_list_is_not_mutated(self) -> None: | ||
| authors = ["alice"] | ||
| with mock.patch.object(gh, "resolve_author", return_value="kyle-sexton"): | ||
| snapshot.resolve_self_logins(authors) | ||
| self.assertEqual(authors, ["alice"]) | ||
|
|
||
| def test_unresolvable_self_login_leaves_discovery_authors_intact(self) -> None: | ||
| with mock.patch.object(gh, "resolve_author", return_value=None): | ||
| self.assertEqual(snapshot.resolve_self_logins(["alice"]), ["alice"]) | ||
|
|
||
|
|
||
| class BuildConfigSelfLoginsTests(unittest.TestCase): | ||
| def test_resolved_self_logins_populate_config_self_logins(self) -> None: | ||
| args = argparse.Namespace( | ||
| owners="melodic-software", | ||
| resolved_self_logins=["kyle-sexton"], | ||
| ) | ||
| config = snapshot.build_config(args) | ||
| self.assertEqual(config.self_logins, frozenset({"kyle-sexton"})) | ||
|
|
||
| def test_resolved_self_logins_take_precedence_over_resolved_authors(self) -> None: | ||
| args = argparse.Namespace( | ||
| owners="melodic-software", | ||
| resolved_authors=["alice"], | ||
| resolved_self_logins=["kyle-sexton"], | ||
| ) | ||
| config = snapshot.build_config(args) | ||
| self.assertEqual(config.self_logins, frozenset({"kyle-sexton"})) | ||
|
|
||
| def test_raw_author_fallback_drops_me_when_unresolved(self) -> None: | ||
| args = argparse.Namespace( | ||
| owners="melodic-software", | ||
| author="@me,alice", | ||
| ) | ||
| config = snapshot.build_config(args) | ||
| self.assertEqual(config.self_logins, frozenset({"alice"})) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.