Bits
engine.resolve — What the sources say becomes events
- Trigger: the end of every
pnpm enginerun;pnpm engine --resolveruns it alone (on a schedule once deployed, spec 0004). - Who: the engine.
- Path:
apps/api/src/engine.ts→events/engine/resolve.ts(orchestration and writes) →events/engine/match.ts(names, dates, verdicts) → PostgreSQL. - Data: reads every source's latest version of each entry (
sightings),events,series,places,hosts; writesevent_sightings,events,series,changesandreviews. - Rules:
- Same event when the dates fit (same days, overlapping, within three days, or the month an expected event usually happens) and the names agree (acronyms, years and filler ignored), or the same host runs it. Next year's edition is never the same event.
- Not sure ("maybe") → a
mergereview for the crew; nothing is created until they decide. - New events: published at once when they come from the organiser's own site; otherwise they wait for the crew (
new-eventreview) until a second, independent source agrees. - Changes (dates, cancellation, fee, entry link) are applied when the source speaks for the organiser (the host's own site, a sanctioning body) or is the event's only source; otherwise a
changereview. Every applied change is a row inchanges(the page's history and the source of alerts). - Past announced or confirmed events become
held; each series whose last edition is over gets next year's edition asexpected("Usually November"). - Confidence: each independent source adds its weight (organiser 0.9, sanctioning body 0.85, aggregator 0.6, community 0.4).
- Errors: one entry failing is reported and skipped; the run goes on.
- Test:
apps/api/src/events/engine/match.test.ts(same event or not: names, dates, next year's edition, confidence);apps/api/src/events/engine/resolve.test.ts(what the organiser's page changes, read from the saved AMPS pages: dates, an expected edition becoming confirmed or announced, cancellations and who can undo them, fees, a held event untouched). Not covered:resolve()itself (linking, reviews, held, next editions), which needs a database. - Observe: the
resolve:lines printed bypnpm engine. - Status: verified — 2026-11-18 (unit tests on saved pages)