names/tagger: drop the flag-keyed cache, re-pin tests to production flags

Open
#241 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
backend

Research direction

Start in rust/src/names/tagger.rs and inspect the production call from analyze.rs, especially the TAGGER_FLAGS constant and the existing tagger tests. Replace the flag-keyed cache with the two production statics, then re-pin test automatons to TAGGER_FLAGS and adjust expectations where needed. Done means the cache and obsolete flag combination are gone and the tagger tests cover the production configuration.

Written by the indexing model from the issue text.

Description

Two related leftovers in rust/src/names/tagger.rs:

  1. The tagger cache is a RwLock<HashMap<(TaggerKind, Normalize), Arc<Tagger>>>, justified in a comment as "same shape as the org_types Replacer cache". The analogy doesn't hold: the Replacer receives arbitrary flags over FFI from Python, while the tagger has no Python surface at all — its only production caller is analyze.rs with the constant TAGGER_FLAGS (CASEFOLD | NAME). Two LazyLock<Tagger> statics (org / person) would replace the lock, the map, and the key hashing.

  2. The unit tests build automatons with CASEFOLD | SQUASH_SPACES — a combination pinned to a Python wrapper default that no longer exists (the wrapper module was removed; only analyze_names drives the tagger now). All tagger tests therefore exercise a configuration production never runs. Re-pin them to TAGGER_FLAGS and adjust expectations where needed.

Doing (1) makes (2) mostly automatic, since the statics would be built with the production flags.

🤖 Generated with Claude Code

Dominant language
Python
Stars
67
Forks
18
Avg merge
13h 7m
Merged PRs (30d)
15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opensanctions/rigour

All issues in opensanctions/rigour

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.