Skip to content

Add deterministic coverage for concurrent index_router cache insertion #847

Description

@coderabbitai

Summary

Codecov coverage for phlex/core/index_router.cpp Line 366 is nondeterministic. The affected code is the if (not inserted) return path in multilayer_slots_for.

Concurrent calls can make inserted either true or false. This produces small, unrelated coverage changes in pull requests.

Required change

Add a focused multithreaded test that deterministically exercises the contended-insert path. Use synchronization, such as a barrier, so multiple threads call multilayer_slots_for with the same layer_hash at the same time.

Do not change the cursor or GSL work in the current pull request for this task.

Rationale

The branch is valid, but its coverage depends on thread scheduling. A deterministic test will reduce Codecov noise and verify the concurrent cache behavior.

Affected area

  • phlex/core/index_router.cpp
  • Tests for multilayer_slots_for and concurrent index-router behavior

Acceptance criteria

  • The test forces one or more callers through the not inserted branch.
  • The test is stable across repeated runs.
  • Coverage consistently includes the return path at phlex/core/index_router.cpp Line 366.
  • The test verifies that concurrent callers receive consistent slot and end-token-entry results.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions