feat(review): line items and all formats in the review UI - #42
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…ion access control Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…LS with integration proofs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…for #4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…boss queues Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…nd download routes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…-only audit, composite FK Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
- sign-up requires the invitation id (link) plus the invited e-mail – no takeover by address alone - one company per user (unique index), deterministic membership lookup, actor from membership - organization plugin accepts only admin/clerk roles - configurable client-IP source for the auth rate limit; local secret refused in production - invite page: zod input, 404 for clerks, shows the invitation link; signup needs the link - tests: wrong/missing invitation id, foreign set-active/list-members, last admin, roles - docs: operations (rate limit/proxy, recovery), data model, exceptions register (admin plugin) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…e rejection Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
… docs for #5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…secret The image sets NODE_ENV=production, so the previous check blocked the local compose stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…re script Python 3.13 package requestflow_ai (src layout), docling/fastapi/google-genai pinned, CPU-only torch via the PyTorch CPU index, dev tools ruff/pyright/pytest. The synthetic PDF fixture is generated by scripts/make_fixtures.py (reportlab). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Test-first per ADR-0001 D8: quote normalisation (whitespace, case, NFKC, hyphenation), German number and date formats, and the verifier rules that turn unsupported model claims into unverified. Also adds the segment and model-output types the tests build on; the verifier does not exist yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
normalize_text folds NFKC, soft hyphens, line-break hyphenation, typographic dashes/quotes, whitespace and case. values parses German/ISO numbers and DD.MM.YYYY, D.M.YY and ISO dates. verify_field only keeps or downgrades the model's status: a quote not in the cited segment, an unknown segment, a value inconsistent with the quote, found without evidence or value, and missing with a value all become unverified with a reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…ction (red) EML: body lines with 1-based line locators, From/Subject header segments, RFC 2047 and quoted-printable decoding, HTML-only bodies, header newline collapse, no attachment payloads. PDF: textline segments with page + top-left bbox via docling-parse (model-free); the layout-pipeline test only runs with AI_TEST_DOCLING_MODELS=1. Detection by magic bytes; .msg rejected for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
EML via the standard library email package (policy=default): From/Subject header segments and one segment per non-empty body line, HTML-only bodies reduced to text lines. docling's EMAIL backend was checked but emits paragraphs without provenance, so it cannot give line locators. PDF via docling: the default textlines pipeline reads docling-parse text lines (page + top-left bbox, no ML models, no network); the opt-in layout pipeline uses DocumentConverter (OCR and tables off) and the heron layout model. docling is imported lazily. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…ex model client (red) The model client is exercised through the real google-genai SDK with an httpx MockTransport replaying recorded generateContent bodies: eu multi-region URL, bearer auth, structured-output config, token usage, fail-closed init (no project, no credentials, dev flag without key), no silent switch to API key mode, and schema-invalid output. Adds the env-based Settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…lient Prompt extract_header_v1.md (system instruction) plus render_document, which puts segment-id-prefixed lines between <document> delimiters and neutralises delimiter-like tags inside the document. GeminiModelClient calls Vertex via google-genai with response_schema = ModelExtraction, JSON mime type, temperature 0 and no tools; schema-invalid output raises ModelOutputError. build_model_client needs VERTEX_PROJECT and credentials, loads ADC eagerly, refuses API-key mode for Vertex, and allows the Gemini API only with AI_ALLOW_GEMINI_API_DEV=true plus GEMINI_API_KEY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Pipeline: PDF and EML end to end with recorded model responses, a model date contradicting its own quote, the prompt-injection mail (the recorded model obeys and invents a quote -> unverified), and the no-text PDF that skips the model. API: bearer auth (401 + WWW-Authenticate), response shape, request id handling, 400/413/415/422/429/502 mapping without echoing input, JSON logs with IDs only. Contract: the committed OpenAPI file equals the app's schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…claude/feat-evals-24 # Conflicts: # CHANGELOG.md # docs/technical/operations.md
…e/feat-review-line-items-25 # Conflicts: # AGENTS.md # CHANGELOG.md
… range), DOCX part, Outlook attachments unwrapped
…line metric present, injected value also fails as uncertain, --live aborts before any case without a client; scanned-case gap documented (#24 review)
7 of 15 tasks
…e/feat-review-line-items-25
…keep the value in their accessible name, stale item corrections not mapped onto a newer run (#25 review)
…ever read attachments beyond the cap olefile only logs 'stream too large' by default, and python-oxmsg reads every stream at load time, so a 2 KiB .msg declaring a gigabyte stream on a looped FAT chain was read sector by sector. check_ole_container opens the directory with DEFECT_INCORRECT and rejects any stream, the mini stream, or the sum of streams declaring more bytes than the container has. Used by detect and load_message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…X block A 60 MB document.xml of empty paragraphs (8.8 MB zipped) passed the 64 MiB/100:1 checks and cost 37 s / 1.3 GB for 0 segments. open_package now rejects any entry declaring more than MAX_PART_BYTES (16 MiB) from the zip index, and the DOCX walker counts every paragraph and table cell against MAX_BLOCKS (100,000), not only emitted segments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…rest with a warning More pages without text than the OCR cap used to fail the whole PDF (422). Now the first ones are OCR'd (consecutive pages in one conversion), the rest stay empty and the response carries the additive warning ocr_pages_skipped. parse_pdf_document returns page count and OCR counts; parse_pdf stays a wrapper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…stable for assistive tech and E2E)
Owner
Author
Frischer Review (unabhängiger Subagent, read-only aus Git-Refs,
|
| # | Schwere | Befund | Auflösung |
|---|---|---|---|
| 1 | should-fix | td.attention hatte keine CSS-Regel – unsichere Zellen fielen nur über das Badge auf |
Regel tr.attention, td.attention |
| 2 | should-fix | aria-label der Positionslinks ersetzte den sichtbaren Wert (WCAG 2.5.3) |
aria-label enthält jetzt den sichtbaren Wert („Position 1, Menge: 1250"); E2E-Locator angepasst (ein Versuch mit verstecktem Span machte den Link in Playwright „instabil" – verworfen) |
| 3 | nit | kein DB-Check item_index >= 0 in field_corrections |
bleibt in der App (Prüfung vor dem Insert); ein Check würde die bereits darauf gestapelte Migrationsfolge (#43–#45) umnummerieren – Folgeaufgabe |
| 4 | nit | Positionskorrekturen könnten nach einem neuen Lauf auf falsche Positionen fallen | Korrekturen, die älter als der neueste Lauf sind, werden für Positionen nicht mehr angewendet |
| 5 | nit | irreführender Testkommentar | korrigiert |
| 6 | nit | Seiten-Tests (Query-Parsing, CSS-Klasse, OCR-Hinweis) fehlen | Playwright-Smoke deckt Klick → Quelle → Korrektur ab; Seitenkomponententests als Folgeaufgabe |
| 7 | nit | String(undefined) im Anhangspfad |
explizit ? |
Außerhalb dieses PRs (Folgeaufgabe): Der ERP-Export sendet keine Positionen (Vertrag v1 kennt nur drei Kopffelder) – korrigierte Positionswerte sind protokolliert, erreichen das ERP aber noch nicht.
Danach: Unit Quellenansicht 9/9, Integration Review 15/15, beide Playwright-Smokes grün.
Generated by Claude Code
Per-file caps multiplied across the attachments of a .msg. ParseBudget (parsing/budget.py) is created once per uploaded document and shared by all nested attachments: 100 attachments, 128 MiB unzipped OOXML, 100 PDF pages (at least AI_MAX_PDF_PAGES), MAX_OCR_PAGES OCR pages. An attachment that would overdraw it is reported with the additive error code budget_exceeded; the rest of the message is still returned. BudgetExceededError subclasses DocumentTooLongError, so a top-level document still maps to 422. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…EADME limits for the security fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…ges_skipped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
olefile follows the declared FAT sector count along the DIFAT chain in its constructor (quadratic array copy per sector); a forged count on a looped DIFAT chain hung it before the stream-size walk could run. The header's FAT, DIFAT, mini FAT and directory sector counts must now fit the file size. Also: stale docstring, README package list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…ored per document and shown in the review; contract types regenerated (#23 review)
…claude/feat-evals-24
…e/feat-review-line-items-25 # Conflicts: # src/app/requests/[id]/page.tsx # src/features/review/review.ts # tests/integration/review.test.ts
This was referenced Sep 23, 2026
Fluory
marked this pull request as ready for review
September 23, 2026 09:08
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warum
Fixes #25 · Epic #17 · Basis
main(#41 ist gemergt; vorher gestapelt aufclaude/feat-evals-24).Arbeitsstand
field_corrections.item_index), Review-Dienst (Positionen, Korrekturen je Position), Quellenansicht für Mail/MSG, PDF inkl. OCR-Kennzeichnung, XLSX-Zeilen, DOCX-Absätze/Tabellenzellen, Anhänge; Seite mit Positionstabelle + Detailpanel; Tests; zweiter Playwright-Smoke; Doku; frischer Review eingearbeitet;verify:fullgrün; CIcheckgrün.checkgegenmain; danach feat(requests): request list with errors, retries and reprocessing #43.Was ist passiert (Klartext)
In der Prüfansicht erscheinen die Positionen einer Anfrage jetzt als Tabelle (Beschreibung, Menge, Einheit, Werkstoff, Abmessungen); unsichere oder nicht bestätigte Werte fallen farbig und mit Warnzeichen auf. Ein Klick auf einen Wert zeigt, wo er steht – Mail-Zeile, PDF-Seite (bei Texterkennung mit Warnhinweis), Excel-Zeile, Word-Absatz oder -Tabellenzelle, auch in Outlook-Anhängen – und erlaubt die Korrektur; jede Korrektur wird mit altem und neuem Wert, Person und Zeit protokolliert. Ein Browser-Test spielt eine Anfrage mit zwei Positionen vom Hochladen bis zum Export durch. Noch nicht: Der ERP-Export sendet die Positionen noch nicht mit (Vertrag v1 kennt nur Kopffelder) – Folge-Issue #46.
Plan-Pflicht (SYSTEM.md §4)
Impact Manifest
review(Positionen, Korrekturen mititemIndex, Quellenansicht aller Formate),db(Migration 0014),app(Seite/requests/:id: Positionstabelle, Detailpanel, Server Action mit Position), E2E (zweiter Smoke, KI-Stub liefert Positionen).field_corrections.item_index(null = Kopffeld); Server ActioncorrectFieldActionakzeptiert optionalitem(nur kleine Ganzzahl, sonst abgelehnt).xlsx:sheet,row,cellRange;docx:part, …;msg: Anhänge mitattachment+inner).Geändert
src/db/schema/app.ts, Migration0014_item_corrections.sqlsrc/features/review/{review,source-view,index}.ts(+ Tests)src/app/requests/[id]/{page.tsx,actions.ts},src/app/globals.csstests/integration/review.test.ts,tests/e2e/{ai-stub.mjs,line-items-smoke.spec.ts}docs/technical/{data-model,architecture}.md,CHANGELOG.md,AGENTS.md(verify:full)Nachweis (SYSTEM.md §11)
verify:changed: Unit Quellenansicht 9/9, Integration Review 16/16 (nach Merge von feat(evals): eval runner, 15 weighted synthetic cases and CI gate #41 inkl. feat(ai-service): XLSX, DOCX, MSG and scanned PDFs #40)verify: grün (lokal auf der Stapelspitze feat(observability): correlated structured logs and full health #45, die diesen PR enthält: lint, typecheck, Unit 154/154, Integration 114/114, depcruise, build, audit ohne high); CIcheckauf dem aktuellen Head grünverify:full/ E2E-Spec: grün –review-smokeundline-items-smoke(mehrere Positionen, Upload → Korrektur einer Position → Freigabe → Export), Eval-Gate PASSEDsource-view.test.ts(XLSX, DOCX Absatz/Zelle, OCR, MSG-Anhang); Positionskorrektur protokolliert → Integration; ungültige Position abgelehnt → Integration; E2E mehrere Positionen →line-items-smoke.spec.tsaria-labelenthält den sichtbaren Wert), Korrektur ist ein natives Formular; Status nie nur über FarbeDoku-Entscheidung (genau eine)
docs/technical/data-model.mddocs/technical/architecture.md[Unreleased](sichtbares Feature oder Verhalten – im selben PR, nie „später")Entferntes oder Umbenanntes: nichts entfernt
Dateigrößen und neue Bausteine (SYSTEM.md §7)
Dateien über 500 Zeilen im Diff (Ausnahmen: generierter Code, Lockfiles, Fixtures, Migrationen, Schemas, Ressourcen, Doku, Konfiguration):
Über 800 Zeilen mit neuer Fachlogik oder über 1000 Zeilen (P1/P2): nicht betroffen
Neue Shared-Komponente, Utility-Datei, Adapter oder fachlicher Service:
Subagent-Einsätze
review-pr+ Security-/E2E-Regeln).Risiken / offene Punkte
item_index >= 0(Prüfung in der App) – Folge-Issue chore(db): CHECK constraint for field_corrections.item_index #47.🤖 Generated with Claude Code
https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1