tests(bridge): cover assignHandlerPrimary's never-attached-binding guard - #106
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Yaraslaut
force-pushed
the
investigate/bridge-remote-gaps
branch
from
August 16, 2026 07:06
f75ceff to
3116729
Compare
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.
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
force-pushed
the
investigate/bridge-remote-gaps
branch
from
August 16, 2026 07:52
1022585 to
b2ebbb7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 testcalls
ensureBound()first, socurrentIdis always non-zero goingin. A handler that has never attached anything yet has no instance to
promote a key onto; this must return immediately with no
assignPrimaryAsyncdispatch. That specific arm (raw == 0U) hadnever been driven true.
Documented (genuinely untestable without disproportionate effort)
Two
catch (...)blocks inattachHandlerAsync's success paths(out-of-frame and in-frame) -- the only way in is a
std::stringcopy-assignment throwing
std::bad_allocfrom a real allocationfailure (
currentId.store()on an atomic cannot throw). Forcing thatportably needs an OOM-injection allocator seam this codebase does not
have; disproportionate for two defensive catches.
Verification
Full
morph_testssuite: 1045 test cases, 10037 assertions, allpassing (was 1044/10034 before this change).