Skip to content

test: Index every table file, not a list of extensions - #35

Open
henrikottesorensen wants to merge 1 commit into
mainfrom
test/index-all-tables-for-findtable
Open

henrikottesorensen wants to merge 1 commit into
mainfrom
test/index-all-tables-for-findtable

Conversation

@henrikottesorensen

Copy link
Copy Markdown
Collaborator

The one root cause behind the 27

BrailleSpecTests.TableCache indexed tables/ through an extension allow-list:

.Where(f => Path.GetExtension(f) is ".ctb" or ".utb" or ".uti" or ".dis" or ".cti" or ".dic")

Upstream 3.39.0 ships 55 .tbl files, and .tbl is not on that list. So none of them reached
lou_indexTables — and a .tbl is precisely a metadata header (#+language:, #+grade:,
#+type:) plus include lines, i.e. exactly the file lou_findTable is meant to match on.

liblouis applies no filter of its own. indexTablePath() in metadata.c walks LOUIS_TABLEPATH
with listDir() and hands lou_indexTables every non-directory entry; lou_indexTables then
drops any file analyzeTable finds no metadata in. A filter in the harness could therefore only
ever be wrong in one direction — dropping tables upstream would have indexed. It was.

That single omission is the whole of the group the specs README described as "27 fail on table
resolution, and are probably one root cause rather than 27"
: 20 queries matched nothing, 7 settled
for a lower-scoring table from another language or code.

Measured

A C probe linked against the built osx-arm64 liblouis.dylib 3.39.0, indexing
LibLouis.NET.Tables/tables twice — once with the filter, once with every file — then running each
excluded spec's query:

query with the filter every file spec asserts
language:bn grade:1 (no match) bn.tbl bn.tbl
language:hr type:computer dots:8 (no match) hr-comp8.tbl hr-comp8.tbl
locale:pa grade:1 (no match) pa.tbl pa.tbl
language:es type:literary grade:1 es-no.utb es.tbl es.tbl
language:ar grade:1 he-IL.utb ar.tbl ar.tbl
language:en region:en-GB grade:2 en-ueb-g2.ctb en_GB.tbl en_GB.tbl
language:en region:en-US grade:2 en-ueb-g2.ctb en_US.tbl en_US.tbl
language:en region:en-US type:computer dots:8 en-nabcc.utb en_US-comp8-ext.tbl en_US-comp8-ext.tbl
language:cmn-Hans region:cmn-CN system:cmn-traditional variant:no-tone zhcn-g1.ctb zh_CHN.tbl zh_CHN.tbl

Every query from the 27 resolves to exactly the table its __assert-match names. Run over all 128
distinct queries in the suite, the only resolutions that change are those 27's — nothing the 100
specs already here depend on moves.

What this restores

25 of the 27, taking the suite from 100 specs to 125, over roughly 70 languages. The
recorded skipped tally moves with them: test option: mode 14 → 19, test option: typeform
287 → 339.

Green on net8.0 and net10.0 locally (208 tests each).

The two that stay out, and why

Both now resolve their tables correctly and fail on something else. Diagnosed and written into the
specs README rather than fixed here, since they are not this root cause:

  • en-us-g2.yaml (6/20) — the harness carries flags: forward into a following bare tests:
    block; upstream does not. lou_checkyaml.c declares int testmode = MODE_DEFAULT; inside the
    loop over the flags/tests keys, so a tests: block with no flags: of its own runs forward.
    The six failures are cases the harness runs backward and upstream runs forward — back-translating
    five identical cells and expecting five different bullet characters cannot pass either way.
  • es-g0-g1.yaml (8/992) — BrailleSpec.Unescape handles \xNNNN, \yNNNN, \uNNNN, \\
    and \", but not the \n, \r and \s this spec uses, so they reach liblouis as a literal
    backslash plus a letter. liblouis's own parseCharsInternal also takes
    \e \f \n \r \s \t \v \w and \ZNNNNNNNN. Worth completing carefully: \s appears across the
    specs, so it changes the input of cases that pass today — spaces.yaml is the obvious one to
    re-check.

Also recorded in the README: the 7 specs the old list did not name (ar-ar-g1, ar-ar-g1_harness,
en-GB-g2, en-us-comp8-ext-back_harness, en-us-comp8-ext-for_harness, en-us-g2, zh-chn),
and the fact that CopyToOutputDirectory never deletes — so a stale bin/ keeps tables upstream
has since removed, and with the filter gone those get indexed too.

🤖 Generated with Claude Code

BrailleSpecTests indexed tables/ through an extension allow-list that
predated upstream's .tbl files, so none of the 55 reached
lou_indexTables - and .tbl is exactly where upstream keeps the
#+language: / #+grade: / #+type: metadata that lou_findTable matches on.

liblouis applies no filter of its own: indexTablePath in metadata.c
hands lou_indexTables every file on LOUIS_TABLEPATH and lou_indexTables
drops the ones analyzeTable finds no metadata in. So a filter in the
harness could only ever be wrong in one direction, and it was.

That one omission is the whole of the group the specs README called "27
fail on table resolution, and are probably one root cause rather than
27". 20 queries matched nothing; 7 settled for a worse match from
another language - language:ar grade:1 resolved to he-IL.utb,
language:en region:en-US grade:2 to en-ueb-g2.ctb. Every one of the 27
now resolves to exactly the table its __assert-match names, and no
query from the 100 specs already here resolves differently than before.

25 of the 27 pass and are restored, taking the suite to 125 specs over
roughly 70 languages. The recorded skipped tally moves with them:
test option: mode 14 -> 19, test option: typeform 287 -> 339.

The remaining two resolve their tables correctly and fail on something
else, documented in the specs README rather than chased here:

  en-us-g2.yaml  this harness carries flags across a bare tests: block,
                 upstream resets to forward (lou_checkyaml.c declares
                 testmode inside the loop over the flags/tests keys)
  es-g0-g1.yaml  BrailleSpec.Unescape handles \xNNNN and \\ but not the
                 \n, \r and \s that liblouis's own parser takes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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