-
Notifications
You must be signed in to change notification settings - Fork 205
Add failed-ingest recovery and pre-reuse changelog validation [skip-sweep] #1821
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 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ae01bdb
docs: add failed-ingest recovery command [skip-sweep]
Oseltamivir 3d432bb
fix(ci): validate changelog before sweep reuse [skip-sweep]
Oseltamivir a77ab9d
test(ci): add push coverage for changelog gate [skip-sweep]
Oseltamivir 0aa145a
test(ci): exercise changelog gate failure [skip-sweep]
Oseltamivir 7a44b36
test(ci): restore changelog gate success path [skip-sweep]
Oseltamivir 19d98b1
fix(ci): harden changelog reuse and recovery [skip-sweep]
Oseltamivir 32d1bac
Merge remote-tracking branch 'origin/main' into workflow/add-recover-…
Oseltamivir e0a422b
fix(ci): close reuse validation edge cases [skip-sweep]
Oseltamivir f80acc3
test(ci): exhaustively verify run-sweep gating against real condition…
Oseltamivir e365c30
test(ci): drop redundant changelog-gate simulation jobs [skip-sweep]
Oseltamivir 90905af
fix(ci): drop opened/reopened sweep triggers [skip-sweep]
Oseltamivir 0452e5e
refactor(ci): move new changelog-gate tests into utils/changelog_gate…
Oseltamivir 5b9ce1e
test(ci): cover multi-entry changelog conflict resolution [skip-sweep]
Oseltamivir 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
| import yaml | ||
|
|
||
| from validate_perf_changelog import ( | ||
| ChangelogValidationError, | ||
| compare_entries, | ||
| parse_changelog, | ||
| ) | ||
|
|
||
|
|
||
| def entry( | ||
| key: str, | ||
| link: str = "https://github.com/SemiAnalysisAI/InferenceX/pull/1", | ||
| ) -> dict[str, object]: | ||
| return { | ||
| "config-keys": [key], | ||
| "description": [f"Update {key}"], | ||
| "pr-link": link, | ||
| } | ||
|
|
||
|
|
||
| def render(entries: list[dict[str, object]]) -> bytes: | ||
| return yaml.safe_dump(entries, sort_keys=False).encode() | ||
|
|
||
|
|
||
| def test_parse_changelog_validates_complete_file() -> None: | ||
| parsed = parse_changelog(render([entry("config-a")]), "test changelog") | ||
|
|
||
| assert parsed == [entry("config-a")] | ||
|
|
||
|
|
||
| def test_parse_changelog_rejects_missing_final_newline() -> None: | ||
| raw = render([entry("config-a")]).rstrip(b"\n") | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="end with a newline"): | ||
| parse_changelog(raw, "test changelog") | ||
|
|
||
|
|
||
| def test_parse_changelog_rejects_malformed_nested_entry() -> None: | ||
| raw = b"""- config-keys: | ||
| - config-a | ||
| description: | ||
| - Update config-a | ||
| pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/1 | ||
| - config-keys: | ||
| - config-b | ||
| description: | ||
| - Update config-b | ||
| pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/2 | ||
| """ | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="not valid YAML"): | ||
| parse_changelog(raw, "test changelog") | ||
|
|
||
|
|
||
| def test_compare_entries_allows_appended_pr_entry() -> None: | ||
| base = [entry("config-a")] | ||
| added = entry("config-b", "XXX") | ||
|
|
||
| additions, corrections = compare_entries(base, [*base, added], 42) | ||
|
|
||
| assert additions == [added] | ||
| assert corrections == 0 | ||
|
|
||
|
|
||
| def test_compare_entries_rejects_wrong_pr_link_on_append() -> None: | ||
| base = [entry("config-a")] | ||
| added = entry( | ||
| "config-b", | ||
| "https://github.com/SemiAnalysisAI/InferenceX/pull/41", | ||
| ) | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="new PR entry"): | ||
| compare_entries(base, [*base, added], 42) | ||
|
|
||
|
|
||
| def test_compare_entries_requires_canonical_link_on_main() -> None: | ||
| base = [entry("config-a")] | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="main-branch entry"): | ||
| compare_entries(base, [*base, entry("config-b", "XXX")], None) | ||
|
|
||
|
|
||
| def test_compare_entries_allows_pr_link_only_correction() -> None: | ||
| base = [entry("config-a", "XXX")] | ||
| head = [ | ||
| entry( | ||
| "config-a", | ||
| "https://github.com/SemiAnalysisAI/InferenceX/pull/42", | ||
| ) | ||
| ] | ||
|
|
||
| additions, corrections = compare_entries(base, head, 99) | ||
|
|
||
| assert additions == [] | ||
| assert corrections == 1 | ||
|
|
||
|
|
||
| def test_compare_entries_rejects_existing_content_change() -> None: | ||
| base = [entry("config-a")] | ||
| head = [entry("config-a")] | ||
| head[0]["description"] = ["Different description"] | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="entry 1 changed"): | ||
| compare_entries(base, head, 42) | ||
|
|
||
|
|
||
| def test_compare_entries_rejects_deleted_entry() -> None: | ||
| with pytest.raises(ChangelogValidationError, match="entries were deleted"): | ||
| compare_entries([entry("config-a")], [], 42) | ||
|
|
||
|
|
||
| def test_compare_entries_rejects_correction_mixed_with_append() -> None: | ||
| base = [entry("config-a", "XXX")] | ||
| head = [ | ||
| entry( | ||
| "config-a", | ||
| "https://github.com/SemiAnalysisAI/InferenceX/pull/42", | ||
| ), | ||
| entry("config-b", "XXX"), | ||
| ] | ||
|
|
||
| with pytest.raises(ChangelogValidationError, match="do not mix"): | ||
| compare_entries(base, head, 42) |
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.