From b45048d4150d8c496d214e7ffd028ea486d5c8c2 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Thu, 22 Oct 2026 13:35:31 +0800 Subject: [PATCH] fix(ci): classify known test fixtures by validation consumers (NAN-331) --- scripts/ci_scope.py | 9 +++++++++ tests/scripts/test_ci_scope.py | 32 +++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/scripts/ci_scope.py b/scripts/ci_scope.py index 8bf5f0243..835d66aca 100644 --- a/scripts/ci_scope.py +++ b/scripts/ci_scope.py @@ -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"), diff --git a/tests/scripts/test_ci_scope.py b/tests/scripts/test_ci_scope.py index 3168eb7bb..6947d2361 100644 --- a/tests/scripts/test_ci_scope.py +++ b/tests/scripts/test_ci_scope.py @@ -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):