Skip to content

Answers spec v1.2, example asks with an overlap gate, host and time checks - #5

Merged
SecureCloudGroup merged 34 commits into
mainfrom
library-answers-v1
Oct 4, 2026
Merged

SecureCloudGroup merged 34 commits into
mainfrom
library-answers-v1

Conversation

@SecureCloudGroup

@SecureCloudGroup SecureCloudGroup commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Answers spec v1.2 across the curated records, example asks with an overlap gate, and the checks the app's last two review rounds asked for. Tag v1.3.0 after merge; the app pins that pack.

Answers spec v1.2 (docs/SCHEMA.md)

  • Value answers: window (now / today / tonight / tomorrow / latest), plus measure (closed list).
  • Lists and columns: axis: {cell, step: day|hour|period}.
  • Other fields:
    • tbd_if: {path, equals} for placeholder start times;
    • kind result;
    • utc: true for zoneless UTC times;
    • coverage.water: "ocean_coastal";
    • quoted keys in paths.
  • Backfill: every curated answers file declares window, measure and axis where the source supports them.
  • Lint: answers from one provider that read the same time path must agree on utc. swpc-kp is fixed.

Example asks (asks/)

  • What they are: 10 example asks per offerable source and 12 per route, built as the library_source_asks / library_route_asks tables.
  • Overlap removed: the first version repeated evaluation asks (121 exact + 96 near). 141 asks are rewritten from each source's own words.
  • The gate:
    • tests/test_asks.py fails on any overlap with the labeled sets in this repo.
    • sourcetool asks-overlap --against FILE... checks sets kept elsewhere.
  • App use: the app does not use these tables in this release. Its lookup runs on keywords, because the embedding ranking measured no better there.

Taxonomy, resolvers, records

  • New subcategories: lottery, geysers.
  • Keywords: phenomena, TV, music and packages.
  • Places:
    • ocean-coast and Great Lakes flags;
    • area nicknames on the place;
    • water bodies are not places.
  • Teams:
    • fan nicknames;
    • no everyday-word abbreviations;
    • TheSportsDB ids for college teams.
  • Buoys: they keep the measures they report.
  • Soccer competitions: full aliases.
  • New curated sources: lottery draws, geyser predictions, service status, NDBC wave buoys, MLB TBD times.
  • Gaps: honest gaps are recorded in answers/_skipped.md.

Checks

  • Host-position values: a resolver value filled into a host (https://{param}) must be a plain host. It may have no credentials, port, fragment or IP literal, and no query on the host itself; a feed path keeps its query.
  • Charset guessing: a body with no declared charset is read as UTF-16 only when NULs dominate one byte parity and it decodes cleanly. This is the same rule as the app.

Results

  • check: 8,674 records, 254 with answers, 0 invalid.

  • Tests: 255 passed (service/ not run here; it needs the service venv).

  • evalres: development 71/71, held-out 44/44, sealed 38/40. All are unchanged from main.

  • evallookup top-1:

    • development 46/47 (main 47/47: "Lakers score" now leads with the team's next game);
    • held-out 36/40, top-3 38/40;
    • sealed 29/30 (main 30/30: "college football rankings" now leads with a league's last results).

    This is sourcetool's own term lookup, not the app's.

CI note

The changed-source probe fails on bart-advisories (its address now asks for JSON) from GitHub's runners. The same probe from a residential connection returns 200 with JSON and status ok; that validation record is committed (sources/curated/core.jsonl). This is the datacenter-IP block the probe step's comment describes, not a broken source.

…ck + answers-generate

A source declares which response paths answer which questions (spec v1): closed keys, value/list/columns
kinds, path grammar, primary limits. validate_record and check run answer_problems; build merges
answers/<id>.json into each record (refusing orphans and malformed files) and counts
sources_with_answers into library_meta. answers-check fetches each sample and verifies every path with
the app's own parsers; answers-generate writes code-built answers for curated feeds and FRED series.
Built by sourcetool answers-generate and verified against live samples (2026-09-28). nyt-sports (empty
feed) and politifact (the app's feed parser refuses its leading blank lines) are listed in
answers/_skipped.md.
…r, no primary minimum

answer_problems takes the record's params: a whole {param} segment (or a filter's equals) must name one
of them. check_sample resolves {param} segments and applies filters with the params' examples. FRED
'As of' and 'Recent' dates regenerated as the date type.
…; feed answers regenerated

The app wraps a response whose top level is a list as {"items": [...]} before any path runs;
check_sample does the same. The time type accepts RFC 2822 dates as RSS publishes them. The 43 feed
answers files are regenerated: published is a time in 42 (state-travel-advisories sends dates without a
time of day and stays text).
- ESPN news/scoreboard/standings/college rankings: refused (HTTP 403 to
  SmartBrain's honest User-Agent)
- stooq-quote: retired (endpoint 404)
- nsidc-arctic-ice: v3.0 CSV is gone, moved to v4.0 (degraded: not card-ready)
- examples: NWS grid CHS 87,77; coops-currents ACT6651; usdm FIPS 45;
  tvmaze "the simpsons"; marine zone amz340
- filters/sort/window: EIA series facets (Brent+WTI, Lower 48 storage,
  US commercial crude), MTS Year-to-Date, upcoming auctions from today,
  USAspending agencies by obligations, openFDA shortages by update date,
  NVD 30-day publication window, NHL week schedule, OpenF1 sessions from today
- endpoint swaps: FDC Foundation+SR Legacy, USAspending budgetary_resources,
  FAA airport-events JSON (airport param), Amtraker one train, Frankfurter v2
- fred-inflation-rate: new record (CPIAUCSL transformation=pc1); the CPI
  index record no longer claims "inflation rate"
…lists paths

140 answers files authored from live responses (weather, water, sky, hazards,
energy, travel, time, markets, economy, sports, tech, science, health, civic,
culture, shopping, personal), each verified against its sample with the
spec's check; plus the path grammar accepts consecutive indexes
(data[0][3]) as the app's engine does.
…rds, MLB recent results

ESPN answers HTTP 403 to SmartBrain's honest User-Agent, so every ESPN source is refused.
Keyless replacements that answer 200 to it:

- sports_league resolver: TheSportsDB league ids for NFL, NBA, WNBA, MLB, NHL, MLS, NWSL,
  college football and basketball and the top European soccer leagues (with nicknames);
  fills thesportsdb-next-league's league_id, which was a gap.
- team_espn pro teams (NFL, NBA, WNBA, MLB, NHL, MLS) carry TheSportsDB's team id
  (attrs.tsdb_id, 167 of 169); ESPN's last harvest is kept while ESPN refuses.
- thesportsdb-team-next: a team's next game (eventsnext; the free key's eventslast returns
  home games only, so no team "last game" source).
- thesportsdb-last-league: the latest game in a league, with the score.
- thesportsdb-league-table: a soccer league's top five (the free key's limit; no table
  for other sports or the Champions League league phase).
- mlb-team-results: one MLB team's games over the past week with final scores
  (score asks were served by the forward-looking team schedule).

Every new record has an answers file verified against a live sample.
…els, BBC, HN, snow, water temp, state quakes, tides, UV, CPI, drought, moon

- open-meteo-sun (timezone=auto, the place's own clock) replaces sunrise-sunset (UTC, shown in the viewer's zone)
- replaced_by is implemented: build leaves retired sources out, check requires a live replacement;
  hn-top (ids only) is replaced by hn-frontpage-algolia (titles, points, comments in one call)
- FRED answers carry the series label and FRED's own unit; core CPI and PCE records are pc1 rates;
  CPIAUCSL is the index level (index 1982-84=100) and no longer answers "inflation rate"
- feed answers say what their items are (Headlines, Press releases, Latest papers...)
- BBC News feeds (top/US edition, world, US & Canada, business, technology, science)
- top-stories feeds (ABC, NPR, NYT home, BBC) and HN answer "top" asks; HN also in news/headlines
- Open-Meteo forecast: daily snowfall_sum and a Snow forecast answer (feels_like makes room)
- Open-Meteo marine in Fahrenheit; "water temp" classifies as water temperature
- usgs-quakes-state: a state's bounding box (us_state now carries FIPS + bbox from Census TIGERweb)
- Drought Monitor state fill uses the FIPS code (aoi=TX returned [])
- tide_station keeps primary stations (reference or water-level) and secondary ones only >50 km from
  a primary; tides/water-level/water-temperature search 80 km (Savannah -> Fort Pulaski)
- UV: today's max leads, current UV second
- usno-moon-today: the phase and illumination tonight, no place needed
- classification keywords for CPI ("consumer price index"), day length, moon
…, no fixed headers

- weather/forecast knows temp / hot / cold / degrees / warm ("temp in Denver" went to the ocean source)
- a row filter may compare with a short fixed value; MLB results list only final games
- US Drought Monitor read as CSV (the app never sends the Accept header the JSON needs);
  dadjoke via its header-free /slack address; the check now refuses fixed headers
- "next game" asks show when and where too (TheSportsDB next matchup)
…SC recalls show their day

FEMA's 2026-04-23T00:00:00Z showed as the evening before in US time; CPSC recalls read "12:00 AM".
…w links; APOD's image link is not a headline
…, CPI and ticker ranking

- goldapi-spot: gold, silver, platinum and palladium spot price in USD per troy
  ounce (gold-api.com, keyless; terms allow any lawful use), metal resolver.
- eol-ios, eol-ipados, eol-macos, eol-android, eol-windows, eol-python,
  eol-nodejs, eol-ubuntu: latest version, release dates, support end and the
  release list from endoflife.date (MIT).
- ll2-upcoming-launches: hide_recent_previous=true (the upcoming list included
  launches from the past 24 hours), optional launch_site and launch_provider
  filters (location__ids, lsp__id; empty when the ask names none).
- CPI: the headline rate answers "CPI"; core CPI only when the ask says core.
- sec-companyfacts: financials (trend, lookup), not a bare ticker's current
  value; financial words (EPS, earnings per share, net income) classify as
  filings.
- water/currents: the bare keyword "current" classified every "current X" ask
  as tidal currents; now "currents", "tidal current", "current prediction".
- answers: at most 12 per source; open-meteo-forecast shows Feels like.
…cast

- local-news-metro: 147 public RSS/Atom newsroom feeds for 52 metros, found by
  the metro's names through a new local_news resolver (reviewed list
  resolvers/local_news_feeds.json; each feed verified live). A place named with
  "news" now asks for that place's news (news/headlines policy is geo).
- Transit advisories: BART (bsa, BART's published public key), MBTA v3,
  CTA 'L' alerts, King County Metro alerts, each with answers.
- Gas prices: eia-gasoline-weekly takes the state (EIA's own series for 9
  states, else the state's PADD sub-region; US average when none is named);
  fred-gas-region gives the keyless regional price for the other states.
- Place aliases for well-known areas (Tahoe, Outer Banks/OBX, Cape Cod, the
  Hamptons, Twin Cities, Bay Area, Florida Keys, Jersey Shore, Upstate NY,
  the Poconos, and others); Big Sur as a representative point.
- swpc-kp-forecast: SWPC's 3-day planetary Kp forecast; aurora asks rank it
  first. Fixes eia-gasoline-weekly's history unit path.
…icknames)

The app takes one as the ask's place on its own ("Tahoe weather", "OBX surf report"), while a small
town's plain name still needs in / at / near.
BART's XML turned bsa into a list once a second advisory posted, and the card's path missed. Its JSON
always lists them; the text sits under #cdata-section, now reachable as description["#cdata-section"]
(the app already reads quoted keys). Adds a count of current advisories.
The Coinbase spot pair asked for a field no crypto entry had (symbol_usd_pair), so Coinbase was never
offered. Every crypto entry now has attrs.symbol (from its CoinGecko symbol alias); the fill is
attrs.symbol through "{UPPER}-USD".
…kind, coverage.water), lints, app-identity validation

- answer keys for the asked time window and measure, row axes, TBD times; the 'result' kind;
  coverage.water for ocean/coastal-only sources; expects + measure carried into the pack's policy
- lints (answer and keyword), taxonomy policy checks, classify ported to the app's longest match
- validation probes with the app's exact identity and samples resolver readings
- labeled classify and records lookup sets for measuring
…s, buoys that report, college team ids

- culture/lottery and science/geysers; phenomena, TV, music and package keywords
- places: ocean-coast and Great Lakes flags (Natural Earth + tide stations), area nicknames on the place,
  water bodies are not places, ski areas resolve to their town; no bare common-word aliases
- teams: fan nicknames, no everyday-word abbreviations, TheSportsDB ids for college teams;
  buoys keep exact NDBC ids and the measures they report; geysers; official sites
- soccer competitions get separate full aliases (premier league, la liga, euros, champions league)
…, service status, buoys with waves

- every curated answers file declares its window / measure / axis where the source supports it
- new curated records (lottery draws, geyser predictions, service status, NDBC wave buoys, MLB TBD times)
- honest gaps recorded in answers/_skipped.md
Written from the Library's own text only, never from labeled or blind sets; the build loads them as
library_source_asks and library_route_asks; check requires every offerable source and every route.
… way

The example asks repeated 121 evaluation asks verbatim and 96 nearly (word overlap >= 0.75), so locate
measurements on those sets were inflated. 141 asks are rewritten from each source's own words and its
route's keywords. tests/test_asks.py fails on any overlap with the labeled sets in this repo;
'sourcetool asks-overlap --against FILE...' checks sets kept elsewhere and exits non-zero on a hit.
…coding never guesses UTF-16 from one NUL

- https://{param} values (local newsrooms, status pages) are checked when the Library is checked: no
  credentials, port, fragment or IP literal, and no query on the host itself (a feed path keeps its query)
- a body with no declared charset is read as UTF-16 only when a quarter of its first bytes are NULs
  on one side and it decodes cleanly (same rule as the app)
…at on one zone

Answers from the same provider reading the same time path must agree on utc (swpc-kp and
swpc-kp-forecast both send zoneless UTC time_tag).
@SecureCloudGroup
SecureCloudGroup merged commit e12d160 into main Oct 4, 2026
3 checks passed
@SecureCloudGroup
SecureCloudGroup deleted the library-answers-v1 branch October 4, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant