feat!: strengthen level-one normalization and move fullmap to schema v6 - #172
Merged
Merged
Conversation
- nlp.level_one keeps its (lf, col) -> lf signature and in-place semantics but now routes the column through rs.normalize_terms via a null-safe map_batches (whole-column precedent from coerce.py; map_elements forbidden) - _normalize_terms_series: cast -> arg_true index mask -> one Rust batch call -> scatter back, so nulls never reach the pyo3 Vec<String> surface - 7 new tests: token-order insensitivity, stemming fold, dedupe + whitespace collapse, null/empty/whitespace-only preservation, digit/punctuation pass-through, unicode lowercase, other columns untouched - tests/test_lib.py fake-fullmap fixtures re-keyed to the new normalized forms (expectation-preserving: same logical assertions, keys verified against the real normalizer) so every commit leaves the suite green Verified: pytest tests/test_nlp.py tests/test_lib.py -n 0 -> 271 passed, 1 failed (pre-existing QcRuntimeMissingError: env lacks the [qc] extra, fails at HEAD too); pyright src/tablassert/nlp.py -> 0 errors; ruff check/format clean.
- route emit_term level-one keys through the shared Rust normalize_l1 implementation while retaining pre-normalization token/dead-term quality gates and post-normalization sentinel protection - bump the on-disk fullmap schema from v5 to v6 and reject v1-v5 with the existing rebuild instruction - regenerate and document golden pins; update normalized real-DB expectations and schema references in docs Verified: cargo fmt clean; clippy -D warnings clean; Rust lib 126 passed, fullmap 57 passed, build_golden 11 passed/1 ignored, extract_prebuilt 17 passed; targeted Python 471 passed with only the pre-existing QC-extra failure; golden and 2M-row builds within 1.25x; independent lock-step probe 1,232,064 terms with 0 unexpected misses; forged v5 lookup rejected loudly.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SkyeAv
added this pull request to stack #177
September 15, 2026 17:41
SkyeAv
marked this pull request as ready for review
September 15, 2026 17:42
SkyeAv
removed this pull request from stack #177
September 15, 2026 17:50
SkyeAv
added this pull request to stack #179
September 15, 2026 17:51
SkyeAv
added a commit
that referenced
this pull request
Sep 15, 2026
Cut 19.0.0 and bump the package version in pyproject.toml, CITATION.cff, and uv.lock. Major: five breaking changes ship. The `tablassert` console command now requires the optional `[cli]` extra, since `cyclopts` and `rich` left the base install (#187). Level-one normalization redefines fullmap keys as cleaned Unicode-lowercase, Porter2-normalized, byte-ordered token sets and moves the database to schema v6, so every schema-v5 fullmap is rejected and must be rebuilt (#171, #172, #174, #175, #176). `build-fullmap --aria2c` is gone -- aria2c is used automatically whenever the `[aria2]` extra is installed (#178) -- and `--taxon-allowlist` is gone because the built-in top-100 experimental-taxon allowlist now applies to every build, guarding both reuse paths by `META.taxon_allowlist` identity (#153). Logging now requires the `[log]` extra and is fully disabled without it (#152). Features: `tablassert.net` is a new stdlib-only transient/permanent classification and retry seam shared by the agent and the BABEL downloader (#163, #164), with one bounded jittered retry layer across the inner agent, reflexion, and judge (#167) and machine-readable `error_code` values on skipped checkpoint records (#166). `build-kg` gained an automatic ephemeral shared-prefix TCode cache keyed by content-addressed XXH64 op digests (#155-#159, #161). The `--distill` corpus became schema-uniform v2 with a sibling `outcomes.ndjson`, a deterministic `RewardConfig`-tunable reward, and the new zero-dependency `tablassert distill-weigh` command (#180-#183). `CLASS_FIELD_OVERRIDES` grants the DAKP sparse qualifier stack on the pinned association classes (#188). Fixes: `distill-export` partitions its corpus by content and unions the schema across record files, so a mixed v1/v2 directory no longer CastErrors or silently stringifies a column (#184); BABEL retry warnings survive the loguru sink; PMC downloads are idempotent, atomic, and bounded-parallel (#165); reflexion and judge prompts are hard-bounded (#168). Changelog: - versioned the Unreleased section as 19.0.0 - 2026-09-15 - merged three duplicate `### Added` blocks into one - moved the two `BREAKING:` entries from `### Changed` into `### Breaking Changes` and added a `**Migration:**` note to all five - added PR links to all 17 entries, which carried none - added the missing entries: the distill v2 corpus/reward/distill-weigh stack (#180-#183), the distill-export schema-drift fix (#184), the TCode run-cache detail (#155-#161), and the README badge removal (#154) Docs: none needed here. Every shipped doc change landed with its own PR, and the docs source-of-truth gate passes against the bumped tree. Testing: - make check -> exit 0 - uv run ruff check . -> All checks passed! - uv run pyright -> 0 errors, 0 warnings, 0 informations - uv run pytest -> 1622 passed, 52 skipped - cargo test --manifest-path rust/Cargo.toml -> 156 passed, 0 failed - cargo clippy --all-targets -- -D warnings -> clean - uv lock --check -> resolved 169 packages, lock current - uv run mkdocs build --strict -> exit 0 - docs SSOT + CLI coverage after the changelog edit -> 204 passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING: strengthens level-one normalization on both sides of the fullmap contract at once — the Python query side routes through the shared Rust normalizer, and fullmap builds derive their keys from the same implementation, moving databases to schema
tablassert.fullmap.v6.Why one PR
Python query side (
src/tablassert/nlp.py)level_one(lf, col): signature and in-place semantics unchanged; the column is cast to string and mapped throughrs.normalize_termsvia a null-safemap_batches(map_elementsstays forbidden per repo convention). Nulls never reach the pyo3 surface;""stays"".tests/test_nlp.py) with WHY docstrings: token-order insensitivity, stemming fold, dedupe + whitespace collapse, null/empty preservation, digit/punctuation pass-through, Unicode lowercase, other columns untouched. All 8 pre-existing tests pass unmodified.tests/test_lib.py) to normalized forms, each mapping verified against the real normalizer — expectation-preserving, no weakened assertions.Rust build side (
rust/src/fullmap.rs)emit_term: level-one keys now derive vianlp::normalize_l1, byte-for-byte matching the query side.token_qc's banned-token check compares literal spellings (hypothetical,uncharacterized) that Porter2 would mutate (hypothetical→hypothet); a second post-normalizationis_dead_termguard blocks terms that normalize onto query-side sentinels. Level-two derivation composes after level one unchanged.Schema migration
SCHEMA_VERSIONv5 → v6: the key SPACE changed, so old databases can never be hit by normalized queries;validate_schemarejects v1–v5 loudly with the existing rebuild instruction, covered by v4/v5 rejection tests.rust/tests/build_golden.rs,rust/tests/common/mod.rs,rust/tests/extract_prebuilt.rs) with the documented regeneration command; Python real-DB expectations re-keyed; schema strings updated indocs/fullmap.mdanddocs/cli.md.Testing
cargo test --manifest-path rust/Cargo.toml→--lib 126 passed,fullmap 57 passed,--test build_golden 11 passed, 1 ignored(the documented regeneration helper)test_fullmap,test_cover_fullmap,test_docs_source_of_truth,test_nlp,test_lib) →471 passedHITS=1,221,965 EXPECTED_DROPS=10,099 UNEXPECTED_MISSES=0; forged v5-tagged DB rejected loudly through both direct lookup and the productionresolve_manypathpython-lint,python-test,python-type,rustall pass on this headCaveats
tablassert build-fullmap); prebuilt archives need a re-release.