Repository navigation
Add dependency-aware generated packaging checks #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3628a32
fix: make generated packaging checks dependency-aware
sean-parent 8f10405
test: check installed package artifacts in CI
sean-parent 978311e
Fix deferred package artifact validation
sean-parent e2a55f0
Record generated CI packaging invariant
sean-parent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.scout/memory/knowledge/generated-ci-package-artifact-check.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: "Generated CI package artifact check" | ||
| entity_type: decision | ||
| confidence: 0.95 | ||
| created: 2026-11-15T04:12:07Z | ||
| last_accessed: 2026-11-15T04:27:16Z | ||
| last_reinforced: 2026-11-15T04:27:16Z | ||
| access_count: 2 | ||
| sources: | ||
| - "templates/.github/workflows/ci.yml.in:76-79" | ||
| - "templates/test-package.cmake.in:8-35" | ||
| - "cmake/cpp-library-ci.cmake:41-54" | ||
| tags: ["ci", "packaging", "cmake"] | ||
| tier: knowledge | ||
| --- | ||
|
|
||
| # Generated CI package artifact check | ||
|
|
||
| Generated consumer CI deliberately verifies only the root package's installed Config, ConfigVersion and Targets artifacts; dependency installation and downstream find_package resolution remain the consumer's responsibility. The checker requires both file existence and membership in the current CMake install manifest, so stale absolute-destination artifacts cannot pass. Absolute library destinations do not require the otherwise unused install prefix to exist. The deferred generator captures CPP_LIBRARY_ROOT when scheduled because setup may run inside a function whose scope ends before deferred calls execute. Sources: templates/.github/workflows/ci.yml.in:76-79, templates/test-package.cmake.in:8-35, cmake/cpp-library-ci.cmake:41-54. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
docs/superpowers/plans/2026-11-14-ci-package-artifact-check.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # CI Package Artifact Check Implementation Plan | ||
|
|
||
| > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. | ||
|
|
||
| **Goal:** Replace generated downstream-consumer testing with a check that the normal CI install produced the root package's config, version, and target-export files. | ||
|
|
||
| **Architecture:** Keep the workflow's existing `cmake --install` step and pass its prefix to the generated check script. The script verifies the three local package artifacts under the configured CMake install directory without staging dependencies or configuring a consumer. | ||
|
|
||
| **Tech Stack:** CMake script mode, CMake install rules, generated GitHub Actions workflow. | ||
|
|
||
| **Spec:** `docs/superpowers/specs/2026-11-14-ci-package-artifact-check-design.md` | ||
|
|
||
| ## Global Constraints | ||
|
|
||
| - Do not recursively install subdirectories, build a downstream consumer, or call `find_package()`. | ||
| - Do not require additional client configuration. | ||
| - Leave dependency installation and discovery to the client. | ||
| - Keep the existing workflow install step responsible for install-time errors. | ||
|
|
||
| ## Review Focus | ||
|
|
||
| - A missing prefix must fail with a useful error rather than succeeding through a self-staged install. | ||
| - A missing config, version, or targets file must fail the artifact check. | ||
| - A prefix containing spaces must work when passed from the generated workflow. | ||
| - A non-default `CMAKE_INSTALL_LIBDIR` must be honored. | ||
| - An absolute `CMAKE_INSTALL_LIBDIR` must not let stale files bypass a missing-prefix failure. | ||
| - The check must not configure or build a downstream consumer. | ||
|
|
||
| --- | ||
|
|
||
| ### Task 1: Check installed package artifacts in generated CI | ||
|
|
||
| **Files:** | ||
| - Modify: `cmake/cpp-library-ci.cmake` | ||
| - Modify: `cpp-library.cmake` | ||
| - Modify: `templates/test-package.cmake.in` | ||
| - Modify: `templates/.github/workflows/ci.yml.in` | ||
| - Modify: `tests/install/test_package_ci.cmake` | ||
|
|
||
| **Interfaces:** | ||
| - The generated script accepts `PACKAGE_TEST_PREFIX` as a `cmake -D` variable. | ||
| - The workflow passes the same `${{ runner.temp }}/install` prefix used by | ||
| `cmake --install`. | ||
| - The generated script checks | ||
| `<prefix>/<CMAKE_INSTALL_LIBDIR>/cmake/<PACKAGE_NAME>/` for | ||
| `<PACKAGE_NAME>Config.cmake`, `<PACKAGE_NAME>ConfigVersion.cmake`, and | ||
| `<PACKAGE_NAME>Targets.cmake`. | ||
|
|
||
| - [x] **Step 1: Rewrite the regression around the normal install prefix** | ||
|
|
||
| Replace the dependency-staging, external-dependency, and shadow-install cases | ||
| in `tests/install/test_package_ci.cmake` with focused artifact-check cases. | ||
| Configure the `single` fixture with `CMAKE_INSTALL_LIBDIR=lib64` and use an | ||
| install prefix whose path contains spaces. Before installing, invoke the | ||
| generated check with `PACKAGE_TEST_PREFIX` and require it to fail. Install the | ||
| fixture by executing the generated workflow's install command and require the | ||
| check to pass. For each required artifact, copy the install tree to a separate | ||
| prefix, remove that artifact, and require the check to fail. Also configure a | ||
| second fixture with an absolute `CMAKE_INSTALL_LIBDIR`, create stale artifact | ||
| files there, and verify a nonexistent install prefix still fails. Do not | ||
| configure or build a consumer. | ||
|
|
||
| - [x] **Step 2: Run the regression to confirm it exposes the old behavior** | ||
|
|
||
| Run: `cmake -P tests/install/test_package_ci.cmake` | ||
|
|
||
| Expected: FAIL because the current generated script ignores the supplied prefix | ||
| and stages its own package instead of rejecting the missing artifacts. | ||
|
|
||
| - [x] **Step 3: Generate a check script that verifies only local artifacts** | ||
|
|
||
| In `cmake/cpp-library-ci.cmake`, remove recursive install-list generation and | ||
| change the internal package-test helper and its `cpp-library.cmake` call site | ||
| to pass only the package name. Pass the configured `CMAKE_INSTALL_LIBDIR` to | ||
| `templates/test-package.cmake.in`. Replace the staging, consumer configure, | ||
| build, and CTest logic in that template with validation of `PACKAGE_TEST_PREFIX` | ||
| and explicit existence checks for the three required files. Report the missing | ||
| path in each failure. | ||
|
|
||
| - [x] **Step 4: Pass the workflow's existing install prefix to the check** | ||
|
|
||
| Update `templates/.github/workflows/ci.yml.in` so both install steps quote the | ||
| `${{ runner.temp }}/install` argument, and the artifact-check step passes that | ||
| same prefix as `PACKAGE_TEST_PREFIX`. | ||
|
|
||
| - [x] **Step 5: Run the focused packaging regression** | ||
|
|
||
| Run: `cmake -P tests/install/test_package_ci.cmake` | ||
|
|
||
| Expected: PASS for artifact presence and FAIL cases, including the absent | ||
| pre-install prefix, each missing artifact, a path containing spaces, `lib64`, | ||
| and stale artifacts under an absolute library directory. |
36 changes: 36 additions & 0 deletions
36
docs/superpowers/specs/2026-11-14-ci-package-artifact-check-design.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # CI Package Artifact Check — Design | ||
|
|
||
| ## Goal | ||
|
|
||
| Replace the generated downstream-consumer test with a check that the normal CI | ||
| install produced the root package's config, version, and exported-target files. | ||
| This keeps CI independent of how clients install dependencies; it does not | ||
| claim to validate downstream `find_package()` resolution. | ||
|
|
||
| ## Scope | ||
|
|
||
| - Keep the generated workflow's normal `cmake --install` step. | ||
| - Pass its install prefix to the generated package-check script. | ||
| - Check for `<PACKAGE_NAME>Config.cmake`, | ||
| `<PACKAGE_NAME>ConfigVersion.cmake`, and | ||
| `<PACKAGE_NAME>Targets.cmake` under the package's configured CMake install | ||
| directory. | ||
| - Add focused regression coverage for present and missing artifacts. | ||
|
|
||
| ## Approaches | ||
|
|
||
| - **Stage dependencies and configure a consumer.** Rejected because CI cannot | ||
| infer how arbitrary dependencies are installed or discovered without | ||
| client-specific inputs. | ||
| - **Rely on install success alone.** Simpler, but does not detect a successful | ||
| install that omitted the local package files. | ||
| - **Check local package artifacts.** Selected because it verifies the root | ||
| package's install output without requiring dependency configuration. | ||
|
|
||
| ## Constraints and non-goals | ||
|
|
||
| The check must not recursively install subdirectories, build a downstream | ||
| consumer, call `find_package()`, or require additional client configuration. | ||
| Dependency installation and discovery remain the client's responsibility. | ||
| The existing install step remains responsible for reporting install-time | ||
| errors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
| # Auto-generated by cpp-library. Run after installing the package. | ||
| cmake_minimum_required(VERSION 3.24) | ||
|
|
||
| if(NOT DEFINED PACKAGE_TEST_PREFIX OR PACKAGE_TEST_PREFIX STREQUAL "") | ||
| message(FATAL_ERROR "PACKAGE_TEST_PREFIX must name the install prefix") | ||
| endif() | ||
| set(package_install_dir "@PACKAGE_TEST_INSTALL_LIBDIR@/cmake/@PACKAGE_TEST_NAME@") | ||
| if(IS_ABSOLUTE "${package_install_dir}") | ||
| set(package_dir "${package_install_dir}") | ||
|
sean-parent marked this conversation as resolved.
Resolved
|
||
| else() | ||
| if(NOT IS_DIRECTORY "${PACKAGE_TEST_PREFIX}") | ||
| message(FATAL_ERROR "Package install prefix does not exist: ${PACKAGE_TEST_PREFIX}") | ||
| endif() | ||
| set(package_dir "${PACKAGE_TEST_PREFIX}/${package_install_dir}") | ||
| endif() | ||
|
|
||
| set(manifest "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
| if(NOT EXISTS "${manifest}") | ||
| message(FATAL_ERROR "Package install manifest is missing: ${manifest}") | ||
| endif() | ||
| file(STRINGS "${manifest}" installed_files) | ||
|
|
||
| foreach(artifact IN ITEMS | ||
| "@PACKAGE_TEST_NAME@Config.cmake" | ||
| "@PACKAGE_TEST_NAME@ConfigVersion.cmake" | ||
| "@PACKAGE_TEST_NAME@Targets.cmake") | ||
| set(artifact_path "${package_dir}/${artifact}") | ||
| if(NOT EXISTS "${artifact_path}") | ||
| message(FATAL_ERROR "Installed package artifact is missing: ${artifact_path}") | ||
| endif() | ||
| cmake_path(NORMAL_PATH artifact_path) | ||
| if(NOT artifact_path IN_LIST installed_files) | ||
| message(FATAL_ERROR "Package artifact was not installed: ${artifact_path}") | ||
| endif() | ||
| endforeach() | ||
|
|
||
| message(STATUS "Installed @PACKAGE_TEST_NAME@ artifacts found in ${package_dir}") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| cmake_minimum_required(VERSION 3.24) | ||
| include("${TOOLKIT_SOURCE}/cpp-library.cmake") | ||
| project(extra LANGUAGES CXX) | ||
| set(CPP_LIBRARY_VERSION 1.0.0) | ||
| cpp_library_setup( | ||
| DESCRIPTION "Transitive packaging dependency fixture" | ||
| NAMESPACE stlab | ||
| HEADERS extra.hpp | ||
| INSTALL_OPTION STLAB_LEAF_INSTALL) |
5 changes: 5 additions & 0 deletions
5
tests/install/fixtures/nested/leaf/extra/include/stlab/extra.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #pragma once | ||
|
|
||
| namespace stlab { | ||
| inline constexpr int extra_value = 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cmake_minimum_required(VERSION 3.24) | ||
| include("${TOOLKIT_SOURCE}/cpp-library.cmake") | ||
| cpp_library_enable_dependency_tracking() | ||
| project(single LANGUAGES CXX) | ||
| set(CPP_LIBRARY_VERSION 1.0.0) | ||
| cpp_library_setup( | ||
| DESCRIPTION "Dependency-free packaging fixture" | ||
| NAMESPACE stlab | ||
| HEADERS single.hpp) | ||
| if(EXTERNAL_PACKAGE) | ||
| find_package(stlab-extra 1.0.0 CONFIG REQUIRED) | ||
| target_link_libraries(single INTERFACE stlab::extra) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #pragma once | ||
|
|
||
| namespace stlab { | ||
| inline constexpr int single_value = 42; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.