Repository navigation
ci: cover consumer fixtures in style and strict typing gates #414
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
codeforester
merged 8 commits into
main
from
ci/393-20261003-ci-ruff-check-and-mypy-do-not-cover-the-compatibility-consum
Oct 5, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
30e9e71
ci: cover all consumer fixtures in style and strict typing gates
codeforester 710208b
ci: keep Markdown examples under the documentation gate
codeforester d352e43
Merge remote-tracking branch 'origin/main' into ci/393-20261003-ci-ru…
codeforester 73770a5
ci: separate sustained persistence cost from hosted filesystem tails
codeforester 857e52e
Merge main for branch maintenance (#426)
codeforester 72336ec
ci: expose consumer typing source coverage
codeforester 990cb66
style: format typing gate test
codeforester 0f35aae
Merge remote-tracking branch 'origin/main' into ci/393-20261003-ci-ru…
codeforester 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ | |
| from pathlib import Path | ||
|
|
||
| import base_cli | ||
|
|
||
| from atlas_click.cli import command | ||
|
|
||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| import base_cli | ||
| import typer | ||
|
|
||
|
|
||
| cli = typer.Typer(help="Deploy Beacon services with typed parameters.") | ||
|
|
||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ | |
| from pathlib import Path | ||
|
|
||
| import base_cli | ||
|
|
||
| from beacon_typer.cli import command | ||
|
|
||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ | |
| from pathlib import Path | ||
|
|
||
| import base_cli | ||
|
|
||
| from cinder_automation.cli import app | ||
|
|
||
|
|
||
|
|
||
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,48 @@ | ||
| """Type-check every example and compatibility consumer at strict settings.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def main() -> int: | ||
| root = Path(__file__).resolve().parents[1] | ||
| # Git discovery also includes new, untracked source directories. Infrastructure | ||
| # scripts/tests have separate runtime gates; all product/example code is typed. | ||
| result = subprocess.run( | ||
| ["git", "ls-files", "--cached", "--others", "--exclude-standard", "--", "*.py"], | ||
|
codeforester marked this conversation as resolved.
|
||
| cwd=root, | ||
| check=True, | ||
| capture_output=True, | ||
|
codeforester marked this conversation as resolved.
|
||
| text=True, | ||
| ) | ||
| files = sorted(set(result.stdout.splitlines())) | ||
| excluded = {"lib", "scripts", "tests"} | ||
| sources = [name for name in files if Path(name).parts[0] not in excluded] | ||
| if not sources: | ||
| raise RuntimeError("No consumer Python sources found") | ||
| print("Consumer typing sources:") | ||
| print("\n".join(f"- {source}" for source in sources)) | ||
| return subprocess.run( | ||
| [sys.executable, "-m", "mypy", "--strict", "--explicit-package-bases", *sources], | ||
| cwd=root, | ||
| env={ | ||
| **os.environ, | ||
| "MYPYPATH": os.pathsep.join( | ||
| str(p) | ||
| for p in [ | ||
| root / "lib/python", | ||
| *sorted(root.glob("examples/*/src")), | ||
| *sorted(root.glob("compatibility/consumers/*/src")), | ||
| ] | ||
| ), | ||
| }, | ||
| check=False, | ||
| ).returncode | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
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,34 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import importlib.util | ||
| import subprocess | ||
| from pathlib import Path | ||
| from unittest.mock import patch | ||
|
|
||
| SCRIPT = Path(__file__).parents[1] / "scripts" / "validate_consumer_typing.py" | ||
| SPEC = importlib.util.spec_from_file_location("validate_consumer_typing", SCRIPT) | ||
| if SPEC is None or SPEC.loader is None: # pragma: no cover | ||
| raise ImportError(f"Unable to load {SCRIPT}") | ||
| module = importlib.util.module_from_spec(SPEC) | ||
| SPEC.loader.exec_module(module) | ||
|
|
||
|
|
||
| def test_typing_gate_discovers_and_reports_only_consumer_sources() -> None: | ||
| discovery = subprocess.CompletedProcess( | ||
| ["git"], | ||
| 0, | ||
| "lib/python/base_cli/core.py\nscripts/tool.py\ntests/test.py\n" | ||
| "examples/demo/src/demo/cli.py\ncompatibility/consumers/atlas/src/atlas/cli.py\n", | ||
| "", | ||
| ) | ||
| mypy = subprocess.CompletedProcess(["mypy"], 0) | ||
| with patch.object(module.subprocess, "run", side_effect=[discovery, mypy]) as run: | ||
| assert module.main() == 0 | ||
|
|
||
| command = run.call_args_list[1].args[0] | ||
| assert command[-2:] == ["compatibility/consumers/atlas/src/atlas/cli.py", "examples/demo/src/demo/cli.py"] | ||
| assert "lib/python/base_cli/core.py" not in command | ||
| assert "scripts/tool.py" not in command | ||
| assert "tests/test.py" not in command | ||
| environment = run.call_args_list[1].kwargs["env"] | ||
| assert str(SCRIPT.parents[1] / "lib/python") in environment["MYPYPATH"] |
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.