Skip to content

test(ant_pending): cover droppedFull and the explicit markObsolete* retire paths - #1054

Merged
cyber-pc merged 1 commit into
qubic:developfrom
parthod0x:test/ant-pending-coverage
Oct 27, 2026
Merged

cyber-pc merged 1 commit into
qubic:developfrom
parthod0x:test/ant-pending-coverage

Conversation

@parthod0x

Copy link
Copy Markdown
Contributor

What

Adds test coverage for two AntPendingSolutions paths that currently have none. Test-only — no production code is touched.

Why

AntPendingSolutions is how a node queues its computors' solutions for publication, and it had a live bug recently (#1024, fixed by #1025). Two real paths were still untested:

1. The capacity fail-safe (droppedFull). When the pool is full and findFreeEntry() can reclaim no slot, add() must return false and bump droppedFull rather than overwrite a live entry. Nothing in the suite filled the pool, so this was never exercised.

2. The explicit retirements (markObsoleteGateRejected / markObsoleteParentGone). The publisher retires entries through these. The existing tests only reach OBSOLETE implicitly via selection-time expiry, so the public retire methods, their stat counters (obsoleteGateRejected / obsoleteParentGone), and the "OBSOLETE is not a duplicate" revival branch in add() reached from an explicit retire were all untested. That revival branch is the exact logic next to the #1025 fix, so a regression there would silently strand a resubmitted solution.

Tests added

Built on the file's existing freshPool() / key() / ref() helpers:

  • FullPoolRefusesAndCounts — fills to CAPACITY, asserts the next add() is refused and droppedFull == 1.
  • ExplicitRetireIsCountedAndAllowsRevival — markObsoleteGateRejected is counted, stops selection, and a corrected resubmit on the same key revives the entry in place.
  • ParentGoneRetireIsCountedSeparately — markObsoleteParentGone increments its own counter, distinct from the gate-rejected and expiry counters.

Verification

Built and run on x86_64-pc-windows-msvc (v143 toolset, /std:c++20, matching the test project): all 14 TestAntColonyPending tests pass — the 11 existing ones plus these 3. No K12-collision construction is needed, so this deliberately avoids the known-hard-to-test slot-recompute edge from #1024.

@cyber-pc

Copy link
Copy Markdown
Contributor

@parthod0x LGTM, but you need change the target branch from main to develop.

…etire paths

AntPendingSolutions had no coverage for two real on-chain paths:

- The capacity fail-safe: when the pool is full and findFreeEntry() can reclaim
  nothing, add() must refuse and count droppedFull rather than overwrite a live
  entry.
- The explicit retirements the publisher uses, markObsoleteGateRejected and
  markObsoleteParentGone. The existing tests only reach OBSOLETE implicitly via
  selection-time expiry, so the public retire methods, their stat counters, and
  the "OBSOLETE is not a duplicate" revival branch in add() reached from an
  explicit retire were all untested.

Adds three tests built on the file's existing freshPool()/key()/ref() helpers:
FullPoolRefusesAndCounts, ExplicitRetireIsCountedAndAllowsRevival, and
ParentGoneRetireIsCountedSeparately. Test-only; no production code is touched.
@parthod0x
parthod0x force-pushed the test/ant-pending-coverage branch from d80c43d to fef7f53 Compare October 26, 2026 05:24
@parthod0x
parthod0x changed the base branch from main to develop October 26, 2026 05:24
@parthod0x

Copy link
Copy Markdown
Contributor Author

Done — retargeted to develop. I also rebased onto develop so it stays a single clean commit (just the test; no release commit in the diff). Thanks for the review!

@cyber-pc
cyber-pc merged commit fa76fe6 into qubic:develop Oct 27, 2026
2 checks passed
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.

2 participants