[BugFix][CI] Restore diff-aware source filtering for post-merge L3 (#7371)

Signed-off-by: wangyu <410167048@qq.com>
This commit is contained in:
wangyu authored and GitHub committed 2026-09-10 16:11:27 +00:00
1 parent 05ab509269
commit 627630d7e4
7 files changed
+45 -39

No files matched your search

+13 -11
View File
@@ -692,19 +692,24 @@ def test_source_filter_strips_deps_and_expands_hardware(monkeypatch: pytest.Monk
assert z_image["agents"]["queue"] == "l4-k8s"
def test_source_filter_disabled_on_main_branch(monkeypatch: pytest.MonkeyPatch) -> None:
def test_source_filter_respects_force_all_and_uses_diff_on_main(
monkeypatch: pytest.MonkeyPatch,
) -> None:
class _Ctx:
changed_files = ["vllm_omni/unrelated.py"]
# Post-merge main L3 must still filter by the commit diff.
monkeypatch.setenv("BUILDKITE_BRANCH", "main")
assert _changed_files_for_source_filter(_Ctx(), force_all=False, e2e_only=False) is None
assert _changed_files_for_source_filter(_Ctx(), force_all=False, e2e_only=False) == [
"vllm_omni/unrelated.py",
]
monkeypatch.setenv("BUILDKITE_BRANCH", "feat/source-filter")
assert _changed_files_for_source_filter(_Ctx(), force_all=False, e2e_only=False) == [
"vllm_omni/unrelated.py",
]
monkeypatch.setenv("BUILDKITE_BRANCH", "main")
assert _changed_files_for_source_filter(_Ctx(), force_all=True, e2e_only=False) is None
assert _changed_files_for_source_filter(_Ctx(), force_all=False, e2e_only=True) is None
def test_source_filter_fallback_is_fallback_when_no_job_key_matches(
@@ -715,7 +720,6 @@ def test_source_filter_fallback_is_fallback_when_no_job_key_matches(
monkeypatch.setenv("BUILDKITE_BRANCH", "feat/nightly-yaml")
pipeline_yaml = Path(".buildkite/npu/test-npu-nightly.yml")
shared_paths = _load_source_file_dependencies()["source_filter_fallback"]
assert ".buildkite/common/scripts/upload_pipeline.py" in shared_paths
# Synthetic steps only — do not pin live Buildkite job labels.
doc = {
@@ -742,7 +746,7 @@ def test_source_filter_fallback_is_fallback_when_no_job_key_matches(
)
return {step["key"] for step in _iter_steps(rendered) if isinstance(step.get("key"), str)}
# Only pipeline YAML / shared uploader → no listed prefix match → keep every step.
# Only pipeline YAML / fallback paths → no listed prefix match → keep every step.
for changed in [pipeline_yaml.as_posix(), *shared_paths]:
assert surviving_keys([changed]) == {"ungated", "gated_a", "gated_b"}, changed
@@ -750,9 +754,7 @@ def test_source_filter_fallback_is_fallback_when_no_job_key_matches(
assert surviving_keys([".buildkite/cuda/test-nightly.yml"]) == {"ungated"}
# A matching source prefix wins over fallback files in the same diff.
assert surviving_keys(
[
"pkg/model_a/transformer.py",
".buildkite/common/scripts/upload_pipeline.py",
],
) == {"ungated", "gated_a"}
assert surviving_keys(["pkg/model_a/transformer.py", *shared_paths[:1]]) == {
"ungated",
"gated_a",
}