Skip to content

arch(domain): split the Incident aggregate and move German ETB wording and presentation types out of Domain #299

Open

Description

@DeepDiver1975

From the 2026-09-09 architecture review of main (35d86e1). Not urgent; a direction for when the next feature lands in Incident.

Incident (src/LageBuch.Domain/Incident.cs) is 1 112 lines with about 45 public members across ten feature areas, a 22-parameter Rehydrate (:122) that mirrors the SQLite table set, and it composes German ETB text inside the aggregate (Label :615, StatusChangeText :666, and every AppendSystemEntry literal such as "Einsatz begonnen"). Exception messages are end-user German too (:86, :643). Formatting.cs (de-DE date formats, em-dash placeholder) and IncidentPdfSections.cs (PDF section flags) are presentation concerns living in Domain.

The domain is otherwise exemplary: zero references, private setters, IReadOnlyList everywhere, invariants via EnsureOpen.

Proposal

  • Split Incident into partial classes per feature area (Forces, Scba, CoMeasurement, Tasks, Files, Journal) with the shared guards in the core file; or extract sub-aggregates where the feature has its own invariants (CO measurement is a good first candidate).
  • Route system-entry wording through a small ISystemEntryText (or resource) so wording and locale are not Domain changes.
  • Replace the 22-parameter Rehydrate with a IncidentSnapshot-style record that both the repository and SnapshotMapper build.
  • Move Formatting and IncidentPdfSections to Documents/AppLogic once the Android build graph allows (the comment in IncidentPdfSections.cs explains why they are parked in Domain).

Activity

  1. DeepDiver1975 commented on Sep 18, 2026

    @DeepDiver1975
    ContributorAuthor

    From the portability review in #405 — two things that support the "move German ETB wording out of Domain" half of this issue.

    1. The wording is persisted, not displayed. The AppendSystemEntry literals land in etb_entries.text and stay in every .fwincident file. That makes ISystemEntryText more than a tidiness measure: a text hook still renders at write time, so files stay German. If the goal is that locale is not a Domain concern, the journal has to store a structured event (kind + parameters) and render at read time. I have put the fuller argument on #350 since that issue owns the decision this one defers to.

    Worth noting $"Checkliste {kind} abgeschlossen…" (:314) interpolates the ChecklistKind enum member name straight into persisted text — renaming the enum changes file content silently.

    2. Formatting is more coupled than the de-DE date. Beyond the culture at :9, Formatting.Level returns "Hoch"/"Mittel"/"Niedrig" and Direction returns "Eingang"/"Ausgang"/"Intern"/"System" — both called from Domain and Documents and the view models. And ForceUnit.StrengthText (:26) is itself presentation living on the aggregate:

    public string StrengthText => $"{ZugfuehrerCount}/{OfficerCount}/{MannschaftCount}/{PersonnelCount}";

    It is interpolated into persisted ETB text at :564 and :655. If Formatting moves out of Domain, StrengthText should go with it as a formatter over the four integers, not travel along as a property. The four ints are already a schema and sync-wire contract and should stay exactly as they are — this is only about where the slash-separated rendering lives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions