Phase 4 implementation has made significant progress. The bit vector positioning bug has been fixed, and 6 out of 10 acceptance tests now pass.
test_accepts_empty_to_empty ✓test_accepts_deletion ✓test_accepts_identical ✓test_accepts_empty_word ✓test_accepts_insertion ✓test_accepts_to_empty ✓test_accepts_substitution - "test" → "text" (1 substitution)test_accepts_multiple_edits - "test" → "best" (1 substitution)test_accepts_n1 - "test" → "text" with n=1test_accepts_longer_words - "algorithm" → "algorythm" (1 substitution)Bit Vector Position Bug (FIXED)
The major bug was in how I-type positions checked for matches. The code was using starts_with_one() which checked if the bit vector started with a 1, but this was wrong because:
Fix: Changed from bit_vector.starts_with_one() to bit_vector.is_match(offset + max_distance).
This fixed identical word matching and single edit operations (insertion, deletion).
Substitutions are NOT working.
All 4 failing tests involve substitutions:
The error transitions should handle substitutions correctly via the i+1#e+1 transition (which becomes I+offset#(errors+1) after I^ε conversion). This transition is present in the code.
The issue might be:
Add detailed debug tracing for "test" → "text" to see:
Check if the substitution position is being subsumed incorrectly
Verify the acceptance condition for states with errors > 0
Diagonal crossing integration is now available through UniversalState::transition_with_consumption(), which carries explicit length_diff metadata and performs conversion when the tracked difference crosses the configured distance bound.
The older transition() method remains a compatibility path and intentionally does not perform diagonal crossing because it cannot infer whether the query side, dictionary side, both sides, or neither side consumed a character.
Focused verification passed on 2026-06-19:
systemd-run --user --scope -p MemoryMax=4G -p MemorySwapMax=0 \
env CARGO_BUILD_JOBS=1 cargo test -j1 --lib transducer::universal::state::tests -- --test-threads=1
Result: 36/36 universal state tests passed, including length-difference updates and I/M conversion boundary tests.
src/transducer/universal/position.rs:
offset + max_distance indexsrc/transducer/universal/automaton.rs:
src/transducer/universal/state.rs:
length_diff tracking and consumption-aware diagonal crossingPHASE4_BIT_VECTOR_BUG.md: Detailed analysis of the bit vector positioning bug and fixCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |