Skip to content

test(epoch-manager): seed ChunkProducers in test harnesses + missing-row invariant#15944

Open
stedfn wants to merge 2 commits into
masterfrom
stedfn/epoch-manager/seed-chunk-producers-tests
Open

test(epoch-manager): seed ChunkProducers in test harnesses + missing-row invariant#15944
stedfn wants to merge 2 commits into
masterfrom
stedfn/epoch-manager/seed-chunk-producers-tests

Conversation

@stedfn

@stedfn stedfn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #15908 (now merged to master); rebased onto master. Raises test fidelity for the EarlyKickout DB-anchored chunk-producer path before PR6 (#15843) makes DB[anchor] != sample.

  • Add test-only EpochManager::seed_chunk_producers_for_test, mirroring production's save_chunk_producers_for_header, and seed DBCol::ChunkProducers at the nightly test recording sites (epoch-manager helpers, shard_tracker, tests/mod.rs, runtime/tests.rs, garbage_collection) so the aggregator exercises the real DB-read path instead of always hitting the sampler fallback.
  • Gate the seed helper's EarlyKickout check on the anchor's own epoch (get_epoch_info(block_info.epoch_id())), matching production. The epoch-after gate over-seeds dead rows for last-of-epoch anchors across an activation edge; those rows are never read by the aggregator/witness cross-epoch arm.
  • In anchored_chunk_producers_for_aggregator, split the miss branch: debug_assert that a missing same-epoch row only happens for the epoch-sync-installed first block, and debug_assert!(false) for the unreachable account-not-in-epoch case.
  • Fix the miss-branch fallback to sample at anchor.height + CHUNK_GRANDPARENT_ANCHOR_HEIGHT_OFFSET (the producer the writer would have stored) instead of the chunk height; identical for consecutive heights, exact under skips.
  • Tests: test_aggregator_missing_epoch_first_block_row_falls_back, test_aggregator_skip_anchor_uses_anchor_height. Full near-epoch-manager nightly suite 106/0.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.59%. Comparing base (715e0f9) to head (a839b7a).

Files with missing lines Patch % Lines
chain/epoch-manager/src/lib.rs 78.84% 10 Missing and 1 partial ⚠️
chain/chain/src/runtime/tests.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15944      +/-   ##
==========================================
- Coverage   72.60%   72.59%   -0.01%     
==========================================
  Files         952      952              
  Lines      205109   205163      +54     
  Branches   205109   205163      +54     
==========================================
+ Hits       148914   148939      +25     
- Misses      51218    51243      +25     
- Partials     4977     4981       +4     
Flag Coverage Δ
pytests-nightly 1.10% <0.00%> (-0.01%) ⬇️
unittests 69.53% <91.66%> (-0.02%) ⬇️
unittests-nightly 69.54% <79.31%> (+<0.01%) ⬆️
unittests-spice 66.96% <79.31%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from stedfn/witness-v2-prev-prev-anchor-v2 to master June 24, 2026 08:12
stedfn and others added 2 commits June 25, 2026 14:42
…row invariant

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
seed_chunk_producers_for_test gated EarlyKickout on the epoch after the
anchor; production save_chunk_producers_for_header gates on the anchor's
own epoch (get_epoch_protocol_version(header.epoch_id())). The epoch-after
gate over-seeds dead rows for last-of-epoch anchors across an EarlyKickout
activation edge (reachable via test_protocol_version_switch); those rows
are never read by the aggregator/witness cross-epoch arm.

Gate on the anchor's own epoch instead; sampling still uses the epoch
after the anchor. Full near-epoch-manager nightly suite 106/0; near-chain
runtime::tests + garbage_collection 55/0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stedfn stedfn force-pushed the stedfn/epoch-manager/seed-chunk-producers-tests branch from 0022d8a to a839b7a Compare June 25, 2026 13:08
@stedfn stedfn requested a review from Trisfald June 25, 2026 14:11
@stedfn stedfn marked this pull request as ready for review June 25, 2026 14:11
@stedfn stedfn requested a review from a team as a code owner June 25, 2026 14:11
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