Skip to content

OpenCode 2 fast read: 22 code changes that no test finds (tests ready) #52

Done

Description

@iceteaSA

Mutation testing (cargo-mutants 27.1.0) of the OpenCode 2 fast-read path at fa9caef found 22 code changes that no test finds. New tests find all 22.

Scope:

  • crates/astrocyte-module/src/opencode_v2_source.rs: the tail helpers (tail_seed_rows, verified_rowid, clear_tail, advance_tail, evicted_since, drain_fast, tail_runtime_changed, record_tail_runtime_in_tx) and the lines of drain_inner that the fast read runs.
  • crates/astrocyte-readers/src/sessions/opencode_v2.rs: read_tail, read_tail_snapshot, read_tail_top_page, message_id_at, read_recent_tail_ids, known_tail_anchors, front_was_pruned, anchor_moved, highest_row_through, first_row_at_or_after, rewind_tail and read_tail_pending.

Result for 193 mutants: 118 caught by an assertion that compares the value and 18 caught by a different failure. A total of 29 were not caught, and 28 do not compile. Of the 29, 22 have a missing test or a weak assertion (table). The other 7 do not change a fast record count, key or rowid position (list below the table).

In the table, "source" is opencode_v2_source.rs and "reader" is sessions/opencode_v2.rs. Line numbers are the same at fa9caef and at master b46c235.

Mutant Test that finds it
source 132:52 && to || v2_idle_fast_polls_keep_the_rewind_boundary
source 132:68 < to <= v2_idle_fast_polls_keep_the_rewind_boundary
source 142:9 return false v2_fast_coverage_stays_pending_when_only_an_evicted_call_is_open
source 143:75 >= to < v2_fast_coverage_stays_pending_when_only_an_evicted_call_is_open
source 542:17 && to || v2_fast_rewind_leaves_the_position_when_a_known_front_changes
source 620:21 && to || v2_sweep_at_shrink_time_does_not_clear_unknown_coverage
source 620:69 > to >= v2_sweep_at_shrink_time_does_not_clear_unknown_coverage
source 655:41 || to && v2_contiguous_fast_page_clears_coverage_until_it_catches_up
source 655:56 || to && v2_fast_coverage_stays_pending_when_only_an_evicted_call_is_open
source 756:29 > to >= v2_open_rows_at_capacity_do_not_block_fast_coverage_after_removal
source 758:35 - to / v2_fast_tail_leaves_both_evicted_calls_for_the_full_sweep
reader 569:13 || to && v2_full_sweep_does_not_treat_a_moved_front_as_pruned
reader 1242:5 return Ok(None) v2_stateless_tail_rereads_a_pending_call_at_the_start_boundary
reader 1242:5 return Ok(Some(Default::default())) v2_stateless_tail_rereads_a_pending_call_at_the_start_boundary
reader 1379:25 match guard to true v2_missing_boundary_with_higher_top_rewinds_to_the_first_row
reader 1476:26 && to || v2_idle_poll_does_not_accept_a_replaced_row_as_a_rewind_anchor
reader 1492:29 <= to > v2_stateless_tail_rereads_a_pending_call_at_the_start_boundary
reader 1498:66 <= to > v2_stateless_tail_rereads_a_pending_call_at_the_start_boundary
reader 1541:54 > to >= v2_tail_replay_returns_the_shared_page_boundary_once
reader 1638:30 < to <= v2_rewind_does_not_use_an_open_row_at_the_reused_slot_as_a_floor
reader 1639:55 < to == v2_rewind_uses_the_earliest_open_row_not_the_first_pending_key
reader 1639:55 < to > v2_rewind_uses_the_earliest_open_row_not_the_first_pending_key

These 7 changes do not change the fast output. They are source 425:13, 613:21, 624:13 and 627:13, and reader 1378:25, 1379:40 and 1639:55 (< to <=). Some of them can change a full-sweep value, the read cost or the raw tail_shrink_unverified flag. This issue does not include those values.

The tests: 14 tests, test-only, 461 added lines in opencode_v2_source.rs, one commit on master b46c235. Each test is satisfactory on master and gives a failure with its mutant (22 of 22 pairs). The workspace tests, clippy with -D warnings and scripts/fmt-check.sh are satisfactory. On a go, a pull request with the 14 tests follows.

AI helped write this draft.

Activity

  1. astro-alfonso commented on Dec 4, 2026

    @astro-alfonso
    Contributor

    Thank you. Yes, please open a pull request with the 14 tests, against current master. As with #51, we'll run the full suite on Linux, Windows and macOS before merging.

  2. astro-alfonso commented on Dec 5, 2026

    @astro-alfonso
    Contributor

    Merged in #53 (35a4cbe6), after the full test suite passed on Linux, Windows and macOS. Thank you for the tests. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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