Skip to content

[MAJOR] Harden template ownership and development workflows - #29

Merged
PeterCalifano merged 2 commits into
mainfrom
feature/harden-ownership-and-workflow
Aug 11, 2026
Merged

[MAJOR] Harden template ownership and development workflows#29
PeterCalifano merged 2 commits into
mainfrom
feature/harden-ownership-and-workflow

Conversation

@PeterCalifano

@PeterCalifano PeterCalifano commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Harden ownership boundaries across configuration, wrapper generation, source packaging, and container workflows. Wrapper configuration is non-mutating by default, Python packages are assembled entirely in build-owned trees, and CPack refreshes source-tree ownership at package time. The same batch adds portable TensorRT discovery and host-owned Docker/Podman development flows.

This is the main-branch hardening prerequisite for the v2 test-ownership migration; it does not move template conformance into TestField itself.

Main Changes

  • Make project-qualified metadata, CUDA, and OptiX options canonical for nested consumers, retain one-config top-level aliases, and align the ROS 2 facade.
  • Make wrapper checkout updates and declared-submodule initialization explicit; reconstruct Python packages under the build tree, preserve exact runtime staging, and project resolved SemVer into PEP 440 wheel metadata.
  • Stage the generated VERSION in CPack output, refresh cache-proven build-tree exclusions when packaging begins, and deliver an optional portable FindTensorRT.cmake to build-tree and installed consumers.
  • Preserve host file ownership in Docker and rootless Podman, add stable VS Code attachment and read-only MATLAB mounts, and retain the MATLAB library manager as an isolated, dry-run-first user utility.

Testing / Validation

  • Final CPU and real Python-wrapper CTest suites passed: 32/32 and 33/33.
  • SemVer prerelease projection passed alpha, beta, release-candidate, development, and arbitrary-label coverage; a real feature.x wheel carried 1.0.0.dev0+feature.x.5.gabc1234 metadata.
  • MATLAB, CUDA, OptiX, and ROS 2 matrices passed: 41/41, 35/35, 36/36, and 10/10 for both CPU and CUDA/OptiX ROS overlays.
  • The final wheel contained exactly __init__.py, libtemplate_project.so, and template_project.so; wheel and CMake-prefix installs imported with an empty LD_LIBRARY_PATH, and native RUNPATHs remained loader-relative.
  • Portable TensorRT discovery passed fake aarch64 source/build/install consumers and real TensorRT 10.7 source/install consumers.
  • Container contracts passed 4/4 fake-engine tests plus live Docker and rootless Podman ownership and VS Code attachment checks. MATLAB utility fixtures passed 7/7; the real R2024b run was dry-run only and left its links unchanged.
  • Doxygen, Bash syntax, ShellCheck, Python byte compilation, JSON/JSONC, YAML, ROS XML, whitespace, conflict-marker, and CMake 3.15 API-floor checks passed.
  • Remote CUDA remains gated by the repository's unset CI_USE_SELF_HOSTED variable; local validation used CUDA 12.9, sm_120, and OptiX 9.0.

Notes For Reviewers

  • cmake/HandleWrapper.cmake is smaller and now owns only common resolution and explicitly granted maintenance; ordinary configure/build operations do not move the wrapper checkout or change gitlinks.
  • cmake/HandlePythonWrapper.cmake reconstructs a disposable package from stable source inputs. _wrapper_build.py, caches, and stale native artifacts are excluded from wheels and CMake installs.
  • cmake/RefreshCPackSourceIgnores.cmake.in intentionally excludes only the active binary tree and caches owned by this exact checkout. Foreign caches and legitimate build-prefixed source directories remain package input.
  • FindTensorRT.cmake is delivered as an optional consumer module and does not enable TensorRT in the base template.
  • scripts/use_system_matlab_libraries.sh and its standalone test are not wired into CMake, CTest, wrappers, containers, ROS, tailoring, or TestField. No real
    --apply or --restore operation was performed.

- Keep wrapper maintenance explicit and assemble Python packages entirely in build-owned trees.

- Namespace nested feature options, deliver portable TensorRT discovery, and stage authoritative version and source-package metadata.

- Preserve host ownership for Docker and Podman while adding VS Code and MATLAB container support plus isolated MATLAB library tooling.

- Cover cleanup, packaging, containers, nested options, TensorRT, ROS facades, and late CPack builds with focused regressions and documentation.
@PeterCalifano PeterCalifano self-assigned this Aug 11, 2026
@PeterCalifano PeterCalifano added the enhancement New feature or request label Aug 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77106e61c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread build_lib.sh
Comment on lines 430 to +434
if [[ "$wrap_update" == true ]]; then
cmake_args+=( "-DGTWRAP_BRANCH=$wrap_branch" -DGTWRAP_SYNC_TO_MASTER=ON )
else
cmake_args+=( -DGTWRAP_SYNC_TO_MASTER=OFF )
cmake_args+=(
"-DGTWRAP_BRANCH=$wrap_branch"
-DGTWRAP_MAINTENANCE_UPDATE=ON
-DGTWRAP_SYNC_TO_MASTER=ON

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clear cached wrapper maintenance when updates are disabled

When a build directory has previously been configured with --wrap-update, a subsequent ordinary invocation or explicit --no-wrap-update appends neither cache variable as OFF, so the cached GTWRAP_MAINTENANCE_UPDATE=ON and GTWRAP_SYNC_TO_MASTER=ON remain active and CMake fetches/pulls the wrapper checkout again. This makes the advertised opt-in operation persist across later builds and can unexpectedly move a wrapper gitlink; explicitly disable or unset both values when wrap_update is false.

AGENTS.md reference: AGENTS.md:L55-L57

Useful? React with 👍 / 👎.

Comment thread python/pyproject.toml.in Outdated
[project]
name = "@PROJECT_NAME@"
version = "@PROJECT_VERSION@"
version = "@FULL_VERSION@"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Convert SemVer prereleases before writing Python metadata

When configuring from a supported SemVer tag with a prerelease identifier that is not recognized by PEP 440, such as v1.0.0-feature.x, HandleGitVersion.cmake produces FULL_VERSION=1.0.0-feature.x; placing it directly in pyproject.toml causes setuptools/packaging to reject the project version, so wheel and pip installation fail. Translate the resolved version to PEP 440 or validate it before generating Python metadata rather than assuming every accepted SemVer prerelease can be normalized.

Useful? React with 👍 / 👎.

- Derive PEP 440 package metadata from structured SemVer fields without changing release or CPack versions.

- Preserve arbitrary prerelease labels through development-release local metadata in checked-in and fallback templates.

- Cover canonical labels and real wheel metadata while documenting the version boundary.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41d341ab94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmake/FindTensorRT.cmake
Comment on lines +35 to +36
set(TENSORRT_ROOT "" CACHE PATH
"Compatibility TensorRT root directory hint.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the uppercase TensorRT normal-variable hint

When a consumer using the supported CMake 3.15-era policy behavior supplies the documented compatibility hint as a normal variable (set(TENSORRT_ROOT "/sdk")), this cache assignment removes that normal binding and replaces it with an empty value before _TensorRT_root_hints is built, so discovery fails unless the hint was passed with -D or via the environment. CMake's CMP0126 documentation explicitly states that its OLD behavior removes a same-named normal variable when no cache entry existed; avoid initializing this cache entry in a way that discards the caller's value.

Useful? React with 👍 / 👎.

Comment on lines +235 to +237
while IFS= read -r line_; do
if [[ "${line_}" == *"${lookup_name_} ("* &&
"${line_}" == *'x86-64'* && "${line_}" == *'=> '* ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Search the ldconfig cache by versioned OpenCV SONAME

When --opencv runs against a normal Linux OpenCV installation, discover_opencv_ passes an unversioned name such as libopencv_core.so, but ldconfig -p (whose help describes -p as printing the cache) ordinarily keys OpenCV entries by their versioned SONAME, such as libopencv_core.so.410. This exact "${lookup_name_} (" match therefore finds nothing and the helper exits with “Host library not found”; the test currently hides the failure by fabricating unrealistic unversioned OpenCV cache keys.

Useful? React with 👍 / 👎.

@PeterCalifano
PeterCalifano merged commit 403c223 into main Aug 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant