vikingowl afe9d916d6 feat(discovery): manual crawl-enrich-all button + payload display
Replaces the originally-planned async-worker design with operator-
triggered bulk runs (see memory/project_ship2_enrichment.md). Crawl-
enrichment is cheap enough to always run against the whole list but
runs only when the admin clicks — the flow stays predictable and the
crawl itself stays fast.

Endpoints
- POST /admin/discovery/enrichment/crawl-all — 202 + goroutine, mirrors
  the crawl pattern. Per-process CAS gate prevents concurrent runs.
- GET  /admin/discovery/enrichment/crawl-all-status — polled shape
  identical to /crawl-status for UI reuse.

Service RunCrawlEnrichAll iterates enrichment_status='pending' rows,
builds an enrich.Input from each, runs CrawlEnrich (consolidation +
Nominatim geocoding via the shared geocoder), and persists via
SetEnrichment(status=done). Per-row errors count toward Failed and
append to a bounded Errors slice; the pass never halts.

Enrich package refactor
- Enrichment, Sources, Provenance constants moved from discovery ->
  enrich (they are the enrich package's own types; discovery previously
  held them for historical reasons).
- CrawlEnrich now takes a narrow enrich.Input / enrich.Contribution so
  the enrich package no longer imports the parent discovery package.
  This breaks the import cycle that appeared once discovery needed to
  call enrich (the MR 2 structure only worked because no caller went
  in that direction yet).
- LLMEnricher takes an LLMRequest (primitives) instead of a
  DiscoveredMarket. NoopLLMEnricher updated; real Mistral impl lands
  in MR 3b.
- CacheKey signature switched from (DiscoveredMarket) to primitive
  (nameNormalized, stadt, year).

Service geocoder wiring: discovery.NewService gains a Geocoder param
(routes.go passes the shared Nominatim client; the interface lives in
discovery to avoid another circular edge with enrich).

UI: "Run crawl-enrich" button next to "Run crawl"; identical poll +
summary card pattern. Queue row expand shows enrichment status badge
plus the PLZ/Venue/Organizer/Lat-Lng fields inline with per-field
provenance tag.

Tests: three new service tests (happy path, per-row SetEnrichment
failure, empty-queue no-op). Existing enrich package tests updated
for the primitive input signature. All 13 test NewService call-sites
updated for the new geocoder param.
2026-04-24 10:29:58 +02:00
2026-02-21 07:10:30 +01:00
Description
No description provided
1.7 MiB
Languages
Go 60.3%
Svelte 20.3%
Dart 11.1%
TypeScript 5%
PLpgSQL 1.1%
Other 2.1%