Skip to content

fix: normalize preferred-name ranking comparisons - #174

Merged
SkyeAv merged 1 commit into
stronger-l1/python-level-onefrom
stronger-l1/pr-ranking
Sep 15, 2026
Merged

SkyeAv merged 1 commit into
stronger-l1/python-level-onefrom
stronger-l1/pr-ranking

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Fixes preferred-name ranking so the PR boost survives the normalized v6 keys: both sides of the comparison now go through the same Rust-backed normalizer.

Ranking (src/tablassert/fullmap.py)

  • Normalized comparison: filter_and_rank normalizes PREFERRED_NAME and term via the existing _normalize_terms_series/rs.normalize_terms batch helper before the level-one preferred-name equality, so reordered (Oral Aspirin) and inflected (Oral Aspirins) preferred names still earn the boost against the stored key aspirin oral.
  • Historical branch preserved: the raw exact-match boost stays first and unchanged; rows without preferred names and genuinely non-matching names keep their existing ranking.

Tests (tests/test_fullmap.py)

  • New cases with WHY docstrings: reordered preferred name earns the boost (PR=250), inflected preferred name earns it, genuinely non-matching name does not (PR=500); all pre-existing assertions, including test_pr_case_insensitive_preferred, pass unmodified.

Testing

  • uv run pytest tests/test_fullmap.py -n 0 -q61 passed
  • uv run pytest tests/test_nlp.py -n 0 -q15 passed
  • uv run pyright src/tablassert/fullmap.py tests/test_fullmap.py0 errors; ruff check/format --check → clean

- normalize PREFERRED_NAME and candidate term through the existing Rust-backed
  batch normalizer before the level-one preferred-name comparison
- preserve the historical raw exact-match boost and all nonmatching ranking
  behavior
- cover reordered, inflected, and genuinely nonmatching preferred names

Verified: tests/test_fullmap.py 61 passed; tests/test_nlp.py 15 passed;
pyright 0 errors; ruff check and format clean.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7f02cc8b-1daf-412f-88c8-3daf03f532a1


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SkyeAv
SkyeAv added this pull request to stack #177 September 15, 2026 17:41
@SkyeAv SkyeAv changed the title feat: [US-004] normalize preferred-name ranking comparisons fix: normalize preferred-name ranking comparisons Sep 15, 2026
@SkyeAv
SkyeAv marked this pull request as ready for review September 15, 2026 17:42
@SkyeAv
SkyeAv removed this pull request from stack #177 September 15, 2026 17:50
@SkyeAv
SkyeAv changed the base branch from stronger-l1/fullmap-v6 to stronger-l1/python-level-one September 15, 2026 17:51
@SkyeAv
SkyeAv added this pull request to stack #179 September 15, 2026 17:51
@SkyeAv
SkyeAv merged commit 510465c into main Sep 15, 2026
5 checks passed
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
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.

1 participant