Commit Graph

4 Commits

Author SHA1 Message Date
evan188199-tech
42f4b4dfa8 test: keep repeated shared-instance identity checks in concurrent warm test
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.
2026-11-09 09:42:50 +08:00
evan188199-tech
0f232b2c36 test: keep token-encoding and summarize-path tests hermetic on CI
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.
2026-11-09 08:58:03 +08:00
evan188199-tech
0272634772 test: run token-encoding race regressions on a synthetic verified blob
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.
2026-11-09 00:59:56 +08:00
evan188199-tech
5177b4d48f fix: keep first-chat tokenizer acquisition local and nonwaiting 2026-11-09 00:42:38 +08:00