@@ -232,12 +232,41 @@ if "$temporary_dir/revision-validator" "$revision_repo" not-a-full-sha; then
232232 exit 1
233233fi
234234
235+ if ! grep -A1 ' ^te = \[$' pyproject.toml | grep -Fxq ' "megatron-core[te]",' ; then
236+ echo " Bridge's TE extra must enable the selected MCore ref's TE extra" >&2
237+ exit 1
238+ fi
239+ grep -Fq ' { name = "megatron-core", extra = ["te"] }' uv.lock
235240if grep -q ' transformer-engine @ git+https://github.com/NVIDIA/TransformerEngine.git@' pyproject.toml || \
236241 grep -q ' ^name = "transformer-engine"$' pyproject.toml; then
237242 echo " Bridge must inherit the TransformerEngine source and metadata from the selected MCore ref" >&2
238243 exit 1
239244fi
240245
246+ lock_package_field () {
247+ local lock_file=" $1 "
248+ local package=" $2 "
249+ local field=" $3 "
250+
251+ awk -v package=" $package " -v field=" $field " '
252+ $0 == "[[package]]" { in_package = 1; package_matches = 0; next }
253+ in_package && $0 ~ /^\[\[/ { in_package = 0; package_matches = 0 }
254+ in_package && $0 == "name = \"" package "\"" { package_matches = 1; next }
255+ package_matches && index($0, field " = ") == 1 { print; exit }
256+ ' " $lock_file "
257+ }
258+
259+ mlm_te_source=$( lock_package_field 3rdparty/Megatron-LM/uv.lock transformer-engine source)
260+ bridge_te_source=$( lock_package_field uv.lock transformer-engine source)
261+ if [[ ! " $mlm_te_source " =~ ^source\ = \ \{\ git\ = \ \" https://github.com/NVIDIA/TransformerEngine\. git\? rev= [0-9a-f]{40}# [0-9a-f]{40}\"\ \}$ ]]; then
262+ echo " Selected MCore lock must pin TransformerEngine to a full source revision" > & 2
263+ exit 1
264+ fi
265+ if [[ " $bridge_te_source " != " $mlm_te_source " ]]; then
266+ echo " Bridge must lock the TransformerEngine source selected by MCore" >&2
267+ exit 1
268+ fi
269+
241270composite_action= " .github/actions/test-template/action.yml"
242271if grep -qE ' mcore_(commit|ref)|MCORE_COMMIT|uv sync --all-extras --all-groups' " $composite_action " ; then
243272 echo " Test template must use the already-validated MCore in the built image" >&2
0 commit comments