Skip to content

tests(bridge): cover assignHandlerPrimary's never-attached-binding guard - #106

Merged
Yaraslaut merged 3 commits into
masterfrom
investigate/bridge-remote-gaps
Aug 16, 2026
Merged

tests(bridge): cover assignHandlerPrimary's never-attached-binding guard#106
Yaraslaut merged 3 commits into
masterfrom
investigate/bridge-remote-gaps

Conversation

@Yaraslaut

Copy link
Copy Markdown
Member

Investigated bridge.hpp's remaining flagged gaps (4 misses, 19
partials). Most turned out already resolved by prior merges
(releaseScopedLocked's race-retry release, the execute-ticket-gate
"already gone" branches, and SimulatedRemoteBackend::listInstances'
decode-failure arm were all already covered/documented by earlier
rounds -- this PR's own scan of remote.hpp confirmed 3 of its 4
flagged lines are already handled, likely just stale Codecov data from
before those merges fully propagated).

Closed with a real test

assignHandlerPrimary's early-return guard (raw == 0U || primary.empty() || !binding->primary.empty()) -- every existing test
calls ensureBound() first, so currentId is always non-zero going
in. A handler that has never attached anything yet has no instance to
promote a key onto; this must return immediately with no
assignPrimaryAsync dispatch. That specific arm (raw == 0U) had
never been driven true.

Documented (genuinely untestable without disproportionate effort)

Two catch (...) blocks in attachHandlerAsync's success paths
(out-of-frame and in-frame) -- the only way in is a std::string
copy-assignment throwing std::bad_alloc from a real allocation
failure (currentId.store() on an atomic cannot throw). Forcing that
portably needs an OOM-injection allocator seam this codebase does not
have; disproportionate for two defensive catches.

Verification

Full morph_tests suite: 1045 test cases, 10037 assertions, all
passing (was 1044/10034 before this change).

@Yaraslaut Yaraslaut added the no docs update Skip the header<->spec sync gate for this PR label Aug 16, 2026
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Yaraslaut
Yaraslaut force-pushed the investigate/bridge-remote-gaps branch from f75ceff to 3116729 Compare August 16, 2026 07:06
Yaraslau Tamashevich and others added 3 commits August 16, 2026 10:52
Every existing assignHandlerPrimary test calls ensureBound() first, so
currentId is always non-zero going in -- the "raw == 0U" arm of the
early-return guard (raw == 0U || primary.empty() ||
!binding->primary.empty()) was never driven true. A handler that has
never attached anything yet has no instance to promote a key onto, so
this must return immediately with no assignPrimaryAsync dispatch.

Also documents 2 catch(...) blocks (attachHandlerAsync's out-of-frame
and in-frame success paths) as genuinely untestable without an
OOM-injection allocator seam: the only way in is a std::string
copy-assignment throwing std::bad_alloc (currentId.store() on an
atomic cannot throw), and forcing that portably is disproportionate
for two defensive catches.
…es need

Per feedback: prefer a trackable issue over a comment alone for
gaps that genuinely need a library addition to close, matching the
existing morph#95/#96/#97 pattern already used elsewhere in this
codebase.
The two catch (...) blocks in attachHandlerAsync's out-of-frame and
in-frame success paths no longer carry an inline comment explaining
they're OOM-only and untested -- morph#108 already tracks exactly
this (the allocator seam needed to test them), so the explanation
lives there instead of duplicated at each call site.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Yaraslaut
Yaraslaut force-pushed the investigate/bridge-remote-gaps branch from 1022585 to b2ebbb7 Compare August 16, 2026 07:52
@Yaraslaut
Yaraslaut merged commit 1556377 into master Aug 16, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no docs update Skip the header<->spec sync gate for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant