Skip to content

Share the fetch and the stratum loop across the corpus builders - #699

Merged
derek73 merged 2 commits into
masterfrom
feat/issue-696-shared-driver
Oct 17, 2026
Merged

derek73 merged 2 commits into
masterfrom
feat/issue-696-shared-driver

Conversation

@derek73

@derek73 derek73 commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Item 3 of #696 (items 1 and 2 landed in #697).

  • corpus_build.fetch_bytes() replaces the four hand-written Request/User-Agent/urlopen/sleep closures: CLDR, GND, Wikidata and the LC cross-check. Each keeps its own timeout and delay.
  • build_strata() in build_wikidata_corpus.py replaces the two near-identical build() loops (a person taken once across strata, the missing-person stop, the floor stop). What differs is passed in: how entities are fetched, the property list, the progress-line width, and a keep callback the native builder uses for LCCNs.
  • The tests' time.sleep patches move into the shared serve fixture. Four new tests pin fetch_bytes directly (User-Agent and extra headers, POST, delay only after a response, no delay on failure).
  • Offline rebuilds of both Wikidata corpora leave every committed file unchanged. Full suite, ruff and mypy pass. GND and CLDR were not rebuilt: their fetch is covered by the GND serve tests and the new fetch_bytes tests.

Closes #696

🤖 Generated with Claude Code

corpus_build.fetch_bytes replaces four hand-written urlopen closures
(CLDR, GND, Wikidata, the LC cross-check); build_strata in
build_wikidata_corpus.py replaces the two near-identical build() loops.
The tests' time.sleep patch moves into the shared serve fixture.
Offline rebuilds of both Wikidata corpora leave every committed file
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Oct 17, 2026
@derek73 derek73 added this to the 2.5 milestone Oct 17, 2026
The _Counted Protocol did not type-check (NamedTuple fields are
read-only): make its members properties and bind the callbacks to the
stratum type with a TypeVar. Pin Wikidata's POST, Accept header and
politeness delay, the LC delay, and that keep() sees only taken people.
Fix the corpus_build roster and the shared-helper comments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.03%. Comparing base (9e7b728) to head (fae4368).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #699   +/-   ##
=======================================
  Coverage   99.03%   99.03%           
=======================================
  Files          46       46           
  Lines        4541     4541           
=======================================
  Hits         4497     4497           
  Misses         44       44           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73
derek73 merged commit 186d162 into master Oct 17, 2026
12 checks passed
@derek73
derek73 deleted the feat/issue-696-shared-driver branch October 17, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Wikidata corpus whose query starts matching fewer people still builds: carry the short-pool guard to both builders

1 participant