Files
Fuchs_Intranet/Fuchs/Docs/Concepts
StefanandClaude Opus 4.8 af445c015e Add backend-authoritative invoice draft editing (ADR 0006/0007)
Move the invoice draft editor to a backend single source of truth: an
in-memory InvoiceDraftSession (per-token, cached) holds the editable payload,
server-computed sums/VAT and validation, plus an automatic change history. The
browser posts single edits; the server recomputes and signals the editing
session over a dedicated SignalR hub (DraftPreviewHub) to re-fetch.

This reverses the previously-documented stateless editor (EVAL_live_invoice_editing,
INVOICE_LIFECYCLE §10), by explicit product decision — captured in ADR 0006 and 0007
plus the live-draft-editing concept doc.

Backend (this milestone):
- InvoiceDraftSession + ChangeHistoryEntry data holders
- InvoiceDraftCalculator: pure port of quantChange/invSumUpdate (§13b, VAT-by-rate)
  and consistency checks — fully unit-tested
- IInvoiceDraftCache/InvoiceDraftCache: in-memory store with idle sliding TTL
- IInvoiceDraftService/InvoiceDraftEditService: open (payload or DB reload), patch,
  build state, flush via existing RegisterInvoiceAsync (no new persistence), preview
  from cache, discard (DB reload), history
- InvoiceDraftExpiryService: pre-expiry warning + eviction-with-reason
- DraftPreviewHub + IDraftNotifier/DraftNotifier: targeted draftReady/draftExpiring/
  draftClosed signals per draft token
- inv/dopen|dstate|dpatch|dpreview|dsave|dhistory|ddiscard|dclose endpoints; save
  reports success/failure via the existing EventService
- DI + hub mapping in Program.cs

Frontend (additive foundation): $fis.draft SignalR client for /draftpreview.
The editor DOM inversion (routing deltas, rendering from server state) is the
next, separately-verified step; existing endpoints are unaffected.

Tests: 30 new (calculator, cache, expiry, patch/history, flush); 306 total passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 13:29:35 +02:00
..

Concepts

This folder holds living design write-ups of how a subsystem currently works: its moving parts, data flow, and how they fit together. Unlike ../Decisions, concept docs are not immutable — keep them in sync with the implementation as it evolves.

What belongs here

"How does the notification pipeline work end to end" is a concept doc. "Why did we choose SignalR over polling for it" is a decision. A single feature area typically has one concept doc and may reference several decisions that shaped it.

File naming

kebab-case-topic.md (no numbering — concepts aren't sequential events).

Required YAML frontmatter

---
status: Active            # Active | Deprecated
lastUpdated: 2026-07-03
applyTo:                  # glob(s) — files/areas this concept describes
  - "Fuchs/Notifications/**"
relatedDecisions:         # filenames in ../Decisions this concept implements
  - "0001-domain-events-and-notification-triggers.md"
---

Agents must scan the YAML frontmatter of every file in this folder first and only read the full body of concepts whose applyTo glob matches the files they're about to touch, or whose subject is otherwise clearly relevant.

Body template

# Topic

## Summary
One paragraph: what this subsystem does and why it exists.

## How it works
The mechanics — components, data flow, sequencing. Diagrams (ASCII/mermaid)
welcome where they clarify.

## Key files
Bullet list of the primary files/classes involved.

## Related decisions
Links to the ADRs in `../Decisions` that shaped this design.

Rules

  • Keep concepts current. When you materially change how a documented subsystem works, update its concept doc in the same change — don't let it drift from the code.
  • Create a concept doc for new non-trivial subsystems. If you build something a future agent would need a paragraph of context to safely modify, write that paragraph here instead of making them re-derive it from the diff.
  • Concepts describe current behavior. If something changes, edit the doc in place — don't append a changelog inside it (git history is the changelog).