10 Commits
Author SHA1 Message Date
CatoandClaude 901e349e6c fix(quality,graph): entity quality counts, registry/graph import cycle, repo docs (#425)
Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 08:39:51 +01:00
CatoandClaude 4bf1b011cb quality: flag likely publisher mistakes with @bitbaum/datakit; re-read sources (#417)
Adds series/no-likely-error (correctness): each series' points run through
the shared checks Solon uses, failing a point held as almost surely a
mistake. All series pass today. Re-reads every series quote (573 of 574
found; one BLS page unconfirmed), re-dates the claims, and refreshes the
sanctions regimes, which had passed their age limits and failed verify on
main.


Claude-Session: https://claude.ai/code/session_019MDtmvTCDbJAYNKQpNyKzz

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 18:29:28 +01:00
CatoandClaude 14a4ea80b9 fix(quality): refuse source links that redirect into the private network (#382)
* fix(quality): refuse source links that redirect into the private network

The data-quality cron (lib/quality/page-text.ts, lib/quality/network.ts)
fetched corpus source URLs with redirect:'follow' and no private-network
guard, so a cited link that 302s to localhost or the cloud metadata service
would have been fetched from the box.

Every quality fetch now goes through guardedFetch: redirect:'manual' and
@bitbaum/ai-kit/web's validateFetchTarget on the first URL and on every hop
(up to 5), per the package-first rule. A refused target is a ReadError
("refused: ..."): pageText reports the quote as unreadable, probeUrl as an
error, without retrying. A failed DNS lookup is rethrown in fetch's shape so
EAI_AGAIN still reads as unresolved (unscored) and ENOTFOUND as broken.

readPage is not used for the body: it refuses PDFs, sends its own user agent
and keeps only the article part of a page, which would change which quotes
are found. Public URLs answer as before (test/quality-network.test.ts).
package-plan.json binds the file under the ai block; README says so.

Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8

* docs(quality): say which network checks go through the SSRF guard

Every check that opens a corpus link uses guardedFetch; the SEC ticker
file and OpenFIGI calls go to fixed hosts. The README said every check.

Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:50:40 +01:00
CatoandClaude 3c6860d110 refactor(dates): validate and count days with @bitbaum/whenkit (#381)
Seven local copies of the YYYY-MM-DD regex (registry schema, entry
vocabulary, graph validation, event rules, event drafts, two quality
checks) and three hand-rolled day calculations (price window dayBefore and
daysBetween, starter rotation day count) are replaced by whenkit's
isISODate, addDays and daysBetween, per the packages-first rule.

isISODate also rejects impossible calendar days (2026-02-30), which the
regex let through; every stored row still passes. The entry isoDate schema
carries JSON Schema format "date", and the printed shape notes YYYY-MM-DD,
so the data-entry shape still states the form after the pattern is gone.
package-plan.json binds the new files under the dates block.

Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:49:49 +01:00
Cato a053c3390f fix(quality): enforce runtime budget and forward request abort signal (#341)
- Align SCHEDULED.budgetMs to 200s (200_000ms) to ensure scheduled quality runs finish well within the 300s box wrapper
- Forward request.signal from POST /api/cron/quality to runQuality
- Pass signal and remaining time bounds to probeUrl, quotesAt, pageText, secVerdicts, figiVerdicts, and mcsVerdicts
- Stop starting new lanes and work in pool when signal is aborted or deadline is reached
- Add automated test in test/quality.test.ts verifying budget bounds and signal forwarding
2026-11-05 20:32:39 +01:00
CatoandClaude Opus 5.5 70258beed0 feat(globe): Substrata's globe on the fleet's one renderer, @bitbaum/geo-kit/map (#306)
* wip(globe): Substrata's globe on @bitbaum/geo-kit/map (lockfile follows the 0.3.0 release)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC

* feat(globe): Substrata's globe on the fleet's one renderer, @bitbaum/geo-kit/map

The world globe moves onto @bitbaum/geo-kit/map 0.3.0, the renderer that was
extracted from it and that Solon's commune map already draws with. Seven
modules go (cull, trace, motion, pick, input, loop, control); globe-geo and
globe-paint keep only Substrata's side (countries keyed by ISO code, the
tokens, the hatch, the layer's fills); the sites, routes, figures and pulse
stay Substrata's, drawn over the Earth through the renderer's `over` hook and
given the first say on a tap or hover through `pickFirst`. The renderer's
wiring is its own file (globe-renderer.ts), so Globe.tsx stays under its
300-line ceiling. The globe's geometry tests now live in geo-kit; the ones
here test Substrata's side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 23:35:59 +01:00
c4f7f50435 Re-check the stale data honestly, monthly, without a laptop; rank the Ask evals on a fixed day (#247)
* fix(index): rank the Ask evals on a fixed day, and hand every producer the build's now

buildChunks(now) keyed its memo by now's day but called the event and quality
producers without it, so a caller pinning now still got today's recency and
today's date-dependent quality findings. On 2026-10-25 the lapsed 30-day
series re-read added 139 quote-checked-recently findings to the index and one
pushed science:high-na-euv to sixth for 'How ready is high-NA EUV
technology?'. Reproduced at 8e85c7e, 71978bd and 2fd9194 with the clock
pinned: every one passes on 2026-10-24 and fails on 2026-10-25 (before #242
the row that fell out was jobs-niger instead). No commit introduced it.

The evals test ranking, not the calendar; staleness has its own gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* feat(research): --write dates only what a re-check actually found

check-series.ts --write sets checkedOn on a series only when every point's
quote was re-read in that run and found; misses and unreachable pages keep
their last real date. check-job-boards.ts re-opens each careers page and
re-dates only records that still hold; the file's own date is the oldest
record's. Both are named as the refresh in config/substrata-freshness.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: re-read 2026-10-25 — 128 of 139 series, 109 of 138 job-board records

check-series.ts --write: 535 of 574 quotes found, 0 missing, 39 unreachable
from the sandbox (31 www.asml.com press releases now 301 to investor.asml.com,
which answers 403; 8 data.bls.gov 503). The 11 series behind them keep
2026-09-24. check-job-boards.ts --write: 109 records held, 29 not confirmed
(kept at 2026-09-24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: listings re-searched 2026-10-25 (SEC tickers + OpenFIGI, all 138)

pnpm run research:listings, full mode (not --revalidate, which re-applies the
rule to stored rows without searching): every OpenFIGI search answered. Two
rows moved: Air Liquide's SEC OTC line (AIQUF) is no longer in the SEC ticker
table; Fanuc now has one (FANUF, CIK 1446596). The 7 private rows come from
config/substrata-listing-overrides.ts, as the script defines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* ci(data): a monthly re-check that commits only what it re-read and found

.github/workflows/recheck-data.yml runs check-series --write, check-claims
--write and check-job-boards --write (and the ~70-minute listings re-search
on the schedule or when asked), then commits to the dispatched branch or
opens a bot/recheck-data-<date> PR. Token: FLEET_PAT, else GITHUB_TOKEN, as
in auto-merge.yml; a GITHUB_TOKEN push triggers no CI, so the PAT is preferred.

check-claims.ts dates research/claims.json only when every claim's sentence
still reads in its file and every series it cites was re-read and found
today, and prints the latest values beside each claim for the reviewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: three dead ASML source URLs point at the same releases as filed with the SEC

The 2019-Q4, 2020 annual and 2024-Q2 press releases on www.asml.com now 301
to ASML's generic press-release index. The same releases are exhibits to
ASML's Form 6-K filings (0000937966-20-000003, -21-000003, -24-000019);
all seven quotes were re-read there and found. One quote is shortened to a
verbatim span of the same sentence: the filed HTML splits 'at' across a tag
('a t'), so the sentence's opening cannot be matched mechanically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* ci(data): run the re-check once on this branch (temporary push trigger)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: re-check 2026-10-25 (scheduled re-read)

Dates moved only for what was re-read and found in this run; see the workflow summary for every row that was not.

* fix(quality): a word split across two style runs reads as one word

SEC filings print some words as two font runs ('EU</font><font …>V'), and the
reader turned every tag into a space, so 'EUV' read 'EU V' and a quote copied
from the rendered page missed. Only a letter-run-letter split is joined; a
footnote run ('billion</font><font>2') and every other tag stay a space.
Full re-read before/after: no quote that was found is lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: ASML points the runner cannot open, re-sourced to the same releases on SEC EDGAR

investor.asml.com answers 403 to GitHub's runners as well as to the sandbox.
Sixteen points whose page could not be opened from either now cite the same
press release as filed with the SEC (Form 6-K); each quote was re-read there
and found. The 2020-Q4 bookings quote is back to its full sentence (the page
reader now joins 'a t'). SICC: the quotes carried the old reader's split
('S iC'); they now read 'SiC', as the page does, and are found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* feat(research): job boards re-checked in a browser, and absences re-checked too

A careers page whose served HTML lacks the system's mark is drawn in Chromium
(the workspace's Playwright); failing that, the tenant the evidence names
must still answer as that system. A record saying something is NOT there
holds while it still is not (no careers link, site still down, hosts named
still not answering). The workflow installs Chromium for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: re-check 2026-10-25 (scheduled re-read)

Dates moved only for what was re-read and found in this run; see the workflow summary for every row that was not.

* data: job boards — every site the evidence names may show the system; 4 more held

Run from the sandbox with Chromium on the 11 records the runner could not
confirm: chalco, openai, supermicro and ase-technology… held where a site the
record names still shows its system; 7 stay at 2026-09-24 (listed in the PR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* ci(data): drop the one-off push trigger; schedule and dispatch only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* feat(freshness): rows tried and not confirmed are a visible, expiring exception

A re-check that cannot confirm a row (a source that refuses our servers, a
page that changed) now records it in the dataset file's 'unconfirmed' list
with the reason and the day it was tried — written by check-series and
check-job-boards --write, never by hand; a row confirmed later leaves it.

The gate counts a listed row as tried on that day: the dataset is judged by
the oldest of each row's own check or recorded try, so an entry expires like
any date and next month's run must try again. A dataset with listed rows is
never 'fresh' (it reads 'late' and is under Needs attention), and
/data/freshness and /api/health/freshness name every row with its reason.
Tests: a row neither dated nor listed fails, an expired entry fails, a
listing for another row covers nothing, and the table renders the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* data: record the rows no re-check could confirm on 2026-10-25

check-series --write lists us-employment-semiconductor-related-device-
manufacturing (data.bls.gov answered 503 to the sandbox and to GitHub's
runner; BLS refuses datacenter addresses). check-job-boards --write lists
air-products, umc (403), tanaka-kikinzoku (504), baosteel-gases,
element-six and yaskawa. nippon-steel was re-opened: its recruit page's
yelloop.jp link is an alumni network; /recruit/hq/ still links its axol
entry (job.axol.jp/bx/s/nipponsteel_27), so the evidence names that page
and the record held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-25 12:23:32 +01:00
CatoandClaude c9b421d54f feat(atlas): producer sites on the globe, and every chain as a route you can follow (#175)
Producers on the globe
- research/producer-places.json places 997 of the 1,167 facility locations in
  the USGS Minerals Yearbook tables, in 37 countries, from GeoNames (CC BY 4.0),
  matched offline by scripts/research/geocode-producers.py.
- Each point states its precision (the facility, the nearest town, or only
  the province) and the GeoNames entry it came from. A named province must
  hold the point, "N km north of X" is applied as an offset, and a bare name
  with distant namesakes is left out rather than guessed.
- test/producer-sites.test.ts fails if a dot lands inside another country.
  The quality page measures the same through lib/quality/checks-places.ts.
- The globe draws sites as dots, or rings when only the province is known.
  A click flies in close and opens the site's facilities, capacity and both
  sources in the panel.

Chains as routes
- app/atlas/chain-route.ts is the one route model: every step two levels up
  and down, numbered in the order material moves, each placed where it is made.
- The diagram (AtlasChain) now reads left to right through every step, with
  makers inside the bottleneck's card. This fixes the connector that ran
  through the part suppliers' cards.
- "On the globe" lays the same route over the Earth: one lifted arc per hop,
  a light running input to output, and labels numbered like the panel's list.

The globe's input wiring moves to globe-control.ts; sites and routes are
painted by globe-overlay.ts.


Claude-Session: https://claude.ai/code/session_013Xssd1hFZCUSxqjACjoVBB

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 05:11:11 -07:00
CatoandClaude Opus 5.5 583df713e1 refactor(site): the address lives in lib/site.ts only (#131)
Five files typed the host themselves (BYOK referer, two user agents, a
diagram caption, metadataBase). They now read SITE.host / SITE.url, so the
move to substrata.ch is a one-line change. Guarded by one-site-host.test.ts
(mutation-checked). No behaviour change.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 05:07:00 -07:00
CatoandClaude Opus 5.5 3cf5c26f49 feat(data): quality criteria, automated checks and /data/quality; fix what they found (#116)
* fix(data): correct what the quality checks and a 36-row source sample found

- listings: 8 pinned home lines stored a composite FIGI that OpenFIGI cannot
  resolve (openfigi.com/id 404, ID_BB_GLOBAL mapping empty); pinnedLine now
  keeps the exchange line's own FIGI (TSMC, UMC, GlobalWafers, ASE, SMIC,
  Rio Tinto, NKT, TSMC Advanced Packaging)
- sanctions: all 49 EU amendment dates were a day early (Brussels-midnight
  stamps read in UTC); 4 OFAC programmes had empty titles (menu link parsed first)
- usgs-producers: wrapped workbook cells were split into bogus facilities
  (64 fragments -> 5); Chile's copper table had lost Escondida, Spence, Sierra
  Gorda and 12 more rows behind a 'Continued' commodity cell
- events/dependencies: 7 paraphrased quotes replaced with the source's
  verbatim text; SK Siltron event names its directory company
- series: 18 Cameco points get the date their MD&A states
- directory: Shin-Etsu Handotai source 404 replaced; Fangyuan careers URL
  (domain does not resolve) set to null as its evidence already said

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(data): written quality criteria per dataset, automated checks, /data/quality

- config/substrata-quality.ts: 15 datasets x 6 criteria (completeness,
  correctness, provenance, freshness, link health, consistency); each a rule or
  'na' with a reason; freshness reuses config/substrata-freshness.ts
- lib/quality: pure checks (USGS world sums, quote states the value, names
  resolve, cross-dataset agreement with USGS) run in verify with a failure-count
  ratchet (test/quality.test.ts); network checks (links with 3 tries and a
  blocked/broken distinction, quotes on page, SEC ticker file, OpenFIGI mapping,
  USGS values on the chapter PDF) run on a rotation via /api/cron/quality
- migration 014: research_quality_checks + research_quality_runs (trend)
- /data/quality: scores, counts, trend and every failing row with its source
  and a prefilled correction issue; linked from /data, footer, palette
- check-series.ts shares the reader (CDATA and ' ,' fixes found by the sample)
- pnpm run quality [-- --network | --all | --json out.json]; no AI anywhere

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 00:23:09 -07:00