feat: T4 waves 1-2 - rule configs, schema, suggestions core, season, rule forms

- Rule configs with typed parsers and registry; Berlin day helpers
- Schema: T4 enums, Suggestion table, feed vocabulary (feedStatus as
  ColonyCondition with legacy text mapping), split queen source,
  varroa sample size; migration harness for data migrations
- SuggestionsService: propose/refresh/resolve/obsolete/expire,
  accept/dismiss/reopen incl. bulk, lock order, concurrency e2e
- SeasonService: phenology-based segments, inspection/varroa due dates,
  queen age; TimeEventsStep with JobPartialFailure
- Frontend: per-rule settings forms with visible value sources

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 13:42:32 +02:00
1 parent 7097fcd97c
commit d99a697739
116 files changed
+11239 -801

No files matched your search

@@ -0,0 +1,73 @@
import { DEFAULT_INSPECTION_INTERVAL_CONFIG } from '../automation/rule-config/inspection-interval.config';
import { inspectionDueOn } from './inspection-due';
const CONFIG = DEFAULT_INSPECTION_INTERVAL_CONFIG;
const SCHWARMZEIT = {
segment: 'SCHWARMZEIT',
springSince: '2026-03-20',
} as const;
describe('inspectionDueOn', () => {
it('adds the interval of the current segment to the last inspection', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-06-01', lastInspectedOn: '2026-05-05' },
SCHWARMZEIT,
CONFIG,
),
).toEqual({ dueOn: '2026-05-12', firstOfYear: false, intervalDays: 7 }));
it('uses the interval of SOMMER in SOMMER', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-06-01', lastInspectedOn: '2026-06-25' },
{ segment: 'SOMMER', springSince: '2026-03-20' },
CONFIG,
),
).toEqual({ dueOn: '2026-07-09', firstOfYear: false, intervalDays: 14 }));
it('returns null in WINTERRUHE', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-06-01', lastInspectedOn: '2025-10-01' },
{ segment: 'WINTERRUHE', springSince: null },
CONFIG,
),
).toBeNull());
it('counts from createdAt without any inspection', () =>
expect(
inspectionDueOn(
{ createdOn: '2026-04-20', lastInspectedOn: null },
SCHWARMZEIT,
CONFIG,
),
).toEqual({ dueOn: '2026-04-27', firstOfYear: false, intervalDays: 7 }));
it('is due from the start of FRUEHJAHR when the last inspection was before it (first of the year)', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-06-01', lastInspectedOn: '2025-10-30' },
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
CONFIG,
),
).toEqual({ dueOn: '2026-03-20', firstOfYear: true, intervalDays: 14 }));
it('a colony created before the spring without an inspection is first-of-year due too', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-09-01', lastInspectedOn: null },
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
CONFIG,
),
).toMatchObject({ dueOn: '2026-03-20', firstOfYear: true }));
it('an inspection on the first day of FRUEHJAHR counts as done', () =>
expect(
inspectionDueOn(
{ createdOn: '2025-06-01', lastInspectedOn: '2026-03-20' },
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
CONFIG,
),
).toEqual({ dueOn: '2026-04-03', firstOfYear: false, intervalDays: 14 }));
});