fix(ci): classify known test fixtures by validation consumers (NAN-331)

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-22 14:28:20 +08:00
1 parent f11ea5f9e0
commit b45048d415
2 files changed
+40 -1

No files matched your search

+9
View File
@@ -42,6 +42,15 @@ RULES = (
(("Dockerfile", "Dockerfile.*", ".dockerignore", "docker-compose*.yml", "entrypoint.sh",
"render-config.json", "README.md", "LICENSE", "THIRD_PARTY_NOTICES.md",
"tests/test_docker*", "scripts/docker_compose_smoke.py"), DOCKER, "Docker input or acceptance"),
# Shared fixture consumers live in tests/webui and webui/src/tests; the
# SQLite migration and release-trust fixtures have separate Python owners.
(("tests/webui/fixtures/runtime-config-keys.json",), PYTHON | WEBUI,
"shared Python and WebUI runtime configuration test contract"),
(("tests/session/fixtures/sqlite_v1.sql",), PYTHON, "Python session schema migration fixture"),
(("tests/fixtures/sigstore/bundle_v3.txt", "tests/fixtures/sigstore/bundle_v3.txt.sigstore"),
PYTHON | NATIVE, "release trust verification fixtures"),
(("tests/fixtures/sigstore/README.md", "tests/fixtures/sigstore/LICENSE"),
frozenset(), "test fixture provenance and license"),
(("docs/*", ".agent/*", ".github/ISSUE_TEMPLATE/*", "AGENTS.md", "CLAUDE.md",
"COMMUNICATION.md", "CONTRIBUTING.md", "SECURITY.md", "webui/README.md",
"tui/README.md", "render.yaml", "images/*"), frozenset(), "documentation only"),
+31 -1
View File
@@ -29,6 +29,13 @@ def selected(result):
("entrypoint.sh", {"docker"}),
("tests/test_docker_config.py", {"python", "docker"}),
("tests/test_docker_smoke.py", {"python", "docker"}),
("tests/test_docker.sh", {"docker"}),
("tests/webui/fixtures/runtime-config-keys.json", {"python", "webui"}),
("tests/session/fixtures/sqlite_v1.sql", {"python"}),
("tests/fixtures/sigstore/bundle_v3.txt", {"python", "native"}),
("tests/fixtures/sigstore/bundle_v3.txt.sigstore", {"python", "native"}),
("tests/fixtures/sigstore/README.md", set()),
("tests/fixtures/sigstore/LICENSE", set()),
("webui/package.json", {"webui", "docker"}),
("nanobot/channels/discord/webui/index.ts", {"webui", "docker"}),
("tui/package.json", {"tui", "native"}),
@@ -76,7 +83,10 @@ def test_existing_path_policy(path, expected):
assert result["paths"][0]["reason"]
@pytest.mark.parametrize("path", ["new-domain/source.txt", ".github/workflows/publish-index.yml", "uv.lock"])
@pytest.mark.parametrize("path", [
"new-domain/source.txt", ".github/workflows/publish-index.yml", "uv.lock",
"tests/webui/fixtures/new-contract.json", "tests/fixtures/sigstore/new-proof.sigstore",
])
def test_new_or_cross_domain_paths_require_every_job(path):
assert all(classify_paths([path])["outputs"].values())
@@ -87,6 +97,26 @@ def test_union_preserves_each_reason():
assert len(result["paths"]) == 3
@pytest.mark.parametrize(
("paths", "expected"),
[
(["tests/webui/fixtures/runtime-config-keys.json", "tests/session/fixtures/sqlite_v1.sql"],
{"python", "webui"}),
(["tests/webui/fixtures/runtime-config-keys.json", "nanobot/webui/settings_runtime.py",
"webui/src/tests/settings-runtime-config.test.tsx"],
{"python", "webui", "tui", "docker"}),
(["tests/webui/fixtures/runtime-config-keys.json", "tests/fixtures/sigstore/bundle_v3.txt"],
{"python", "webui", "native"}),
(["tests/session/fixtures/sqlite_v1.sql", "tests/webui/fixtures/new-contract.json"],
{"python", "webui", "tui", "docker", "native"}),
],
)
def test_fixture_requirements_combine_with_other_changed_paths(paths, expected):
result = classify_paths(paths)
assert selected(result) == expected
assert len(result["paths"]) == len(paths)
@pytest.fixture
def repo(tmp_path):
def git(*args, input=None):