From 35a15201502248b00366dbb7df1a2183c2f92f8f Mon Sep 17 00:00:00 2001 From: Binh Date: Fri, 25 Sep 2026 09:01:39 +0200 Subject: [PATCH] feat(exports): replace Work CSV with reader-aligned XLSX --- AGENTS.md | 2 +- docs/IMPLEMENTATION_PLAN.md | 2 + package-lock.json | 4 +- package.json | 2 +- src/exports/download-adapter.ts | 3 +- src/exports/work-reader-view.ts | 74 +++++ src/exports/work-view-export.ts | 51 ++-- src/exports/work-view-xlsx.ts | 171 +++++++++++ .../actionlist/ActionlistControls.tsx | 18 +- src/features/finding-reader/FindingReader.tsx | 284 +---------------- src/features/finding-reader/finding-fields.ts | 286 ++++++++++++++++++ src/importers/status-normalization.ts | 7 +- tests/app/app-version.test.ts | 2 +- tests/domain/deviation-predicate.test.ts | 7 + tests/exports/work-view-export.test.ts | 48 ++- tests/exports/work-view-xlsx.test.ts | 159 ++++++++++ .../work-view-export-interaction.test.tsx | 26 +- tests/server/assessor-http-server.test.ts | 2 +- 18 files changed, 782 insertions(+), 366 deletions(-) create mode 100644 src/exports/work-reader-view.ts create mode 100644 src/exports/work-view-xlsx.ts create mode 100644 src/features/finding-reader/finding-fields.ts create mode 100644 tests/exports/work-view-xlsx.test.ts diff --git a/AGENTS.md b/AGENTS.md index bed321d..bd5a27e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -71,7 +71,7 @@ ## UI Work filter context -- Explicit user extension 2026-09-18: the Work toolbar's `CSV`, `MD` and `HTML` buttons export the complete current filtered/sorted Work record set, including the same linked and embedded Results used by the Results window. Marking alone does not select export rows; `My Workspace` restricts them only when active, alongside ordinary filters and drilldowns. Use exactly two content columns, `Soll-Zustand` and `Abweichungen`, with source-backed remediation/verification, original technical facts, scoped GPO provenance, and explicit missing-evidence notices. Preserve neutral verdicts and review-versus-rescan boundaries. Build the frozen projection only on export, not on navigation. Oversized CSV cells use explicitly identified continuation rows of the same finding without truncation. This view snapshot is separate from the curated Arbeitsgrundlage in `docs/REPORT_STRATEGY.md`. +- Explicit user extension 2026-09-18: the Work toolbar's `XLSX`, `MD` and `HTML` buttons export the complete current filtered/sorted Work record set, including the same linked and embedded Results used by the Results window. Marking alone does not select export rows; `My Workspace` restricts them only when active, alongside ordinary filters and drilldowns. Markdown and HTML use exactly two content columns, `Soll-Zustand` and `Abweichungen`, with source-backed remediation/verification, original technical facts, scoped GPO provenance, and explicit missing-evidence notices. Preserve neutral verdicts and review-versus-rescan boundaries. Build the frozen projection only on export, not on navigation. Oversized Excel cells use explicitly identified continuation rows of the same finding without truncation. Explicit user corrections 2026-09-24: `XLSX` replaces the former `CSV` button and mirrors the Work finding reader instead of the two-column layout: an `Übersicht` sheet with the export context, per-tool counts and the review/GPO reading boundaries, then one sheet per tool in Work order with one row per finding. Columns are Nr, Finding, Status, Severity, Badges and Source Rule ID, then the reader's own fields under their reader labels in reader order (reusing `selectFindingFields`, e.g. Description, Advised solution, Configured customer value, Expected baseline value, GPO sources), then Hinweise for status-specific neutral notes, Results (the Results window content including missing-evidence notices), Additional Information, Review and Record ID; empty optional columns are omitted per sheet. Cells are literal strings (never formulas); the status cell is highlighted only when Work's own Deviation predicate matches. This view snapshot is separate from the curated Arbeitsgrundlage in `docs/REPORT_STRATEGY.md`. - A unique `Source: Scan` selection is a semantic tool context even when Work remains on the project-wide `All Records` sheet. Visible and active facets must follow the selected tool context rather than the aggregate sheet profile. - For a GPO-only Work context, whether reached through the dedicated GPO sheet or `Source: Scan = GPOs`, show only `Result Status`, the available GPO facets `Baseline`, `Comparison`, `Conflict`, `Description source`, `Diagnostics`, `Duplicates`, `Imported`, `Policy section`, `Policy type`, and the permanent final `Source: Scan` control. Do not show CIS, severity, category, MITRE, target, result-message, review, or scanner-specific facets. diff --git a/docs/IMPLEMENTATION_PLAN.md b/docs/IMPLEMENTATION_PLAN.md index acc5ac0..d19d2a5 100644 --- a/docs/IMPLEMENTATION_PLAN.md +++ b/docs/IMPLEMENTATION_PLAN.md @@ -2753,6 +2753,8 @@ Festgelegtes Betriebsrisiko vom 2026-09-06: Verzeichnisabhaengige Compose-Projek ## 12. Änderungsprotokoll +2026-09-24 (Phase 7, Work-Ansichtsexport als Excel im Finding-Reader-Layout, ausdrueckliche Nutzerauftraege): Der Work-Button `CSV` ist durch `XLSX` ersetzt; `MD` und `HTML` bleiben zweispaltig unveraendert. Auf weitere Nutzerkorrekturen ist die Arbeitsmappe weder Zweispalten- noch Soll/Ist-Tabelle, sondern bildet den Work-Finding-Reader ab: Blatt `Übersicht` mit Exportkontext, Findings/Deviation je Tool und den einmal genannten Lesegrenzen (Review ist kein technischer Behebungsnachweis; GPO-Backupvergleich ist kein Nachweis wirksamer Endpoint-Konfiguration), danach ein Blatt je Tool in Work-Reihenfolge mit einer Zeile je Finding. Spalten: Nr, Finding, Status, Severity, Badges, Source Rule ID, dann die Readerfelder unter ihren Readerlabels in Readerreihenfolge ueber das wiederverwendete `selectFindingFields` (dafuer ohne Verhaltensaenderung aus der React-Komponente in das plattformneutrale `src/features/finding-reader/finding-fields.ts` verschoben, damit `src/exports` keine UI-Abhaengigkeit erhaelt) (z. B. Description, Technical explanation, Advised solution; bei GPO Configured customer value, Expected baseline value, GPO sources), danach Hinweise (nur statusbezogene score-neutrale Einordnung), Results (Inhalt des Results-Fensters samt fehlender Belege), Additional Information, Review und Record ID; leere optionale Spalten entfallen je Blatt. Die Deviation-Markierung der Statuszelle nutzt ausschliesslich Works eigenes Deviation-Praedikat. Fettgedruckte graue Kopfzeile, Autofilter, fixierte Kopfzeile und Spalten Nr/Finding, Umbruch oben ausgerichtet, Spaltenbreiten nach Inhalt begrenzt. Zellen ueber dem Excel-Limit laufen in markierten Fortsetzungszeilen weiter, Identitaetsspalten wiederholen sich. Alle Zellen sind literale Inline-Strings ohne Formel; Steuerzeichen bleiben per OOXML `_xHHHH_` exakt, Additional Information bleibt unformatierter Quelltext. Workbook-XML wird selbst geschrieben, weil SheetJS Community keine Zellstile schreibt; SheetJS `xlsx` 0.18.5 liefert nur den Zip-Container, keine neue Abhaengigkeit. `DownloadAdapter` akzeptiert zusaetzlich Binaerinhalt. Synthetische Unit- und Klickpfadtests (Blatt je Tool, Readerspalten und -reihenfolge, GPO-Werte/-Quellen, Results, Review, Hinweise, Uebersicht, Stile, Filter, Fixierung, keine Formeln, Steuerzeichen, Fortsetzungszeilen) bestanden; eine synthetische PingCastle/CIS-CAT/GPO-Datei oeffnet in Microsoft Excel ohne Reparaturhinweis. Keine Daten-, Import-, Score- oder Reimportaenderung. Nach Code-Review im selben Batch: Gruppierung je Tool linear statt quadratisch, Spaltenbreiten ohne Argument-Spread (250.000 synthetische Findings exportieren ohne Stackueberlauf), und ein Quellfeld mit dem Namen einer festen Spalte (z. B. `Nr`, `Review`) erhaelt eine eigene Spalte `