From 876925e46f0e9c739bbddac250fdd50802e3733c Mon Sep 17 00:00:00 2001 From: Dave Mihalcik Date: Wed, 23 Sep 2026 12:36:16 -0400 Subject: [PATCH] fix(otdf-sdk-mgr): flatten slashed branch names into dist/src tags A branch ref like 'feat/DSPX-2604-createtdf-chunked' resolved by name (not by SHA) kept its slash in the tag, nesting dist// and src// one level deeper than every consumer expects: xtest's all_versions_of() lists dist/*/ and the Go Makefile finds src/*/, so the build was silently discovered as a bare 'feat' directory with no cli.sh in it. Flatten the tag the same way _classify_sha_match already flattens a branch reached by SHA. --- otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py | 9 ++++++++- otdf-sdk-mgr/tests/test_resolve.py | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py b/otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py index 9c50d2ce1..7ff3b6811 100644 --- a/otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py +++ b/otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py @@ -300,7 +300,14 @@ def _resolve_against( "alias": version, "head": True, "sha": sha, - "tag": version, + # Flattened the same way _classify_sha_match flattens a branch + # it reached by SHA: the tag becomes a single dist// and + # src// path component. A slash here nests those + # directories, and every consumer walks them one level deep -- + # xtest's all_versions_of() lists dist/*/ and the go Makefile + # finds src/*/, so "feat/x" is discovered as a "feat" build + # with no cli.sh in it. + "tag": version.replace("/", "--"), } if infix and version.startswith(f"{infix}/"): diff --git a/otdf-sdk-mgr/tests/test_resolve.py b/otdf-sdk-mgr/tests/test_resolve.py index a7c30b057..29efa6f6f 100644 --- a/otdf-sdk-mgr/tests/test_resolve.py +++ b/otdf-sdk-mgr/tests/test_resolve.py @@ -76,7 +76,24 @@ def test_refs_heads_non_main_branch(self): result = resolve("js", "refs/heads/release/sdk-v0.17", None) assert is_resolve_success(result) assert "head" in result and result["head"] is True - assert result["tag"] == "release/sdk-v0.17" + assert result["tag"] == "release--sdk-v0.17" + assert result["sha"] == SHA40 + + def test_branch_by_name_flattens_slashes(self): + # Same flattening the SHA path applies, and for the same reason: the + # tag is one path component under dist/ and src/. Reached by name + # rather than by SHA, which is the shape a workflow_dispatch input + # arrives in. + ls = make_ls_remote( + (SHA40, "refs/heads/feat/DSPX-2604-createtdf-chunked"), + ("d" * 40, "refs/heads/main"), + ) + with patch_git(ls): + result = resolve("go", "feat/DSPX-2604-createtdf-chunked", None) + assert is_resolve_success(result) + assert result.get("head") is True + assert result["tag"] == "feat--DSPX-2604-createtdf-chunked" + assert result["alias"] == "feat/DSPX-2604-createtdf-chunked" assert result["sha"] == SHA40