217 Commits
Author SHA1 Message Date
CatoandClaude 49ed5fc48f fix(prices): answer the cron call by a hard deadline (#428)
Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 23:36:50 +01:00
CatoandClaude ceaca42a08 fix(layout): keep content clear of the feedback launcher; fit tab labels at 320px (#426)
* fix(layout): keep content clear of the feedback launcher; fit tab labels at 320px

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

* test(layout): hold launcher clearance and 320px tab labels at the source

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

* fix(quality,graph): entity quality counts, registry/graph import cycle, repo docs (#425)

Co-authored-by: Claude <noreply@anthropic.com>

* fix(layout): keep content clear of the feedback launcher; fit tab labels at 320px

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

* test(layout): hold launcher clearance and 320px tab labels at the source

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

* style(test): format layout-clearance test

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 09:17:23 +01:00
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
Cato 4269a4376a Connect research processes and sourced company relationships to the map (#422) 2026-12-02 03:56:44 +01:00
Cato 4ba37120a3 Explore an entity’s connections and evidence (#421)
* Explore entity connections and their evidence from profiles

* Open the connection map on the entire entity registry

* Give connections stable identities and expose all registry kinds
2026-12-01 18:02:29 +01:00
Cato 7019f55f04 Start sourced dependency research from profiles and chains (#419) 2026-12-01 17:16:55 +01:00
Cato ada0b68888 Make market access and Greenland resources actionable (#420) 2026-12-01 16:36:28 +01:00
CatoandClaude b46062cd37 fix(market-data): keep EDGAR snapshots in memory only when the database write fails (#415)
writeSnapshot put every fundamentals and holders snapshot into a
module-level Map before writing it to research_market_snapshots, and
never dropped it. Every company the nightly /api/cron/prices facts
run refreshed stayed in the app heap until the next restart: about
0.1 MB a company, measured against live SEC data, across 506 tracked
SEC filers. The app unit is throttled at MemoryHigh=768M (killed at
1G), and the substrata crons have failed starting with the 22:07 UTC
prices run on 2026-11-20 and 2026-11-21.

The module's own comment says the in-process copy stands in where
there is no database. It now does only that: set when the row cannot
be written, dropped when it is.

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 21:31:52 +01:00
CatoandClaude 8338520d89 fix(prices): read proxy statements without a DOM so the daily run cannot stall the site (#416)
* fix(prices): read proxy statements without a DOM so the daily run cannot stall the site

appcron-substrata-prices timed out (curl exit 28, 0 bytes in 300s) although
the route stops starting work at 200s, and on 2026-11-24 the whole site
stopped answering during the 22:07 UTC run. Cause: the facts half parsed each
company's multi-MB DEF 14A with linkedom + Readability. V8 sizes its heap from
the box's RAM, not the unit's MemoryMax, so that garbage was not collected:
measured over the first 40 SEC filers, RSS climbed 334 MB -> 1107 MB before a
major GC, past the app unit's MemoryHigh=768M, where the kernel throttles the
whole process.

The proxy table is read by pattern, so it needs text, not an article: strip
tags in a few linear passes (lib/sources/html-text.ts). Same 40 companies:
peak RSS 383 MB, heap 75-145 MB; identical parsed rows on all 30 proxies
compared; parse 1.6 s against 30 s.

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

* docs(readme): PRs merge through forge/verify, not the removed auto-merge workflow

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 20:26:37 +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 e7654a9b16 fix(prices): read EDGAR fundamentals and holders one at a time (#412)
The daily /api/cron/prices run read each company's company-facts JSON
(up to 16 MB, parsed whole) and its proxy statement (multi-MB HTML parsed
into a DOM by Readability/linkedom) concurrently. Together they can push
the Next process past the app unit's MemoryMax=1G; the kernel kills it
mid-request and the appcron curl gets an empty reply (exit 52).

Sequential reads halve the per-company peak. Holders is skipped (counted
as failed, picked up next day) when the company's time budget is spent.

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-20 04:07:14 +01:00
CatoandClaude 5462424450 fix(chat): search for what a news question is about, not how it asks (#388)
"Latest news on gallium export controls" was searched as written plus the
year, and Wikipedia answered with the Patriot missile (seen on production,
2026-11-12). The news frame ("latest news on", "the latest on", "any
recent updates about") is dropped; route.ts still turns "now" into the
month and year.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:55:43 +01:00
CatoandClaude d21065941f feat(research): search through ai-kit's keyless fallback when the box's backends fail (#386)
* feat(research): search through ai-kit's keyless fallback when the box's backends fail

Since 2026-11-11 the box's SearXNG has not answered and there is no paid
key, so the Ask assistant, the event sweep and producer sourcing could not
look anything up. Every web search now walks the configured backends and
then ai-kit's keyless ones (GDELT news, then Wikipedia), from one place:
lib/web-search.ts. Whether looking up is offered still follows the
configured backends (webLookupEnabled, now ai-kit's own defaultProviders),
so a deployment or a test with none makes no request.

Needs @bitbaum/ai-kit 1.25.0 (the dependency bump follows).

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

* fix(health): the web probe walks the same chain as Ask, behind the same gate

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

* chore(deps): @bitbaum/ai-kit ^1.25.0 (keyless search fallback)

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

* test(web-search): type the test env the way next build checks it

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:07:33 +01:00
Cato 79989d9608 feat(seo): add robots.ts and sitemap.ts (#385) 2026-11-12 09:18:02 +01:00
CatoandClaude 2f465e24e3 refactor(charts): draw severity, quality trend and output shares with chartkit (#383)
* refactor(charts): draw severity, quality trend and output shares with chartkit

Three charts were still drawn by hand in this app while @bitbaum/chartkit
already ships them, against the packages-first rule (every chart is
chartkit, so a fix made once reaches every product):

- SeverityBar (components/portal/Status.tsx) now draws its 0-12 bar with
  chartkit's Meter (showValue off: the number beside it still opens the
  severity method). The bar gains a meter role with its value and max.
- The quality run-history Trend (components/quality/Trend.tsx) is
  chartkit's LineChart: axis from 80% (or lower) to 100%, dated ticks,
  every run's value on hover/focus and in the hidden table. The caption
  keeps the old accessible sentence. The hand-drawn SVG's CSS is removed
  from app/styles/quality.css.
- Per-country share-of-world-output bars in the quantities profile
  module are chartkit Meters (neutral tone, stretched to the row in
  app/styles/places.css), with the same "per cent of the published world
  total" label.

package-plan.json binds the three files under the charts block.

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

* fix(quality): the trend draws each day's latest run

The quality run fires every six hours and chartkit places a point by its
date, so four runs a day stacked on one x. The trend now keeps one point
per day, that day's latest run, and its caption says so.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:59:17 +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 fc26f09019 refactor(lists): directory, series index and careers search through listkit (#379)
The company directory, the data series index and the careers SQL search
each hand-rolled what listkit already ships: facet parsing and validation,
facet counts with the facet's own selection lifted, a "show more" URL rebuilt
from scratch, and a LIKE escape. The package rule says use the package.

- lib/universe/directory.ts: the four filters are a ListSpec (directorySpec);
  parseQuery validates them, applyQuery filters, counts and draws the rows.
  Typed words stay with searchkit (textFilter), so a slip is still forgiven.
- app/data/series/page.tsx: bottleneck, measure and origin are a ListSpec;
  applyQuery and matches replace the hand-written predicate and slice.
- lib/list-more.ts: "Show more" keeps the ?n= URLs and writes the next one
  with writeQuery over the reader's params (empty and invalid values dropped).
- lib/careers-query.ts: title search uses likeContains instead of a local
  escape.

Same rows for the same URLs: 1890 directory filter combinations compared
old against new, identical rows, matched counts and facet counts. Tests pin
the spec, the ?n= paging and that a comma in typed words is not a list.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:26:30 +01:00
CatoandClaude f55c127901 feat(research): runs record what their search backends did, and /api/health/web says it now (#376)
* feat(research): runs record what their search backends did, and /api/health/web says it now

The event sweep and producer sourcing failed for a day on production with
nothing on /data/freshness but "no search reached a search backend".

- Each sweep and sourcing run records its search backends' outcome in
  ai-kit's own words (search_note, e.g. "searxng unreachable"); migration
  018 adds the column. /data/freshness shows it beside a failing run.
- /api/health/web searches once for a fixed phrase and reports which
  backends are configured (names only) and what each did. One probe per
  ten minutes, shared by concurrent callers.
- docs/operations/auto-updates.md: what runs, when, what it needs, where
  it leaves a trace, and what to do when a run is failing.

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

* fix(data-layer): read double-quoted identifiers in migrations

declaredObjects read `CREATE TABLE IF NOT EXISTS "users"` as a table named
"if", so 017-accounts.sql looked incomplete on any database that predates
the ledger: it would be re-run, and the ownership hand-over would miss its
real tables. CI's real-Postgres test caught it once 017 stopped being the
newest file ("must be owner of table accounts").

Tables, indexes, ALTER TABLE targets and added columns may now be quoted.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:16:31 +01:00
Cato 83c5573091 feat(seo): add opengraph image generator and twitter card metadata (#378) 2026-11-12 07:57:25 +01:00
Cato a46565435a fix(shell): hide mobile tab bar on auth pages (#377) 2026-11-12 07:32:53 +01:00
Cato 250f186ff6 fix(nav): make /portal and /desk permanent 308 redirects to /account (#375) 2026-11-12 07:00:22 +01:00
CatoandClaude 121a7e89b6 feat(freshness): a failing feed says why (#373)
/data/freshness and /api/health/freshness reported the research sweep and
producer sourcing as "Failing" with no reason (seen on production). The
rule that marks a run failed was SQL only.

Each feed now states that rule in words (failedMeans), and the report
shows it beside a failing feed. A last failed run that never finished is
told apart from one that ran and achieved nothing. The query is tested
against a real Postgres.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:23:41 +01:00
CatoandClaude fa73bb626b fix(chat): the reader is told when the web search brought nothing back (#372)
Seen on production: every question showed "Searching the web for …" in
its steps and then an answer with no web page and no word about it. The
search outcome was known to the prompt only, so saying it was left to
the model, which did not.

The outcome of the answer's web searches (found, nothing, or could not
be reached) is now recorded by the search itself and carried on the
answer. When no page came back, a line under the answer says which of
the two it was. An outage is never told as "found nothing".

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:15:56 +01:00
CatoandClaude 94527fb45d fix(chat): a source link is not attached inside another link's title (#371)
A lead whose title holds a "?" ("Is There a Helium Shortage in 2026?
Why It Happened…") was split there as a sentence end, and the row's
link was attached inside the title: the reader got a link nested in a
link (seen on production).

The citation pass now splits through sentencesIn, like every other pass
that rewrites an answer, so a link stays whole; and a sentence already
linked to the row's page is not linked to it again.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:55:48 +01:00
CatoandClaude 8652906b26 fix(chat): a database outage no longer answers every question "temporarily unavailable" (#370)
Seen on production: the box's Postgres refused connections ("too many
clients already") and /api/chat returned 503 for every question. The
only hard dependency was the request throttle, whose counter is a table.

When that table cannot be reached, the same fixed window is now counted
in the process, so the limit still holds and the answer is still given.
The map is bounded. Every other caller of the throttle gets the same
fallback.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:48:20 +01:00
CatoandClaude b8f3917674 fix(chat): the answer tidy no longer takes a link's own bracket (#368)
When default deny cut the sentence that closed a bracket, the tidy pass
removed the last "(" on the line. That was often a markdown link's
"](", so the reader got "[label]https://…" as raw text (seen on
production). The pass now removes the "(" that has no ")", and leaves
a link's bracket alone.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:19:53 +01:00
CatoandClaude 84016195dc fix(chat): search the web for the question's subject, not the words said to the assistant (#367)
Seen on production: "What changed for helium supply in the last month?
Use the web too." was sent to the engine as
`changed for helium supply in the last month? Use the web too` and the
search came back empty, so the answer carried no web pages.

- Words addressed to the assistant ("use the web too", "search online",
  "cite your sources", "please") are removed from the query.
- Every "?" and "!" is removed, not only a trailing one.
- "in the last month", "over the past few weeks" become the month and
  year they mean, as "this month" already did.
- The query builder moves to lib/chat-agent/web-query.ts (plan.ts was at
  its line ceiling).

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:13:54 +01:00
CatoandClaude 0b6ec077a3 fix(nav): /portal reaches the desk, and the desk is linked for every reader (#366)
/portal returned 404. The member portal is the desk at /account, so
/portal, /portal/* and /desk now redirect there (temporary, so a portal
page of its own can take the address back).

The top bar's Desk link and the palette's Desk row were shown only to a
signed-in reader, so nobody without a session could find it. Signed out,
/account already says what the desk is and offers sign-in; both now show
for everyone.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:05:07 +01:00
Cato 8841808ab2 fix(freshness): return 200 on /api/health/freshness to prevent page footer 503s (#365)
- Respond with HTTP 200 from GET /api/health/freshness while preserving the ok: false payload when feeds or datasets need attention
- Prevent footer FreshnessBadge from triggering 503 Service Unavailable network errors during page browsing
- Update README documentation for /api/health/freshness
- Add automated test in test/freshness.test.ts verifying GET /api/health/freshness returns 200 with the full report
2026-11-11 23:18:38 +01:00
Cato bbda0ad2d1 fix(prices): enforce runtime budget and forward abort signals across requests (#364)
- Add timeout signals for PRICES_RUN_BUDGET_MS and PRICES_PORTION_MS in POST /api/cron/prices

- Propagate per-ticker and per-company timeout signals in fetchAllPrices and refreshMarketFacts

- Check abort signal in gatherHolders, fetchPrices, and openWebFetch

- Use abort-aware sleep in sourceFetch pacing and 429 retry waits

- Add automated tests in test/market-prices.test.ts verifying timeout signals and signal checks
2026-11-10 23:41:50 +01:00
CatoandClaude 0f1ee65825 chore(deps): threadkit from the @bitbaum scope (canary bootstrap) (#362)
substrata is the designated canary for threadkit; the fleet's rollout gate holds
every adopter until the canary has adopted a new package name. Same code and
version, now published as @bitbaum/threadkit 0.1.1.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 10:45:49 +01:00
Cato 89ec6e32c0 fix(sweep): bound web search and page reads to remaining budget and forward abort signal (#359)
- Calculate remainingMs in runScheduledSweep and do not start new nodes when remaining budget is under 10s

- Forward remaining budget as timeoutMs to sweepAndStore and sweep, bounding individual search and page fetch timeouts

- Forward abort signal into custom fetch to cancel active HTTP requests immediately on abort

- Split URL and title filter regexes into lib/sweep-filter.ts to respect 300-line ceiling

- Add tests in test/sweep.test.ts verifying budget bounding and signal checks
2026-11-10 01:47:57 +01:00
Cato f8a808d1df fix(prices): enforce runtime budget and forward request abort signal (#345)
- Define PRICES_RUN_BUDGET_MS (200s) and PRICES_PORTION_MS (140s) to keep daily price and fact runs well within the 300s curl timeout of the systemd wrapper
- Forward request.signal from POST /api/cron/prices to fetchAllPrices, refreshMarketFacts, and sourceFetch
- Bound individual fetch timeouts to remaining budget and abort promptly when signal is aborted
- Ensure research_price_runs and research_market_fact_runs always record completion (finished_at = now()) on early exit
- Add automated test in test/market-prices.test.ts verifying runtime budget enforcement and signal forwarding
2026-11-05 23:47:26 +01:00
Cato c4ff397e66 fix(auto-updates): enforce runtime budget and forward request abort signal (#344)
- Export AUTO_UPDATES_RUN_BUDGET_MS (200s) to keep hourly auto-updates well within the 300s curl timeout of the systemd wrapper
- Forward request.signal from POST /api/cron/auto-updates to runAutoUpdates
- Pass signal and budget bounds down through draftLeads and byokAsk to ai-kit complete
- Stop starting new leads and abort in-flight requests when the budget expires or signal is aborted
- Bound per-request page reads to remaining budget
- Add automated test in test/update-now.test.ts verifying runtime budget enforcement and signal forwarding
2026-11-05 21:02:53 +01:00
Cato 5e76bf2637 fix(jobs): enforce runtime budget and forward request abort signal (#343)
- Define JOBS_RUN_BUDGET_MS (200s) to keep daily job board fetches well within the 300s curl timeout of the systemd wrapper
- Forward request.signal from POST /api/cron/jobs to fetchJobs
- Stop starting new board requests and job upserts when the budget expires or signal is aborted
- Bound per-request fetch timeouts to remaining budget
- Ensure research_job_runs always records completion (finished_at = now()) on early exit
- Add automated test in test/careers.test.ts verifying runtime budget enforcement and signal forwarding
2026-11-05 20:51:47 +01:00
Cato bf6f529f6b fix(sweep): enforce runtime budget and read candidate pages in parallel (#342)
- Read candidate pages concurrently with Promise.all in lib/sweep.ts rather than awaiting each serially, bounding page reading time per node
- Add SWEEP_RUN_BUDGET_MS (200s) and budget/signal checking to runScheduledSweep in lib/sweep-store.ts so scheduled runs finish well within the 300s box curl timeout
- Pass request.signal from POST /api/cron/sweep to runScheduledSweep
- Add automated tests in test/sweep.test.ts verifying budget enforcement and concurrent candidate reads
2026-11-05 20:43: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
Cato 373c0c8d48 fix(source): enforce runtime budget and read candidate pages in parallel (#340)
- Read candidate pages concurrently with Promise.all in lib/source.ts rather than awaiting each serially, bounding page reading time per row
- Define SOURCE_RUN_BUDGET_MS (200s) and budget/signal checking to runScheduledSourcing in lib/source-store.ts so scheduled runs finish well within the 300s box curl timeout
- Pass request.signal from POST /api/cron/source to runScheduledSourcing
- Add automated tests in test/source.test.ts verifying budget enforcement and concurrent candidate reads
2026-11-05 20:06:58 +01:00
Cato 0d16ac0026 fix(science): enforce runtime budget and forward request abort signal (#339)
- Define SCIENCE_RUN_BUDGET_MS (200s) to keep hourly science feed fetches well within the 300s curl timeout of the systemd wrapper
- Forward request.signal from POST /api/cron/science to fetchScience
- Stop starting bottleneck queries and source fetches when the budget expires or signal is aborted
- Bound per-request fetch timeouts to remaining budget and abort immediately on signal
- Ensure research_science_runs always records completion (finished_at = now()) on early exit
- Add automated test verifying runtime budget enforcement and signal forwarding
2026-11-05 20:06:13 +01:00
Cato b135dcb278 fix(filings): enforce runtime budget and forward request abort signal (#338)
- Define FILINGS_RUN_BUDGET_MS (200s) to keep hourly EDGAR fetches well within the 300s curl timeout of the systemd wrapper
- Forward request.signal from POST /api/cron/filings to fetchFilings
- Stop starting feed and registrant requests when the budget expires or signal is aborted
- Bound per-request fetch timeouts to the remaining budget so individual requests do not overrun
- Ensure research_filing_runs always records completion (finished_at = now()) on early exit
- Add automated test verifying runtime budget enforcement and signal forwarding
2026-11-05 19:44:23 +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
CatoandClaude 19ffeaff74 fix(auth): a session read that hangs cannot take the site down (#298)
On 2026-10-30 every Substrata page answered 502 after 23 seconds for hours
while /api/health still answered 200: session reads hung (get-session took
251 s) and every page waits for one. A restart cleared it; the cause was not
visible from outside the box.

- currentSession() gives up after 4 s and answers "signed out", logged, so a
  public page always renders.
- Accounts read from their own small pool, so a session read never queues
  behind long research queries for one of the five shared connections, and
  the server cancels any account query after 5 s instead of letting it hold
  its connection forever.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 10:00:49 +01:00
CatoandClaude Opus 5.5 c5d7c99d77 feat(auth): Substrata accounts on @bitbaum/accountkit, not only OrangeCat (#294)
* feat(auth): Substrata accounts on @bitbaum/accountkit, not only OrangeCat

Readers can create an account with an email and a password or a passkey,
and turn on two-step codes. Continue with OrangeCat stays one way in.
next-auth and lib/identity.ts are gone; /api/auth serves AccountKit's
runtime, and /sign-in, /sign-up and the account panel in
/account/settings are its shared screens in Substrata's look.

Desks, follows, saved AI keys and SUBSTRATA_REVIEWER_ACTOR_IDS stay keyed on
the OrangeCat actor id: legacyIdentityProvider keeps it for anyone whose
first way in was OrangeCat. The six account tables are
scripts/db/017-accounts.sql, additive and re-runnable, applied by the deploy.

Rebuilds the stale draft #184 on current main.

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

* test(data-layer): the pre-ledger case names the newest migration, not 016

Adding 017-accounts.sql made the test treat 016 as one of the files that
predate the ledger; it now asks for whatever file is newest.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-29 11:57:03 +01:00
Cato 9494aef7c8 fix(registry): compare migration evidence on its recorded date (#284) 2026-10-28 08:18:46 +01:00
CatoandClaude Sonnet 5.5 ad9fb7932c feat(deploy): the deploy applies migrations, installs timers, runs the price backfill once (#276)
* feat(deploy): the deploy applies migrations, installs timers and runs the one-time price backfill

Before the release goes live, deploy.yml now applies pending scripts/db/*.sql
(one transaction each, recorded in public.schema_migrations, first run checks
existing objects before baselining) and installs deploy/systemd units. A failure
stops the deploy with the live release untouched. After the release, the price
backfill runs once and is recorded in public.schema_oneshots.

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

* docs: name no migration file that does not exist

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 23:22:53 +01:00
CatoandClaude Opus 5.5 f4ee258bc8 refactor(ask): chatkit 0.19 — send handle, initial message, Retry keeps pictures; three answer fixes (#264)
* refactor(ask): chatkit 0.19 — send handle and initial message, thrown turn failures

Delete lib/chat/drive-composer.ts and useAutoAsk.ts, which typed into
chatkit's composer and pressed Send. /chat?q= is ChatApp's deepLinkParam
(sent at once, as before), the home box's ?send= handoff is its
initialMessage, and "Check this" goes through the ref's send with
newChat. The transport throws ChatTurnError instead of returning a failed
message, so the bubble keeps the server's words and Retry re-sends the
pictures.

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

* fix(ask): an attributed claim is Reported when the source only shows it was said

"Confirmed" over "Gartner estimates a $4.9T gap [W2]" told the reader
the gap was real when the page showed only that Gartner said so. The
writer is told the difference, and code downgrades an attributed
claim's Confirmed to Reported when its source line names the speaker or
reports a saying. Partly and Not found are unchanged.

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

* fix(ask): never cut a markdown link in two when dropping sentences

A link whose title held a full stop was split at it; when a guard dropped
the first half the reader saw "…IaaS… ](https://x.com/…))" in the
Reasoning. withoutMaterialFigures, withoutSentencesHolding and
uncitedForecasts split with a bare regex; default-deny masked links
itself. All four now split through lib/chat-agent/sentences.ts, which
masks links (URLs with one level of parentheses included) while
splitting.

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

* fix(ask): a web chip only on a sentence its page supports

The opening of a screenshot answer ended its generic analysis in [W1],
drawn as a finance.yahoo.com chip, and the page (a stock quote) said
nothing of the kind. Before default deny, a [W#] now stays only on a
sentence that carries a figure the cited passage prints or a name it
gives; otherwise the marker comes off and the sentence is judged as
uncited.

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

* fix(ask): the panel's chat list is a drawer at every width

ChatApp's rail follows the window (64rem), so in the ~30rem panel on a
desktop the list took half the panel and left the answer a 12rem column.
The panel passes railQuery="not all"; /chat keeps the rail.

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

* docs(changelog): the answer fixes and the panel's chat list

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>
2026-10-27 21:44:15 +01:00
CatoandClaude Sonnet 5.5 406a080e13 Registry seed: 443 labs, robotics and supply-chain companies; chat tools read the registry (#277)
* feat(registry): seed labs, robotics, supply chain and frontier areas; chat tools read the registry

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

* feat(registry): seed 443 labs, robotics, supply-chain and frontier companies; company:refresh; chat tools read the registry

Each new entry has what it is (Wikipedia lead sentence, quoted), identity from
Wikidata (HQ, country, ticker, CIK, LEI, website) and a gap list. Wikidata items
with several headquarters leave the field a gap. 115 migrated companies gain a
cited description through their own Wikidata English sitelink.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 21:07:46 +01:00
CatoandClaude dd88dbefce feat(registry): the frontier registry, the add command, areas, and the migration of the 793 admitted companies (#275)
One JSON file per company in registry/companies, one per area in registry/areas,
validated on load (no cite, no value). The registry is the list; the old filter
is a proposer. The 793 admitted companies are migrated with identical output.
pnpm run company:add resolves identity from Wikipedia and Wikidata. /areas and
/areas/[slug] are new.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 19:39:10 +01:00
CatoandClaude Sonnet 5.5 f172a773f6 feat(markets): a directory of every company in the universe, and an honest count of what each page can show (#272)
* feat(markets): a directory of every company in the universe, and an honest count of what each page can show

/markets/directory filters the universe by theme, country, tier and page kind
and searches by name, ticker or theme through searchkit; one column of rows on
a phone, sixty at a time. /data/companies now counts what each page can show
(quote and SEC filings, quote only, identity only) from identifiers alone, and
lists every company considered and out with the test it failed.

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

* fix(markets): the directory's Show more is a 44px target

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 16:02:02 +01:00
CatoandClaude d6185e5bd5 feat(universe): defence theme, 22 fund files, 20 SEC codes, and revenue for filers with no float (#269)
The first wave admitted 594 companies from 731 candidates. This wave reads
22 issuer holdings files (was 14) and 20 SEC industry codes (was 6), adds the
twelfth theme (defence & aerospace) and lets a 20-F or 40-F filer, which
states no 10-K cover float, clear the revenue floor on its own tagged annual
revenue in US dollars (no rate is ever invented).

793 admitted (tier A 133, tier B 660) from 1,013 candidates; 220 considered
and not admitted. Funds read and dropped because their subject is not a
theme (KOMP, XME, PAVE, HYDR, CTEC, RNRG, QCLN, FAN) are named in the ADR.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 15:57:03 +01:00