ND-007: npm run bench:ilike silently runs FTS mode — arg parser ignores --mode ilike (space form) #57

Closed
opened 2026-08-09 18:55:57 +00:00 by Mark · 1 comment
Owner

Summary

The benchmark arg parser in bench/search/benchmark.ts only accepts --mode=ilike, --ilike, or the env var SEARCH_MODE=ilike. The documented/scripted invocation form --mode ilike (space-separated — used in the script header line 14 AND in package.json bench:ilike) is silently ignored, so the run falls through to the default FTS mode. Result: npm run bench:ilike writes FTS numbers into bench/results/ilike-results.md, corrupting the ILIKE benchmark record.

Found by post-deploy probe of issue #11 (ND-007). Kanban card: t_edd9a649.

Reproduction

  1. From a checkout of Mark/nodedesk at main:
    npm run bench:ilike
    # or, equivalently:
    npx tsx bench/search/benchmark.ts --mode ilike
    
  2. Observe which results file is written.

Reproduced: the --mode ilike (space form) run wrote bench/results/fts-results.md — i.e. it executed the FTS path. Switching to the env-var toggle (SEARCH_MODE=ilike) produced genuine ILIKE results.

Actual behavior

npm run bench:ilike silently runs the FTS benchmark and overwrites/creates bench/results/ilike-results.md with FTS numbers, corrupting the benchmark record and any comparison docs derived from it.

Expected behavior

npm run bench:ilike (and --mode ilike) runs the ILIKE benchmark and writes genuine ILIKE numbers. An unsupported/ambiguous mode argument should error out loudly rather than silently falling back to FTS.

Root cause

Arg parser in bench/search/benchmark.ts only matches --mode=ilike, --ilike, or env SEARCH_MODE=ilike; the space-separated --mode ilike form (used by package.json bench:ilike and the script header docs) is not recognized and the code defaults to FTS mode instead of failing.

## Summary The benchmark arg parser in `bench/search/benchmark.ts` only accepts `--mode=ilike`, `--ilike`, or the env var `SEARCH_MODE=ilike`. The documented/scripted invocation form `--mode ilike` (space-separated — used in the script header line 14 AND in package.json `bench:ilike`) is silently ignored, so the run falls through to the default FTS mode. Result: `npm run bench:ilike` writes FTS numbers into `bench/results/ilike-results.md`, corrupting the ILIKE benchmark record. Found by post-deploy probe of issue #11 (ND-007). Kanban card: `t_edd9a649`. ## Reproduction 1. From a checkout of `Mark/nodedesk` at `main`: ```bash npm run bench:ilike # or, equivalently: npx tsx bench/search/benchmark.ts --mode ilike ``` 2. Observe which results file is written. Reproduced: the `--mode ilike` (space form) run wrote `bench/results/fts-results.md` — i.e. it executed the FTS path. Switching to the env-var toggle (`SEARCH_MODE=ilike`) produced genuine ILIKE results. ## Actual behavior `npm run bench:ilike` silently runs the FTS benchmark and overwrites/creates `bench/results/ilike-results.md` with FTS numbers, corrupting the benchmark record and any comparison docs derived from it. ## Expected behavior `npm run bench:ilike` (and `--mode ilike`) runs the ILIKE benchmark and writes genuine ILIKE numbers. An unsupported/ambiguous mode argument should error out loudly rather than silently falling back to FTS. ## Root cause Arg parser in `bench/search/benchmark.ts` only matches `--mode=ilike`, `--ilike`, or env `SEARCH_MODE=ilike`; the space-separated `--mode ilike` form (used by package.json `bench:ilike` and the script header docs) is not recognized and the code defaults to FTS mode instead of failing.
Author
Owner

Fixed by commit d1b9a07 (pushed to main 2026-08-10). The arg parser now accepts the space form --mode ilike (used by package.json bench:ilike and the script header), plus the existing --mode=ilike / --ilike / --fts and SEARCH_MODE env. Unsupported modes (--mode bogus) and missing values (bare --mode) now exit code 2 with a loud error instead of silently falling back to FTS. Verified: --mode bogus errors, --mode ilike passes the parser. Also landed b2b68ab — a pure Prettier reformat of benchmark.ts so the pre-commit format gate stops failing on that file. Typecheck/lint/132 unit tests green on final tree.

Fixed by commit d1b9a07 (pushed to main 2026-08-10). The arg parser now accepts the space form `--mode ilike` (used by package.json `bench:ilike` and the script header), plus the existing `--mode=ilike` / `--ilike` / `--fts` and SEARCH_MODE env. Unsupported modes (`--mode bogus`) and missing values (bare `--mode`) now exit code 2 with a loud error instead of silently falling back to FTS. Verified: `--mode bogus` errors, `--mode ilike` passes the parser. Also landed b2b68ab — a pure Prettier reformat of benchmark.ts so the pre-commit format gate stops failing on that file. Typecheck/lint/132 unit tests green on final tree.
Mark closed this issue 2026-08-13 23:58:52 +00:00
Sign in to join this conversation.
No description provided.