Skip to content

Identify C++ CI matrix jobs with a generated runId - #660

Merged
nikobockerman merged 2 commits into
mainfrom
ci-cpp-matrix-run-id
Aug 12, 2026
Merged

Identify C++ CI matrix jobs with a generated runId#660
nikobockerman merged 2 commits into
mainfrom
ci-cpp-matrix-run-id

Conversation

@nikobockerman

Copy link
Copy Markdown
Owner

The preset-name step built a string per matrix job by reassembling the four axes in shell. Its name no longer described it: the CMake preset is the literal ci, and the string's only consumers are the Conan cache key prefixes in cmake-project-setup and cmake-project-finalize. Now that the generator emits the matrix, the same value can come from the entry it already describes, so the step is redundant.

Add a runId field, joining every field of the entry so it stays unique by construction even if the matrix grows another axis, and read it as conan-${{ matrix.runId }} where the cache prefix is needed. The prefixes must stay distinct per scenario: cmake-project-setup falls back to restoring on the bare prefix, so a shared one would have every job pull a sibling configuration's packages, miss on package_id and rebuild from source anyway.

The vestigial ci- infix is dropped, since it described the preset name this string no longer is. That changes every prefix, so the existing Conan caches are orphaned and the first run rebuilds from source before saving under the new keys.

The `preset-name` step built a string per matrix job by reassembling the
four axes in shell. Its name no longer described it: the CMake preset is
the literal `ci`, and the string's only consumers are the Conan cache
key prefixes in cmake-project-setup and cmake-project-finalize. Now that
the generator emits the matrix, the same value can come from the entry
it already describes, so the step is redundant.

Add a `runId` field, joining every field of the entry so it stays unique
by construction even if the matrix grows another axis, and read it as
`conan-${{ matrix.runId }}` where the cache prefix is needed. The
prefixes must stay distinct per scenario: cmake-project-setup falls back
to restoring on the bare prefix, so a shared one would have every job
pull a sibling configuration's packages, miss on package_id and rebuild
from source anyway.

The vestigial `ci-` infix is dropped, since it described the preset name
this string no longer is. That changes every prefix, so the existing
Conan caches are orphaned and the first run rebuilds from source before
saving under the new keys.
Copilot AI lite review requested due to automatic review settings August 12, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the C++ CI workflow to use a generated, per-matrix-entry identifier (runId) for Conan cache key prefixes, removing the redundant shell step that previously reconstructed a preset-name-like string.

Changes:

  • Remove the preset-name step from the workflow and switch Conan cache key prefixes to conan-${{ matrix.runId }}.
  • Extend the CI matrix generator to emit a runId field derived from the matrix entry fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/cpp-build-test-run.yaml Drops the preset-name step and uses matrix.runId for Conan cache key prefixes in setup/finalize steps.
.github/scripts/generate-cpp-ci-config.py Adds runId to generated matrix entries by joining the matrix entry fields.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/scripts/generate-cpp-ci-config.py
Joining the entry fields is only collision-free while no axis value
contains the separator: ("libc++", "debug-x") and ("libc++-debug", "x")
render the same runId. Two jobs sharing one would quietly share a Conan
cache bucket, each restoring the other's packages and rebuilding anyway,
with nothing turning red.

Check the invariant that matters -- distinct entries, distinct runIds --
rather than restricting what an axis value may contain. It also catches
a duplicated table row, and fails in the resolver job instead of nine
build jobs.
Copilot AI review requested due to automatic review settings August 12, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

.github/scripts/generate-cpp-ci-config.py:420

  • Avoid using assert for validating runId uniqueness. Python assertions can be stripped with -O, which would silently skip this safety check and potentially cause cache-key collisions. Use an explicit runtime check and raise an exception instead.
    # Two jobs sharing a runId would quietly share one Conan cache bucket, each
    # restoring the other's packages and rebuilding anyway. Nothing downstream
    # would fail, so catch it here.
    run_ids = {entry["runId"] for entry in include}
    assert len(run_ids) == len(include), "runId values are not unique"

@nikobockerman
nikobockerman merged commit 6996d7b into main Aug 12, 2026
54 checks passed
@nikobockerman
nikobockerman deleted the ci-cpp-matrix-run-id branch August 12, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants