Skip to content

fix(service-registry): make the convenience registerService honor its documented assertion - #169

Merged
facontidavide merged 1 commit into
mainfrom
fix/register-service-assert
Aug 8, 2026
Merged

fix(service-registry): make the convenience registerService honor its documented assertion#169
facontidavide merged 1 commit into
mainfrom
fix/register-service-assert

Conversation

@facontidavide

Copy link
Copy Markdown
Contributor

Summary

  • ServiceRegistryBuilder::registerService (both convenience overloads) documented "Asserts in debug builds" while the body did (void)status — no assertion existed in any configuration
  • A rejection now trips PJ_ASSERT with a clear message; the doc-comments state the exact NDEBUG behavior (status silently dropped) and direct callers that must report failures to tryRegisterService
  • Adds service_registry_builder_test — the first regression coverage for the builder's registration rules (first-registration success, duplicate-keeps-first, null ctx/vtable rejection, and the assert behavior via PJ_ASSERT_THROWS, which keeps the invariant observable under RelWithDebInfo where assert() compiles away)
  • Additions-only: no signature, struct, vtable, or ABI change; CHANGELOG entry under the unreleased 0.21.0 line

Companion

PlotJuggler/PJ4#546 switches every PJ4 host call site to a status-checked path with visible diagnostics — that PR delivers production visibility and is independent of this one (it uses the existing tryRegisterService); this PR closes the doc/code mismatch and guards debug/CI builds.

Validated in the PJ4 superbuild at the pinned submodule (330/330 tests, 6/6 in the new target); the diff was transplanted onto current main with a 3-way apply (clean) — CI here validates it against HEAD.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BqLATym6kKna4SHhjYXnkh

… documented assertion

The non-returning overloads claimed "Asserts in debug builds" but
discarded the tryRegisterService status in every configuration, so a
duplicate or null registration silently altered the service surface a
plugin sees. A rejection now trips PJ_ASSERT, the doc-comments state
the exact NDEBUG behavior, and the builder's registration rules gain
their first regression tests (built with PJ_ASSERT_THROWS so the
invariant is observable under RelWithDebInfo).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqLATym6kKna4SHhjYXnkh
@facontidavide
facontidavide merged commit ed36987 into main Aug 8, 2026
4 checks passed
@facontidavide
facontidavide deleted the fix/register-service-assert branch August 8, 2026 13:46
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