Skip to content

Add characterization tests for StopWordList fold, order and RDB round trip - #10912

Merged
memark merged 2 commits into
masterfrom
memark-stopwords-characterization
Aug 14, 2026
Merged

memark merged 2 commits into
masterfrom
memark-stopwords-characterization

Conversation

@memark

@memark memark commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: several StopWordList behaviours that callers rely on have no test pinning them. Case folding truncates a term at an embedded NUL and mangles invalid UTF-8 instead of rejecting it; the stop_words INFO field renders in lexicographic rather than insertion order; and an RDB save/load pair is assumed to be an identity on both the stored key bytes and their order. Each of these could change silently today without a test failing.
  2. Change: five tests, no production code. Two cover the folding behaviour, one the INFO ordering, and two the RDB paths — a full round trip plus a truncated payload.
  3. Outcome: internal-only, no user-visible change. It makes the current behaviour a fixed point, so a later change to folding, to the ordered container behind the list, or to the RDB encoding has to either preserve it or declare itself a behaviour change.

Which additional issues this PR fixes

N/A

Main objects this PR modified

  1. StopWordList case folding — add path and lookup path asserted to transform a term identically, rather than against a predicted output.
  2. AddStopWordsListToInfo — first test to insert terms out of order, so the rendered order is now constrained.
  3. StopWordList_RdbSave / StopWordList_RdbLoad — round trip pinned on key bytes and order; a truncated payload covers the load failure that happens after the list already holds an entry.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

…nd trip

`StopWordList` has observable behaviour that no test pinned: case folding
truncates a term at an embedded NUL and mangles invalid UTF-8 rather than
rejecting it, the `INFO` field renders in lexicographic rather than insertion
order, and an RDB save/load pair is expected to be an identity on both the
stored key bytes and their order.

The two folding tests assert that the add path and the lookup path transform a
term identically, rather than asserting a predicted output, so they pin the
property callers depend on without hard-coding the decoder's arbitrary mapping
for invalid input.

`testStopWordListRdbLoadTruncated` covers the load failure that happens after
the list already holds an entry, which the existing
`testStopWordListRdbLoadExceedsLimit` does not reach because it bails before
allocating anything.

Co-Authored-By: Claude Opus 5 <[email protected]>
`codespell` reads the two-byte prefix `"fo"` as a misspelling of `of`/`for`,
failing the spellcheck job. Any proper prefix of the stored key demonstrates the
same thing, and suppressing the word repo-wide would cost more than it buys.

Co-Authored-By: Claude Opus 5 <[email protected]>
@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.21%. Comparing base (1fec8e2) to head (8e3cfbd).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10912      +/-   ##
==========================================
- Coverage   83.19%   82.21%   -0.98%     
==========================================
  Files         608      632      +24     
  Lines       81025    82134    +1109     
  Branches    36273    37382    +1109     
==========================================
+ Hits        67405    67528     +123     
- Misses      13274    14260     +986     
  Partials      346      346              
Flag Coverage Δ
flow 84.33% <ø> (-0.04%) ⬇️
unit 55.75% <ø> (-0.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

sonarqubecloud Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
14 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Comment thread tests/cpptests/test_cpp_rdb.cpp Dismissed
@memark
memark added this pull request to the merge queue Aug 14, 2026
Merged via the queue into master with commit ec613e9 Aug 14, 2026
58 checks passed
@memark
memark deleted the memark-stopwords-characterization branch August 14, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants