Skip to content

Make concurrent type metadata retirement stack-bounded - #7

Merged
sean-parent merged 2 commits into
mainfrom
fix/metadata-retirement
Nov 16, 2026
Merged

sean-parent merged 2 commits into
mainfrom
fix/metadata-retirement

Conversation

@sean-parent

@sean-parent sean-parent commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replace metadata teardown based on shared_ptr::use_count() snapshots with the existing atomic last-owner retirement queue.
  • Detach every field, element, and result edge before deleting a plan. Copy immutable metadata into fresh ownership nodes and preserve source-preserving descriptor moves.
  • Add queued-lifetime and concurrent last-owner regressions, retaining the existing depth-50,000 destruction and unwinding coverage. Thread linkage is test-only.

Compatibility: Public source signatures are unchanged, but the private descriptor layout changes. Rebuild clients.

Test plan

Fresh local validation on macOS arm64 with AppleClang 21 and C++20. Configure commands used the existing CPM source cache through -DCPM_SOURCE_CACHE; the presets were otherwise unchanged.

  • cmake --preset test, cmake --build --preset test, ctest --preset test --no-tests=error: 20/20 passed, including source and installed consumers.
  • cmake --preset clang-tidy, cmake --build --preset clang-tidy, ctest --preset clang-tidy --no-tests=error: full configured static analysis and 20/20 tests passed.
  • cmake --preset default, cmake --build --preset default, cmake --install build/default --prefix <temporary-prefix>, cmake -DPACKAGE_TEST_PREFIX=<temporary-prefix> -P build/default/cpp-library-test-package.cmake: release build, installation, and artifact checks passed.
  • cmake --preset docs, cmake --build --preset docs: documentation passed.
  • Configured build/sanitized with -fsanitize=address,undefined -fno-omit-frame-pointer and matching linker flags; cmake --build build/sanitized and ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 ctest --test-dir build/sanitized --output-on-failure --no-tests=error: 20/20 passed.
  • clang-format --dry-run --Werror on all five changed C++ files and git diff --check: passed.
  • Controlled mutation during implementation: omitting actual metadata element-edge detachment made the deep-release regression crash with recursive destructor frames. Restored detachment and reran successfully.
  • Hosted CI at 8d7dfc0: Ubuntu GCC, Ubuntu Clang, macOS, Windows, and clang-tidy each passed all 20 tests. All four platform jobs also passed release installation and package checks.

The concurrency tests exercise real ownership and exact-once disposal without sleeps or timing assertions. They do not deterministically reproduce the historical scheduling-dependent race. No ThreadSanitizer or macOS LeakSanitizer coverage is claimed. Pages deployment is release-only and is not part of this PR.

Generated with GitHub Copilot CLI

sean-parent and others added 2 commits November 16, 2026 11:45
Replace snapshot-based shared-pointer teardown with the existing intrusive retirement mechanism. Detach all descriptor edges into the last-owner queue before deleting a plan, while preserving immutable sharing and source-preserving descriptor moves.

Add deferred-disposal and concurrent ownership regressions, retaining deep destruction and unwinding coverage. Clients must rebuild because the private descriptor layout changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Suppress the Ubuntu analyzer's unhandled-self-assignment false positive on the existing copy-and-swap implementation. The temporary retains the source before swapping and releasing prior ownership; the ownership algorithm is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@sean-parent sean-parent left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Talos review

Verdict: No accepted findings.

Reviewed commit: 8d7dfc0a6442e7c1ca67a0960d896d5510978549, full PR diff against main (merge-base cacd8cf6c43831470769ba2917088ac21ce14c77). The review was rerun for this final pushed snapshot after the CI lint annotation.

Files Reviewers Candidates -> validated -> accepted Shown Tests
6 of 6; none skipped 6 personas plus challenge 0 -> 0 -> 0 0 of 0 Local normal, clang-tidy, and ASan/UBSan suites: 20/20 each; hosted CI: 20/20 in all five test jobs

Personas completed: security, correctness, standards, architecture, devops, and documentation. Challenge accepted 0 and rejected 0. Accepted findings: 0; inline comments posted: 0; overflow: 0; unanchored findings: 0; duplicate/recurring findings: 0. Existing reviews/comments were checked before publication. This is a comment review, not an approval.

Verification

Fresh configure/build/test validation also passed release installation, generated package artifact checks, strict documentation, clang-format, and whitespace checks. CI run 43943911436 completed successfully at the reviewed SHA: Ubuntu GCC, Ubuntu Clang, macOS, Windows, and clang-tidy. Logs confirm each test job ran all 20 tests; all four platform jobs checked installed package artifacts. Release-only Pages deployment was skipped as expected; documentation was built locally.

The initial Ubuntu clang-tidy diagnostic on the existing self-copy-safe copy-and-swap implementation was addressed with a narrowly scoped, justified annotation in 8d7dfc0; the ownership algorithm is unchanged, and the final Ubuntu clang-tidy job passed.

No ThreadSanitizer or macOS LeakSanitizer coverage is claimed. The historical scheduling-dependent race was not deterministically reproduced. Controlled mutation during implementation verified that omitting metadata element-edge detachment causes the deep-release regression to crash; restored code passes. The private descriptor layout changes, so clients must rebuild.

Persona routing: static roster (DCAP routing off; rerun with --dcap to enable).

Org knowledge: off (rerun with --knowledge).

Scout

Used: risk CRITICAL, evidence LOW, status INCOMPLETE (scout 0.9.135, <1s).
Cross-file leads given to reviewers: 3 changed symbol(s) with uses outside the diff, 0 new value(s) not handled everywhere, 0 possibly unused symbol(s).
Scout rated its evidence LOW for this change; reviewers used it only as leads.
Scout evidence is incomplete (status INCOMPLETE; change analysis bounded; rows cut by the packet budget); reviewers treated missing evidence as unknown, not as proof.

Tests to run (Scout: 19 Must Run test(s)):
Scout also lists 4 Should Run test(s).
Scout left 23 affected-test entries out of its packet; for the full list run scout affected-tests -r '/Users/sean-parent/repos/github.com/stlab/cel-runtime/.claude/worktrees/metadata-retirement' -s compare -b origin/main.

@sean-parent
sean-parent merged commit a8e753b into main Nov 16, 2026
6 checks passed
@sean-parent
sean-parent deleted the fix/metadata-retirement branch November 16, 2026 20:06
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.

1 participant