Air review R1 blocker: stopping each caller at its first observation
lost the stability sampling the original windowed churn provided. Keep
the bounded readiness wait (barrier + per-caller observation), then have
every caller perform 50 further calls asserting each result is the very
same object as its first observation and never None; per-thread
mismatches are asserted empty after a bounded join. All prior invariants
kept: one shared instance ever, built exactly once, every caller saw it.
CI run 42532087495 failed on Python 3.11-3.14 for test-hermeticity
reasons, not contract violations:
- test_fifo/cold-cache: in a full-suite run, another test's
tiktoken.get_encoding leaves a resident cl100k_base in tiktoken's
in-process registry, and the acquisition correctly adopts it without
touching the filesystem -- so the FIFO/cold paths under test were
silently bypassed. Empty the registry via the existing
registry_free_tiktoken fixture so these tests always exercise the
paths their names claim.
- test_concurrent_warm_calls_yield_one_encoding: its fixed 0.5s
observation window conflated publish latency with sharing; on slower
runners nothing was observed in the window (CI: len(every_seen)==0).
Each caller now churns until it personally observes the encoding
(bounded deadline), and the assertions strengthen to require every
caller to see the same single instance.
- summarize-path tests: count boundaries were tuned for exact counts,
but #2522 keeps cold caches on the chars/4 heuristic, flipping the
rebuild/fold-in decision. Pin count_tokens on a deterministic exact
word counter (same idiom as the PR's own count_tokens tests) so the
budget-path logic stays deterministic on every machine; all original
assertions are unchanged.
No production changes: registry adoption, offline acquisition and
non-blocking callers are working as designed.
The deletion/replacement race tests previously skipped unless a real
cl100k_base cache fixture existed. They now build from a small synthetic
ranks blob whose hash is pinned for the test, against the real tiktoken
with every download-capable loader rigged to fail. Real-tokenizer parity
stays an explicitly optional test.