Skip to content

Fix: depth first visit problem#15

Merged
yhirose merged 2 commits into
yhirose:masterfrom
MouJieQin:fix-upstream
Jun 9, 2026
Merged

Fix: depth first visit problem#15
yhirose merged 2 commits into
yhirose:masterfrom
MouJieQin:fix-upstream

Conversation

@MouJieQin

Copy link
Copy Markdown
Contributor

Thanks for your code, it helps me a lot. It seems there is a problem in depth first visit logic.

The original fuzzy test:

time ../fst fuzzy words.fst ani
Aani: 6
ai: 4318
an: 7442
ani: 8644
anil: 8660
anis: 8745
../fst fuzzy words.fst ani  0.03s user 0.01s system 79% cpu 0.051 total

The fuzzy test after my fix:

time ./cmd/fst fuzzy words.fst ani

Aani: 6
Dani: 48553
Pani: 138204
ai: 4318
an: 7442
ani: 8644
anil: 8660
anis: 8745
anti: 9807
arni: 13398
bani: 18312
mani: 111111
ni: 124291
rani: 163242
./cmd/fst fuzzy words.fst ani  0.03s user 0.01s system 74% cpu 0.049 total

@yhirose
yhirose merged commit 7f3f96e into yhirose:master Jun 9, 2026
0 of 3 checks passed
@yhirose

yhirose commented Jun 9, 2026

Copy link
Copy Markdown
Owner

@MouJieQin yes, that's a serious bug... Thank you for fixing it!

yhirose added a commit that referenced this pull request Jun 9, 2026
- EditDistanceTest.Visits_sibling_arc_after_dead_end: covers the depth-first
  visit early-break bug fixed in #15; minimal repro is {"rangy","rani"} with
  query "ani" at max_edits=1, where the buggy code returned 0 results.
- MapTest.Large_output_value_round_trip: covers the vb_decode_value_reverse
  cast bug fixed in #15; an output value >2^28 was corrupted without the
  static_cast to the target type before shifting.
- hardened CI job: adds a Debug build with -D_GLIBCXX_ASSERTIONS and
  -D_LIBCPP_HARDENING_MODE=DEBUG on ubuntu and macos. This turns the
  string_view out-of-bounds reads in cost_insert/cost_delete/common_string
  (fixed in #16) into hard test failures; they silently pass in Release builds
  and even under ASan/UBSan.
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