Files
substrata/scripts/db/018-search-notes.sql
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

13 lines
618 B
PL/PgSQL

BEGIN;
-- What the search backends did in a run, in ai-kit's one line
-- ("searxng unreachable; brave 6"). A run that "could not look" said so as a
-- count; this says which backend failed and how, so /data/freshness can name
-- the cause instead of leaving an operator to guess (2026-11-12: the sweep and
-- producer sourcing failed for a day with nothing but "Failing" to go on).
-- Additive and re-runnable: the release still serving ignores the column.
ALTER TABLE research_sweep_runs ADD COLUMN IF NOT EXISTS search_note text;
ALTER TABLE research_source_runs ADD COLUMN IF NOT EXISTS search_note text;
COMMIT;