feat(review): review fields beside their source, correct, approve or reject - #35
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
…p and native stderr Fixtures are described as hand-written in the Vertex REST format (not recorded). New env var AI_MAX_PDF_PAGES, 411/422 codes, dev-flag ambiguity, layout startup check. docling-parse/qpdf stderr bypasses JSON logging; no output observed, whether it can carry document text is unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
New error codes length_required and document_too_long, 411 response, reason ambiguous_quote. 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
Behind uvicorn --root-path the raw scope path carries the prefix, and the guard would silently skip /v1/extract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
… root path 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
- AI response invariants (found ⇒ evidence, cited segment exists, unique ids, same document) → permanent - 400/404/405 are service errors, not document errors - processing time budget checked against the job expiry (1 h) at worker start - failure state recorded only while PROCESSING; constraint violations on persist are permanent - dead-letter jobs handled every round, dead-letter queue retries its own handler - schema: fields pinned to request (same company) and to their evidence segment 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
…t concurrency test; ops notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…nition 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
…ervice + tests) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1
…, approve/reject actions 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
…es; refuse overlong reasons; cross-tenant correction tests
Owner
Author
Frischer Review (unabhängiger Subagent, read-only,
|
| # | Schwere | Befund | Auflösung |
|---|---|---|---|
| 1 | should-fix | Korrigierter Wert behielt den Status found („belegt") samt altem Zitat – widerspricht „found needs proof" (D8) |
reviewStatus = corrected („korrigiert"), Extraktionsstatus separat als „erkannt: …"; Quellenpanel sagt, dass es die Fundstelle des erkannten Werts ist. Integrationstest „shows a corrected value as corrected – never as found" |
| 2 | should-fix | ?done=/?error= wurden als Freitext in role=status/alert angezeigt (Phishing-Text per Link) |
Actions leiten nur feste Codes weiter; messages.ts bildet sie auf Texte ab, unbekannte Codes werden ignoriert. ReviewRefused trägt jetzt einen code |
| 3 | should-fix | Kein Nachweis der RLS auf field_corrections |
Test „keeps corrections company-private": fremde Firma sieht keine Historie, Insert mit fremder company_id scheitert an row-level security; zusätzlich rejectRequest/correctField aus fremder Firma abgelehnt |
| 4 | nit | Ungültige requestId → ZodError → 500 |
safeParse → notFound() |
| 5 | nit | Ablehnungsgrund still auf 1000 Zeichen gekürzt | wird jetzt abgelehnt (reason_too_long), Test ergänzt; DB-Check-Constraint bewusst nicht ergänzt (Modul ist der einzige Schreibpfad) |
| 6 | nit | Zitat-Markierung per toLowerCase() kann bei Zeichen wie „İ" verrutschen |
exakter Treffer zuerst, case-insensitiver Fallback nur bei gleicher Länge, sonst ganzes Segment markiert; Unit-Test ergänzt |
| 7 | nit | corrected_by ohne FK |
bewusst (wie audit_events.actor_user_id, Historie überlebt Nutzerentfernung) – in data-model.md dokumentiert |
| 8 | nit | Personenbezogene Werte im append-only Audit nicht pro Anfrage löschbar | in data-model.md und PR-Risiken vermerkt, gehört zur offenen Aufbewahrungsfrage (ADR-0001) |
Nach den Fixes: Review-Tests Unit 5/5, Integration 12/12, E2E-Smoke grün; pnpm verify läuft erneut.
Generated by Claude Code
5 tasks
Fluory
marked this pull request as ready for review
September 23, 2026 07: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 #8 · Teil von Epic #2 · gestapelt auf #34 (Basis
claude/feat-jobs-worker-7).Arbeitsstand
/requests/:idmit Server Actions, Quellenansicht, Unit-/Integrationstests, Playwright-Smoke inverify:full, CI-Schritt für Chromium, Doku, frischer Review inkl. Fixes.Was ist passiert (Klartext)
Die Prüfansicht ist fertig. Jede erkannte Angabe (Firma, Ansprechpartner:in, Liefertermin) steht mit ihrem Status in einer Tabelle; „unsicher" und „nicht bestätigt" sind farbig und mit Warnzeichen markiert. Ein Klick auf „Quelle anzeigen" zeigt die Mail-Zeile bzw. PDF-Seite mit der markierten Fundstelle. Korrekturen speichern alten und neuen Wert, Person und Zeit – im selben Schritt wie der Audit-Eintrag; ein korrigierter Wert heißt danach „korrigiert", nie mehr „belegt". „Freigeben" setzt die Anfrage auf Freigegeben und plant den Export im selben Schritt ein; „Ablehnen" verlangt einen Grund. Andere Firmen sehen und ändern nichts (geprüft). Neu ist ein Browser-Test, der den ganzen Weg Hochladen → Verarbeitung → Prüfen → Korrigieren → Freigeben durchspielt (KI-Dienst dabei als Attrappe). CI-Änderung: Der Schritt
verify:full(nur mit Labelverify-full) installiert jetzt vorher Chromium – rein additiv.Plan-Pflicht (SYSTEM.md §4)
Impact Manifest
review(Ansicht, Korrektur, Freigabe, Ablehnung),requests(Übergänge REVIEW → APPROVED/REJECTED, Ablehnungsgrund),audit,jobs(Export-Queue-Definition + transaktionales Einstellen; Handler in feat(export): export approved requests exactly once to the ERP mock #9),db(Migrationen 0009/0010),app(Seite/requests/:idmit Server Actions), E2E (Playwright-Smoke inverify:full), CI (Chromium-Installation vorverify:full).app.field_corrections(append-only, FORCE RLS);app.requests.rejection_reason; Queuerequest-export; Server Actions (Rollenprüfung serverseitig, feste Meldungscodes in der URL).field_corrections, append-only); Playwright-Smoke.@playwright/test1.63.0 (Apache-2.0); vorinstalliertes Chromium der Session ist Revision 1194 → lokal perPW_CHROMIUM_PATH, in CI perplaywright install --with-deps chromium.Geändert
src/db/schema/app.ts, Migrationen0009_review.sql,0010_review_force_rls.sql;src/features/jobs/{queues,boss}.ts(Export-Queue,enqueueRequestExport)src/features/review/{review,source-view,index}.ts(+ Unit-Test)src/app/requests/[id]/{page,actions,messages}.tsx/ts,src/app/requests/status-labels.ts,src/app/requests/page.tsx(Statusbeschriftung),src/app/globals.css,layout.tsxtests/integration/review.test.ts;playwright.config.ts,tests/e2e/{ai-stub.mjs,global-setup.ts,review-smoke.spec.ts};package.json(e2e,verify:full,@playwright/test).github/workflows/ci.yml(Chromium vorverify:full, gleiche Bedingung)docs/technical/data-model.md,docs/technical/architecture.md,CHANGELOG.md,AGENTS.md(verify:full-Zeile)Nachweis (SYSTEM.md §11)
verify:changed: typecheck + lint +vitestreview (Unit 5/5, Integration 12/12) grünverify: lokal grün (Exit 0) gegen echtes PostgreSQL 17 + SeaweedFS – Unit 105/105, Integration 68/68, depcruise ohne Verstöße, Build, Audit (nur 1 moderate, Schwelle high); CIcheck: siehe Checks dieses PRsverify:full/ E2E-Spec:tests/e2e/review-smoke.spec.tslokal grün (1 passed, 14 s) mit Worker, gebauter App und KI-Stub; in CI per Labelverify-fullreview-prinkl. Security-Regel – 0 Blocker, 3 should-fix + 5 nits; alle should-fix behoben, Ergebnis als PR-KommentarDoku-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:
reviewwar ein Skelett aus chore(app): TS app skeleton, docker compose and verify commands #3, Statusbeschriftung nur lokal in der Detailseite → nachstatus-labels.tsverschoben und in Liste + Detail genutztSubagent-Einsätze
review-pr+ Security-Regel): Ergebnis und Auflösung als PR-Kommentar.Risiken / offene Punkte
data-model.mdvermerkt.drain()nach demfail()einmal abbrechen (worker.drain_failed); der Job läuft trotzdem regulär in Retry/Dead-Letter – kein Hänger, aber unschönes Log. Kandidat für einen kleinen Härtungs-Fix.🤖 Generated with Claude Code
https://claude.ai/code/session_01DJ5vaKvTYiMvdngT4d3xo1