Skip to content

Commit d1c1934

Browse files
luisleo526claude
andauthored
ci: admit the typed Eigen3_DIR flag in the release step contract (#795)
The release prebuilt configure passes -DEigen3_DIR=/usr/share/eigen3/cmake and then requires the cache line Eigen3_DIR:PATH=/usr/share/eigen3/cmake. Without a type CMake caches the entry as Eigen3_DIR:UNINITIALIZED, so the check fails after every successful configure. The fix is the typed flag, but the PR admission rules judge a pull request's workflows with main's contract, which names the untyped flag exactly. Read -DEigen3_DIR:PATH=/usr/share/eigen3/cmake as the reviewed untyped flag wherever the release prebuilt steps are compared, so both forms are admitted. release.yml is unchanged here; the switch to the typed flag, and the contract's return to a single form, follow in their own change. Any other Eigen3_DIR value is still refused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a3964ad commit d1c1934

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎scripts/ci_preflight.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4764,7 +4764,23 @@ def _release_split_steps(job: str) -> list[str]:
47644764
return [step.rstrip('\n') for step in _steps(template)]
47654765

47664766

4767+
EIGEN_DIR_UNTYPED = '-DEigen3_DIR=/usr/share/eigen3/cmake'
4768+
EIGEN_DIR_TYPED = '-DEigen3_DIR:PATH=/usr/share/eigen3/cmake'
4769+
4770+
4771+
def _eigen_dir_accept_typed(text: str) -> str:
4772+
"""Read the typed Eigen3_DIR flag as the reviewed one.
4773+
4774+
Without a type CMake caches Eigen3_DIR as UNINITIALIZED, so the reviewed
4775+
`grep -Fx 'Eigen3_DIR:PATH=...'` never matches. The typed flag is the fix;
4776+
both forms are admitted until the workflow switches, then the contract
4777+
keeps the typed form only.
4778+
"""
4779+
return text.replace(EIGEN_DIR_TYPED, EIGEN_DIR_UNTYPED)
4780+
4781+
47674782
def _release_split_job_findings(job: str, body: str) -> list[str]:
4783+
body = _eigen_dir_accept_typed(body)
47684784
findings = []
47694785
metadata = []
47704786
in_steps, step_mappings = False, 0
@@ -4857,6 +4873,7 @@ def _release_split_workflow_findings(workflow: str) -> list[str]:
48574873

48584874
def release_prebuilt_workflow_findings(workflow: str) -> list[str]:
48594875
"""Pin artifact structure and its token-only admission surface."""
4876+
workflow = _eigen_dir_accept_typed(workflow)
48604877
if _release_split_requested(_jobs(workflow)):
48614878
return _release_split_workflow_findings(workflow)
48624879
prebuilt = _jobs(workflow).get('prebuilt', '')

‎scripts/test_ci_preflight.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12853,6 +12853,22 @@ def assert_refused(self, changed, finding):
1285312853
self.assertIn(finding, main_admission_data_findings(
1285412854
{'gke-pr.yml': self.gke, 'release.yml': changed}))
1285512855

12856+
def test_typed_eigen_dir_flag_is_admitted_in_both_layouts(self):
12857+
# The untyped flag leaves Eigen3_DIR UNINITIALIZED in the cache, so the
12858+
# reviewed grep for Eigen3_DIR:PATH fails; the typed flag is admitted.
12859+
untyped = ci_preflight.EIGEN_DIR_UNTYPED
12860+
typed = ci_preflight.EIGEN_DIR_TYPED
12861+
for workflow in (self.split, self.legacy):
12862+
changed = workflow.replace(untyped, typed)
12863+
with self.subTest(jobs=tuple(_jobs(workflow))):
12864+
self.assertNotEqual(changed, workflow)
12865+
self.assertEqual(ci_preflight.release_prebuilt_workflow_findings(changed), [])
12866+
self.assertEqual(ci_preflight.runner_findings({'release.yml': changed}), [])
12867+
self.assertEqual(main_admission_data_findings(
12868+
{'gke-pr.yml': self.gke, 'release.yml': changed}), [])
12869+
moved = self.split.replace(untyped, '-DEigen3_DIR:PATH=/outside')
12870+
self.assertTrue(ci_preflight.release_prebuilt_workflow_findings(moved))
12871+
1285612872
def test_legacy_and_split_layouts_dispatch_through_real_parsers(self):
1285712873
# Exercise the matrix forms and the intended split through the same
1285812874
# checker entry points, independently of later workflow cutovers.

0 commit comments

Comments
 (0)