SCOPE.md now states only what exists (write-only cache, retry on any URLError, optional source, string-compared latest period). INTENT.md sharpens commitments 1 and 2. README and the capability record drop the replay overclaim. WP-0002 reworks T01 (selective retry) and adds T05 (enforce source), T06 (replay from cache), T07 (latest-period rule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 153021@bnt-lap001 Assistant-Session: 46917be4-6400-4106-b8b7-61953a0caf24
3.2 KiB
3.2 KiB
SCOPE
What the repository is today. What it aspires to be is in
INTENT.md; the gap between the two is tracked inworkplans/.
One-liner
Standard-library fetching of data from public APIs and web data files into
provenance-carrying Observation records, for research repositories.
Core Idea
Research repos declare what they need as JSON fetch specs; web-fetcher fetches
each URL and returns Observation records with the value plus URL, retrieval
time and the SHA-256 of the raw payload. Missing data becomes not_found,
failures become error; a failing spec never aborts the run.
What Exists
Observationrecord andfetch_bytesHTTP GET (web_fetcher/core.py): setsretrieved_atandpayload_sha256on every fetch; retries anyURLError/timeout/OSErrortwice with linear backoff (1.5 s, 3 s) — this includes permanent HTTP 4xx such as 404; noRetry-Afterhandling.- Spec dispatch (
web_fetcher/registry.py): unknown adapters, fetch failures and parse errors becomeerrorobservations. - Adapters:
eurostat(JSON-stat 2.0) — also setspublishedfrom the dataset'supdated.http_json— dotted path lookup.http_csv— row filter; "latest" row chosen by string comparison of the period column, or the last row if none is given; non-numeric values are returned as strings withstatus: ok.xlsx_wide— one column per period, stdlib XLSX reader (web_fetcher/xlsx.py).manual— alwaysnot_foundwith a note.
sourceis copied from the optional spec field; the HTTP adapters can emitstatus: okwithsource: null.publishedis unset outsideeurostat.- Cache (
--cache DIR): write-only. Stores<sha256>.binand appends toindex.jsonl; nothing reads it back, so runs cannot yet be replayed. - CLI
python3 -m web_fetcher fetch specs.json [--cache] [--out] [--only]emitting JSONL; exit code 1 if any observation iserror. Python APIrun_spec,run_specs. - 8 offline unit tests against Eurostat and Census BTOS fixtures and fake getters; no live-endpoint tests.
- Reuse-surface capability record
capability.infotech.provenance-fetch(registry/), vector D2 / A2 / C1 / R1.
Out of Scope
- Crawling, scraping behind logins, JavaScript-rendered pages
(use
capability.infotech.headless-browser). - LLM-based extraction or estimation of missing values.
- Scheduling — activity-core owns when.
- Execution orchestration — rein-aharness owns how it runs.
- Storing or analysing fetched data; that belongs to the consuming research repo.
- Authentication, pagination, third-party runtime dependencies.
Current State
- Version 0.1.0, ~400 lines of Python, untagged; consumed from source.
- Consumer: assembly-economics reality checkpoints (
checkpoints/run_checkpoint.py, viaWEB_FETCHER_PATH). - Running inside rein-aharness is plausible (stdlib only) but unverified.
- Gaps against
INTENT.md(source enforcement, replay, latest-period selection, selective retry, release) are tracked inWEBFETCH-WP-0002.
Getting Oriented
- Start with:
INTENT.md, thenREADME.mdfor spec fields and usage. - Agent instructions and dev commands:
AGENTS.md - Capability record:
registry/capabilities/ - Workplans:
workplans/