Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,6 @@ jobs:
- name: Test
run: ctest --preset=test

- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix "${{ runner.temp }}/install"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
if: ${{ matrix.cc }}

- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix "${{ runner.temp }}/install"
if: ${{ !matrix.cc }}

- name: Check installed package artifacts
run: |
cmake "-DPACKAGE_TEST_PREFIX=${{ runner.temp }}/install" -P build/default/cpp-library-test-package.cmake

clang-tidy:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .scout/memory/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
- [[knowledge/detect-metadata-last-ownership-atomically-and-detach-every-child-before-deletion.md|Detect metadata last ownership atomically and detach every child before deletion]] (decision, 1.00) `ownership` `retirement` `concurrency` `metadata`
- [[knowledge/keep-scout-knowledge-filenames-discoverable.md|Keep Scout knowledge filenames discoverable]] (discovery, 0.80) `scout` `memory` `search` `file-classification` `filenames`
- [[knowledge/let-cpp-library-own-documentation-generation.md|Let cpp-library own documentation generation]] (observation, 0.80) `cmake` `cpp-library` `cpp-library-setup` `documentation` `docs-target` `post-build`
- [[knowledge/portable-private-cpp-thread-linkage.md|Keep resource_test thread linkage portable and private]] (observation, 0.80) `cmake` `resource-test` `threads` `threads-threads` `std-jthread` `std-latch` `pthread`
- [[knowledge/portable-private-cpp-thread-linkage.md|Use cpp-library default portable thread linkage]] (observation, 0.80) `cmake` `resource-test` `threads` `threads-threads` `std-jthread` `std-latch` `pthread`
- [[knowledge/preflight-deferred-callable-ownership-before-copying-represented-bytes-while-preserving-empty-arrays.md|Preflight deferred callable ownership before copying represented bytes while preserving empty arrays]] (decision, 1.00) `cloning` `deferred-callables` `arrays` `exception-safety`
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ access_count: 1
sources:
- "include/cel/runtime/detail/retirement.hpp:14-80"
- "src/value_type.cpp:28-33"
- "src/value_type.cpp:67-84"
- "tests/resource_test.cpp:71"
- "tests/resource_test.cpp:144"
- "src/value_type.cpp:68-81"
- "src/value_type.cpp:577"
- "src/value_type.cpp:609"
- "tests/resource_test.cpp:52"
tags: ["ownership", "retirement", "concurrency", "metadata"]
tier: knowledge
source: written
Expand All @@ -23,4 +24,4 @@ Preserve allocation-free, constant-stack metadata destruction under concurrent r

Every concrete disposal callback must detach ALL runtime-owned child edges into the supplied queue before deleting its node. For `type_plan`, this includes field/parameter descriptors, the optional array/range element, and the optional callable result. Leaving even one child to ordinary recursive member destruction defeats the stack bound. Reuse dying nodes' embedded links rather than allocating traversal storage. These ownership operations do not synchronize mutable client callbacks.

Regression evidence is in `tests/resource_test.cpp`: concurrent last-owner disposal counts and callback depth, deferred queue draining, and concurrent root/interior-alias releases preserving shared descendants. Scheduling stress alone is not a deterministic proof of the historical race; preserve the atomic-selection and complete-detachment invariants as well as the tests.
Regression evidence for concurrent last-owner disposal counts and callback depth is in `src/value_type.cpp:577`; deferred queue draining is in `src/value_type.cpp:609`. These guarded in-source cases run in `runtime_in_source_tests`. Concurrent root/interior-alias releases preserving shared descendants remain in `tests/resource_test.cpp:52`, run by `resource_test`. Configure with `cmake --preset test` before building if needed, build with `cmake --build --preset test --target runtime_in_source_tests resource_test`, then run `ctest --preset test -R '^(runtime_in_source_tests|resource_test)$'`. Scheduling stress alone is not a deterministic proof of the historical race; preserve the atomic-selection and complete-detachment invariants as well as the tests.
25 changes: 19 additions & 6 deletions .scout/memory/knowledge/portable-private-cpp-thread-linkage.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
title: "Keep resource_test thread linkage portable and private"
title: "Use cpp-library default portable thread linkage"
entity_type: observation
confidence: 0.80
created: 2026-11-19T22:24:03Z
last_accessed: 2026-11-19T22:24:03Z
last_reinforced: 2026-11-19T22:24:03Z
access_count: 1
sources:
- "CMakeLists.txt:31-38"
- "tests/resource_test.cpp:23-36"
- "CMakeLists.txt:6-7"
- "CMakeLists.txt:18-29"
- "docs/runtime-milestone.md:78-88"
tags: ["cmake", "resource-test", "threads", "threads-threads", "std-jthread", "std-latch", "pthread"]
tier: knowledge
source: inferred
Expand All @@ -17,8 +18,20 @@ relationships:
target: "Keep Scout knowledge filenames discoverable"
---

# Keep resource_test thread linkage portable and private
# Use cpp-library default portable thread linkage

Within PROJECT_IS_TOP_LEVEL AND BUILD_TESTING, CMakeLists.txt:31-38 finds Threads and links resource_test PRIVATE to Threads::Threads. The run_concurrently helper in tests/resource_test.cpp:23-36 creates two std::jthread workers behind a std::latch start gate.
The cpp-library 6.2.0 setup enables portable thread support by default.
`CMakeLists.txt` pins that release and calls `cpp_library_setup()` without
opting out. Its setup finds Threads and links the compiled runtime publicly
to `Threads::Threads`; generated test implementations and runners inherit
the requirement. Do not restore the former resource_test-only manual link.

Preserve portable, target-scoped thread linkage while this test uses these facilities. Standard C++ thread APIs do not remove platform compiler/linker requirements such as -pthread; CMake's FindThreads imported target encapsulates those requirements, even when it expands to no additional flags on macOS or another platform. A successful build on such a platform is not evidence that the dependency is redundant. Keep this a private test requirement, not a public dependency for every consumer. Future cpp-library centralization is compatible with this lesson if it supplies the same portable target-scoped requirement.
The metadata and retirement concurrency tests use two `std::jthread` workers
behind a `std::latch` start gate. Public metadata coverage remains in
`tests/resource_test.cpp`; private retirement coverage lives in guarded
in-source tests in `src/value_type.cpp`.

Standard C++ thread APIs do not remove platform compiler/linker requirements
such as `-pthread`. CMake's imported target encapsulates those requirements,
even when it adds no flags on macOS. A passing build on such a platform does
not establish that the dependency is redundant.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ last_accessed: 2026-11-19T22:26:06Z
last_reinforced: 2026-11-19T22:26:06Z
access_count: 1
sources:
- "src/value_ops.hpp:54-73"
- "src/value.cpp:182-246"
- "tests/value_test.cpp:723"
- "tests/value_test.cpp:798"
- "src/value_ops.hpp:54-70"
- "src/value.cpp:183-282"
- "src/value.cpp:936"
- "src/value.cpp:946"
- "src/value.cpp:978"
- "src/value.cpp:1000"
- "src/value.cpp:1021"
tags: ["cloning", "deferred-callables", "arrays", "exception-safety"]
tier: knowledge
source: written
Expand All @@ -22,4 +25,4 @@ When cloning raw canonical values, reject callable values lacking installed clon

Preflight fixed callable carriers before bulk copying fixed payload bytes. At each nonempty array boundary, use the REQUESTED element descriptor to check direct callable ownership before copying any packed element bytes; do not substitute the source array owner's installed descriptor, which could bypass the requested type's rejection. Recurse through array structure iteratively as needed. Empty arrays do not require ownership operations for an element value that does not exist.

On failure, release every initialized sibling/prefix and leave the destination uninitialized. Preserve the before-read, nested-array, partial-cleanup, and empty/nested-empty cases in `tests/value_test.cpp`. Do not replace these behavioral checks with type-only rejection of every descriptor containing a deferred callable.
On failure, release every initialized sibling/prefix and leave the destination uninitialized. Preserve the fixed-aggregate before-read case in `src/value.cpp:936`, the packed-array before-read case at `:946`, nested-array rejection at `:978`, initialized-prefix cleanup at `:1000`, and empty/nested-empty arrays at `:1021`. These guarded in-source cases run in `runtime_in_source_tests`. Configure with `cmake --preset test`, build with `cmake --build --preset test --target runtime_in_source_tests`, then run `ctest --preset test -R '^runtime_in_source_tests$'`. Do not replace these behavioral checks with type-only rejection of every descriptor containing a deferred callable.
18 changes: 8 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.24)
include(cmake/CPM.cmake)

# Fetch cpp-library before project()
CPMAddPackage("gh:stlab/cpp-library@6.1.0")
CPMAddPackage("gh:stlab/cpp-library@6.2.0")
include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)

# Enable dependency tracking before project()
Expand All @@ -28,12 +28,10 @@ cpp_library_setup(
DOCS_OPTIONS "USE_MDFILE_AS_MAINPAGE = ${CMAKE_CURRENT_SOURCE_DIR}/README.md"
)

if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
foreach(test storage_test raw_execution_test value_test resource_test segment_test
callable_test executable_retirement_test composite_execution_test)
target_include_directories(${test} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
endforeach()

find_package(Threads REQUIRED)
target_link_libraries(resource_test PRIVATE Threads::Threads)
endif()
# Same-directory includes suffice; do not propagate private headers to standalone tests.
get_property(runtime_targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
foreach(runtime_target IN LISTS runtime_targets)
get_property(runtime_includes TARGET "${runtime_target}" PROPERTY INCLUDE_DIRECTORIES)
list(REMOVE_ITEM runtime_includes "${CMAKE_CURRENT_SOURCE_DIR}/src")
set_property(TARGET "${runtime_target}" PROPERTY INCLUDE_DIRECTORIES "${runtime_includes}")
endforeach()
6 changes: 6 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"binaryDir": "${sourceDir}/build/default",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTING": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Expand All @@ -22,6 +23,7 @@
"binaryDir": "${sourceDir}/build/test",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "OFF",
"CMAKE_BUILD_TYPE": "Debug",
"BUILD_TESTING": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Expand All @@ -36,6 +38,7 @@
"binaryDir": "${sourceDir}/build/docs",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTING": "OFF",
"BUILD_DOCS": "ON",
Expand All @@ -51,6 +54,7 @@
"binaryDir": "${sourceDir}/build/clang-tidy",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "OFF",
"CMAKE_BUILD_TYPE": "Debug",
"BUILD_TESTING": "ON",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Expand All @@ -66,6 +70,7 @@
"binaryDir": "${sourceDir}/build/init",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "OFF",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTING": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Expand All @@ -81,6 +86,7 @@
"binaryDir": "${sourceDir}/build/install",
"generator": "Ninja",
"cacheVariables": {
"CEL_INSTALL": "ON",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTING": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Expand Down
Loading
Loading