medlab / case

medlab

what got hurt, and what now fails loudly

↑ sublayer

2026-10-14 · fixed: yes

Shifting selected new cards leaves suspended cards unchanged

BehavioralIntegration Tests

now fails loudly A real-backend promotion test asserts that suspended and reviewed cards retain their scheduling fields.

What broke

An Anki integration selected only active, unseen cards for promotion. It passed those IDs to the official reposition API with shift_existing enabled. That option also changed the positions of suspended new cards outside the selection.

How it showed

A test created an active new card, a suspended new card, and a reviewed card. Promoting the active card changed the suspended card's due value from 80 to 81. The reviewed card retained its scheduling fields.

What was watching

Integration tests already checked incremental sync and preservation of review history. Those fixtures did not include a suspended new card. The additional fixture detected the side effect before collection writes were enabled for the learner.

Where it sits

The behavioral defect was a mismatch between the selected IDs and the operation's complete mutation set. Integration tests fired against the real backend. The review-history fixture covered reviewed cards, but provided no evidence about suspended cards of the new-card type.

What we did

Promotion now constructs the order from active, unseen cards only. Encountered cards come first, followed by the remaining eligible cards in their existing relative order. Repositioning uses shift_existing disabled.

What now fails loudly

The regression test snapshots scheduling fields for suspended and reviewed cards. It requires those snapshots to remain equal after promotion. The original implementation failed that equality assertion. A separate ordering test requires an encountered note to precede older unseen notes.