Sektion I — Plattform/Audit-Ansicht (Frontend, Teil 2) - #33
Conversation
Die Plattform-/Audit-Sicht unter /platform (requireSection("I")) auf den
fertigen Read-APIs (GET /api/v1/topology + /api/v1/audit, §22). Baut die
ehrlich abgeleitete Teilmenge des [VISION]-Zielbilds §4I — kein erfundener
Knoten, kein erfundener Live-Feed.
- lib/platform/: types (Vertrags-Spiegel), status (mehrkanaliges Status-/
Richtungs-Mapping, "unbekannt" ehrlich neutral statt grün geraten),
topology-/audit-view-model, audit-filter + url (reale Query-Params gegen
den generischen BFF-Catch-all), roles, use-topology/use-audit
(HTTP-Snapshot + manueller Refresh, kein WS-Feed), testing/fixtures.
- components/platform/: TopologyGraph (bespoke token-getriebenes SVG,
FOREMAN-Zentrum, [VISION] abgesetzt/nie verbunden, gestörter Konnektor
ruhig markiert), TopologyNodeMark, AuditTable/AuditRow (unveränderlich-
lesend, IDs monospace, actor pseudonym #hex6), AuditFilters,
PlatformView (Rollen-Split OHNE bedingte Hooks).
- Rollen: Manager Topologie+Audit (Tabs) · Schichtleiter nur Topologie
(FE ruft /audit nie auf) · Werker/Techniker requireSection-Landing.
- Drei Haltungen: HITL (nur lesen, keine Aktorik) · Hidden-Term
(Gedächtnis-Substrat, eigener hidden-term.test) · Vorbehalt/Ehrlichkeit.
- Bewusste Abweichungen (am realen Code belegt): eigener Connection-Status
statt Fcsm-Zwang (kennt kein "unbekannt"); generischer BFF-Catch-all
statt eigener Proxy-Routen; ACCESS_MATRIX.I + Nav bereits vorhanden;
kein E2E (Vitest-Abdeckung wie §21.8).
- Adversariale 6-Dimensionen-Review (Workflow): alle Haltungen bestätigt,
3 a11y-Befunde gefixt (Pagination aria-live + aria-label, Tab-Keyboard).
Gates lokal grün: tsc 0, ESLint 0, Vitest 629 (59 neu für I),
tokens:check synchron, next build ok (/platform 8,3 kB / 111 kB).
GROUND_TRUTH §21.6/§21.16/§21.17 + WALKTHROUGH im selben Commit (DoD).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughDas PR ergänzt den vollständigen Frontend-Teil von Sektion I (Plattform/Audit): neue Typen, Status-/Richtungs-Normalisierung, Audit-Filter-Logik, URL-Builder, React-Hooks ( ÄnderungenSektion I Plattform/Audit Frontend
SequenzdiagrammsequenceDiagram
participant Browser as Browser (Manager)
participant PlatformPage as platform/page.tsx
participant PlatformView
participant ManagerTabs
participant TopologyPanel
participant useTopology
participant AuditPanel
participant useAudit
participant API as BFF /api/v1
Browser->>PlatformPage: GET /platform
PlatformPage->>PlatformView: user (role=manager)
PlatformView->>ManagerTabs: canViewTopology=true, canViewAudit=true
ManagerTabs->>TopologyPanel: render topology tab
ManagerTabs->>AuditPanel: render audit tab
TopologyPanel->>useTopology: probe=true
useTopology->>API: GET /topology?probe=true
API-->>useTopology: TopologyViewRead JSON
useTopology->>useTopology: assembleTopology → DataState cached
useTopology-->>TopologyPanel: state, refresh, refreshing
TopologyPanel-->>Browser: TopologyGraph, ProvenanceStamp, NodeGroups
AuditPanel->>useAudit: AuditFilter (empty init)
useAudit->>API: GET /audit?limit=20&offset=0
API-->>useAudit: AuditEntryRead[] JSON
useAudit->>useAudit: assembleAuditRows → DataState cached
useAudit-->>AuditPanel: state
AuditPanel-->>Browser: AuditFilters, AuditTable, Pagination
Geschätzter Code-Review-Aufwand🎯 4 (Komplex) | ⏱️ ~60 Minuten Möglicherweise verwandte PRs
Gedicht
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/components/platform/platform-view.tsx`:
- Around line 102-105: The tab button element and the `<h2>` heading in the tab
layout are using duplicate IDs (both using `tab-${tab.id}`), which violates HTML
ID uniqueness requirements and breaks ARIA relationships for assistive
technology. Ensure that each element has a unique ID by renaming the `<h2>`
element's ID to something distinct (for example, `heading-${tab.id}` or similar)
while keeping the tab button's ID as `tab-${tab.id}`. Update any ARIA attributes
or references that depend on the heading's ID to point to the new unique
identifier. Apply this fix to all occurrences mentioned in the Manager branch
(including the sections at lines 121-123 and 139-141).
In `@frontend/components/platform/topology-graph.tsx`:
- Around line 142-145: The vision zone height in the topology-graph component is
hardcoded to 92 pixels, which causes nodes to overflow or be cut off when there
are 7 or more vision nodes arranged in a 3-column layout. Instead of using a
fixed value for visionH, calculate the actual height dynamically based on the
number of vision nodes and the column layout used in the rendering section
(lines 224-234). Determine how many rows are needed by dividing the
model.vision.length by the number of columns (3) and rounding up, then multiply
by the row height to get the true visionH value. This ensures the SVG and dashed
zone properly accommodate all vision nodes regardless of how many there are.
In `@frontend/lib/platform/url.ts`:
- Around line 27-29: The freshWithinMinutes value from options is being added to
the URL parameters without validating that it falls within the documented valid
range of 1 to 10080. Before setting the parameter in the params.set call within
the conditional block checking options.freshWithinMinutes !== undefined,
validate and clamp the value to ensure it is within the acceptable range of 1 to
10080 (similar to how audit pagination is defensively handled elsewhere in the
codebase). This will prevent invalid requests from being generated with
out-of-range values.
In `@frontend/lib/platform/use-topology.ts`:
- Around line 51-53: The error handling in the useTopology hook currently
discards the cached snapshot whenever a fetch fails by immediately setting the
state to error kind, but it should degrade gracefully by preserving the existing
cached data for transient errors and only transitioning to error state for
permanent failures. Modify both setState calls (at line 52 when res.ok is false
and at line 66) to check if there is already a cached snapshot available; if
yes, keep the cached state and only set to error kind when the failure is a
permanent load-failed condition, not for all fetch errors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0774e10c-4f8c-42de-bdda-1157e29e4880
📒 Files selected for processing (29)
GROUND_TRUTH.mddocs/WALKTHROUGH.mdfrontend/app/(app)/platform/page.tsxfrontend/components/platform/audit-filters.tsxfrontend/components/platform/audit-row.tsxfrontend/components/platform/audit-table.test.tsxfrontend/components/platform/audit-table.tsxfrontend/components/platform/hidden-term.test.tsxfrontend/components/platform/platform-view.test.tsxfrontend/components/platform/platform-view.tsxfrontend/components/platform/topology-graph.test.tsxfrontend/components/platform/topology-graph.tsxfrontend/components/platform/topology-node-mark.tsxfrontend/lib/platform/audit-filter.test.tsfrontend/lib/platform/audit-filter.tsfrontend/lib/platform/audit-view-model.test.tsfrontend/lib/platform/audit-view-model.tsfrontend/lib/platform/roles.test.tsfrontend/lib/platform/roles.tsfrontend/lib/platform/status.test.tsfrontend/lib/platform/status.tsfrontend/lib/platform/testing/fixtures.tsfrontend/lib/platform/topology-view-model.test.tsfrontend/lib/platform/topology-view-model.tsfrontend/lib/platform/types.tsfrontend/lib/platform/url.test.tsfrontend/lib/platform/url.tsfrontend/lib/platform/use-audit.tsfrontend/lib/platform/use-topology.ts
- platform-view: eindeutige Heading-ID im Manager-Tab (Topologie-h2 nicht mehr id="tab-topology" wie der Tab-Button → ARIA-Zuordnung eindeutig). - topology-graph: [VISION]-Zonenhöhe aus der tatsächlichen Zeilenzahl berechnet (skaliert mit der Knotenanzahl statt fix 92 → kein Überlauf bei 7+ Knoten). - url: freshWithinMinutes defensiv auf 1..10080 geklemmt (clampFresh- WithinMinutes), analog clampLimit — kein ungültiger Request. - use-topology: Fehlerpfad hält bei transientem Fehler den letzten Snapshot (Degradation, wie im Kommentar versprochen); nur fatale Fehler (unauthorized/forbidden) überschreiben ihn. Tests: +4 (clamp + Degradations-Hold + fataler 403). Gates grün: tsc 0, ESLint 0, Vitest 633, next build ok (/platform 8,41 kB). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Was
Teil 2 der Sektion I: die Plattform-/Audit-Ansicht unter
/platform(requireSection("I")) auf den gemergten Read-APIs (GET /api/v1/topology+GET /api/v1/audit, §22). Baut die ehrlich abgeleitete Teilmenge des[VISION]-Zielbilds §4I — kein erfundener Knoten, kein erfundener Live-Feed.Teil A — Systemtopologie (ruhig, nicht-animiert)
TopologyGraph, keine Charting-Lib): FOREMAN im Zentrum, Eingänge / Gedächtnis-Substrat / MCP-Grenze ringsum, die[VISION]-Knoten (ERP/Energie/ext. Sim) in einer abgesetzten, gestrichelten Zone ohne Konnektor — nie als reale Verbindung.StatusIndicator-Atoms, das keinunbekanntkennt.unbekanntbleibt ehrlich neutral (nie grün geraten);simulationals intern markiert; ein gestörter Konnektor klar, aber ruhig (kein Alarm-Rot, ISA-101).liefert/liest/beides/keine) als Pfeil-Form, nicht Farbe.Teil B — Audit-Tabelle (unveränderlich-lesend)
action_type/target_kind/target_id/actor/machine_id/since/until/limit/offset).actorausschließlich als pseudonymer#hex6-Handle (nie Klartext, nie aufgelöst, §8);detail-JSONB defensiv gerendert. Rein lesend — keine Mutations-/Quittier-Affordance.Rollen-Split (Matrix 3.1,
ACCESS_MATRIX.I)GET /api/v1/auditfür ihn gar nicht auf (Audit-Hook in seinem Zweig nie gemountet → kein 403).requireSection-Landing. Sichtbarkeit ≤ Server-Guard.Drei Haltungen
HITL (liest nur, schaltet nie) · Hidden-Term (Substrat heißt außen nur „Gedächtnis-Substrat", eigener
hidden-term.test.tsx) · Vorbehalt/Ehrlichkeit (Status nur wo messbar). Audit/Topologie sind kein KI-Output → keine KI-Kennzeichnung.Bewusste Abweichungen vom Prompt (alle am realen Code belegt)
StatusIndicatorist Fcsm-only und kennt keinunbekannt(vom Auftraggeber bestätigt).app/api/v1/[...path]genügt (wie alle Sektionen).ACCESS_MATRIX.I+/platform-Nav waren bereits beim FE-Fundament angelegt → additiv nichts nötig.Markierte Anschlusspunkte (bewusst, nicht erfunden)
Kein WS-Live-Feed für Sektion I → HTTP-Snapshot + manueller Refresh; die Substrat-Live-Probe schreibt einen Smoke-Marker →
probe-Toggle. Per-Client-MCP-Attribution =[VISION](ein geteilter Consumer) → MCP-Knoten zeigt ehrlich eine Grenze.Qualität
Adversariale 6-Dimensionen-Review (Workflow, jeder Befund gegengeprüft): alle Dimensionen strukturell sauber; 3 a11y-Befunde gefixt (Pagination
aria-live+ Button-aria-label, Tab-Pfeiltasten-Test).Gates lokal grün:
tsc0 · ESLint 0 · Vitest 629 (59 neu für I) ·tokens:checksynchron ·next buildok (/platform8,3 kB / 111 kB First Load — bespoke SVG ohne Lib). Hidden-Term-Scan sauber.GROUND_TRUTH §21.6/§21.16/§21.17 + WALKTHROUGH im selben Commit (DoD).
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes – Plattform-/Audit-Sektion