feat: platform backbone and field capture complete (checkpoint)

Platform backbone (plan 2026-10-13-plattform-rueckgrat), all tasks reviewed:
- webhooks with delivery table, retries and stable delivery id
- calendar handlers; a finished task removes its Outlook event
- tasks, automations, inspections, varroa, treatments, feedings,
  harvests, colonies, wintering, stock and bottling record domain events
  in the same transaction; legacy post-commit calls removed
- row locks through one helper (lockRowForUpdate, lockRowsForShare,
  lockRowsForUpdate)
- job framework with JobRun, cli exit codes, cleanup, task templates,
  daily evaluation, hourly app-backup and the rekey job
- system API and page "Verwaltung > System" with retry
- @nestjs/schedule removed, guard tests against in-process schedulers

Field capture T3 (plan 2026-10-13-t3-erfassung-am-stand), all tasks reviewed:
- inspection photo offline without metadata
- bulk capture for treatments, feedings and varroa (backend + frontend)
- offline stand mode with service worker, offline pages and packs
- offline session, cold start and logout on shared devices

Docs: ARCHITECTURE.md assumptions and sections updated, TASKS.md.
Gates: backend lint, typecheck, 1770 unit, 420 e2e, build, no schema
drift; frontend lint, typecheck, 913 tests, build. Not rolled out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-14 11:36:38 +02:00
1 parent c01a38835a
commit cdd30cf3ee
288 files changed
+39165 -2853

No files matched your search

@@ -15,6 +15,7 @@ import type { DomainEventEnvelope } from '../src/domain-events/domain-event-type
import { DomainEventsService } from '../src/domain-events/domain-events.service';
import { OnDomainEvent } from '../src/domain-events/on-domain-event.decorator';
import { PrismaService } from '../src/prisma/prisma.service';
import { WebhookDeliveryWorker } from '../src/webhooks/webhook-delivery.worker';
import { WorkerModule } from '../src/worker/worker.module';
import { DOMAIN_EVENT_POLL_MS } from '../src/worker/worker-runtime.service';
@@ -127,6 +128,7 @@ describe('Worker runtime (e2e)', () => {
let worker: TestingModule;
let prisma: PrismaService;
let processOutbox: jest.SpyInstance;
let deliverWebhooks: jest.SpyInstance;
let healthPort: number;
async function recordTaskDueInTx(): Promise<void> {
@@ -164,6 +166,13 @@ describe('Worker runtime (e2e)', () => {
processOutbox = jest
.spyOn(worker.get(CalendarSyncService), 'processOutbox')
.mockResolvedValue(undefined);
// Likewise the webhook loop (webhooks.e2e-spec.ts covers delivery): an
// unfiltered drain here would send the deliveries of parallel e2e files.
const webhookDeliveries = worker.get(WebhookDeliveryWorker);
deliverWebhooks = jest
.spyOn(webhookDeliveries, 'drain')
.mockResolvedValue(0);
jest.spyOn(webhookDeliveries, 'releaseStaleClaims').mockResolvedValue(0);
await worker.init();
// The first ticks run right after bootstrap; wait for the dispatcher's.
const dispatcher = worker.get(DomainEventDispatcher);
@@ -210,6 +219,19 @@ describe('Worker runtime (e2e)', () => {
);
});
it('wakes the webhook delivery loop on a webhook_delivery notification', async () => {
expect(deliverWebhooks).toHaveBeenCalled();
const before = deliverWebhooks.mock.calls.length;
await notifyWorker(prisma, WAKE_CHANNELS.webhookDeliveries);
await expectWithin(
WAKE_UP_WITHIN_MS,
() => deliverWebhooks.mock.calls.length > before,
true,
);
});
it('answers GET /health with 200 {"status":"ok"}', async () => {
await expect(getJson(healthPort, '/health')).resolves.toEqual({
status: 200,