Skip to content

Junzhe/feature/legal adeu integration#269

Merged
rafchen merged 9 commits intofeature/template-logicfrom
junzhe/feature/legal-adeu-integration
Apr 6, 2026
Merged

Junzhe/feature/legal adeu integration#269
rafchen merged 9 commits intofeature/template-logicfrom
junzhe/feature/legal-adeu-integration

Conversation

@JunzheShi0702
Copy link
Copy Markdown
Collaborator

Summary

Integrates Adeu DOCX redlining service with the legal document editor, enabling users to apply edits with Track Changes directly in the UI. This creates a seamless workflow for legal document review and editing with full audit trails.

Closes #266

Changes

  • Created /api/legal/apply-edits endpoint with Clerk authentication and Zod validation
  • Enhanced LegalDocumentEditor with "Track Changes" button and real-time progress feedback
  • Added multi-step toast notifications for better UX (loading, progress, success/error states)
  • Implemented comprehensive error handling with user-friendly messages
  • Added 18 unit tests covering authentication, validation, Adeu integration, error handling, and edge cases
  • Merged PR Kaan kien tiffany/feature/docs editing adeu #260 (Adeu DOCX redlining integration) and resolved merge conflicts in 4 files
  • Added validation before applying edits to prevent invalid operations
  • Enhanced download functionality with toast notifications

How to Test

  1. Start the sidecar service with Adeu integration: cd sidecar && python -m uvicorn app.main:app --reload
  2. Navigate to the legal document editor at /employer/documents
  3. Upload a DOCX legal document or use an existing one
  4. Make some edits in the editor (text modifications, deletions, additions)
  5. Click the "Track Changes" button
  6. Verify toast notifications show progress ("Validating edits...", "Applying Track Changes...")
  7. Verify the document downloads with all changes tracked in Word Track Changes format
  8. Open the downloaded document in Microsoft Word to confirm Track Changes are visible
  9. Test error scenarios by stopping the sidecar service and verifying user-friendly error messages
  10. Run test suite: npx jest __tests__/api/legal/apply-edits.test.ts (should show 18/18 passing)

Checklist

  • PR is under ~400 changed lines (869 lines total: 97 API + 538 tests + 234 UI)
  • Branch follows naming convention: junzhe/feature/legal-adeu-integration
  • Commits reference the issue number (e.g., feat: Integrate Adeu DOCX redlining (#266))
  • Tests pass (18/18 unit tests passing)
  • At least one teammate has been requested for review

kien-ship-it and others added 9 commits March 28, 2026 12:59
- Add Python schemas package with Pydantic models for document edits, review actions, and batch processing
- Create ADEU schema definitions for DocumentEdit, ReviewAction, and related request/response types
- Add TypeScript client library with service interface and error handling classes
- Create TypeScript type definitions matching Python schema structure for type safety
- Update sidecar requirements to include pydantic and adeu dependencies
- Organize ML dependencies with comments for clarity
- Establish foundation for document batch processing and review workflows
- Add Adeu pip package installation (v0.9.0) in separate Docker layer for independent caching
- Create new /adeu/* route module with endpoints for reading, editing, and processing DOCX files
- Implement POST /adeu/read endpoint to extract text from DOCX with clean view option
- Implement POST /adeu/process-batch endpoint to apply edits and review actions in single request
- Implement POST /adeu/accept-all endpoint to accept all changes and return clean DOCX
- Implement POST /adeu/reject-all endpoint to reject all changes and return clean DOCX
- Implement POST /adeu/diff endpoint to generate edit suggestions from text comparison
- Implement POST /adeu/apply-edits-markdown endpoint to apply edits to markdown representation
- Add Adeu schemas module with request/response models for type validation
- Update main.py to register adeu router and include Adeu availability in health check
- Enables document editing and change tracking workflows through unified API
- Add ADEU_SERVICE_URL environment variable configuration with Docker, local, and Vercel deployment options
- Update .vercelignore to exclude sidecar directory due to ML dependency size constraints
- Fix TypeScript type safety in modifyDocument tests with proper error type casting and unknown error handling
- Correct Blob initialization in adapter tests using Uint8Array wrapper for buffer compatibility
- Add test automation scripts for ADEU LLM loop testing and sidecar process management
- Include comprehensive test output and logging for ADEU service validation
- Update Docker Compose and Vercel configuration for improved service orchestration
- Update test execution timestamps to reflect latest test run (2026-04-05T20:48:43.125Z)
- Refine investor name target text matching to improve accuracy in document edits
- Add apply_edits tool call in LLM response to consolidate multiple edit operations
- Generate safe-modified DOCX output file from test execution
- Streamline iteration flow by consolidating edit operations in single tool call
Implements GitHub issue #266 by connecting the legal pipeline editing layer
to Kien's Adeu DOCX redlining service.

Changes:
- Created /api/legal/apply-edits endpoint with Clerk auth and Zod validation
- Enhanced LegalDocumentEditor with Track Changes button and multi-step toast notifications
- Added comprehensive error handling with user-friendly messages
- Implemented 18 unit tests covering auth, validation, integration, errors, and edge cases
- Merged PR #260 (Adeu DOCX redlining integration)
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
launch-stack Ready Ready Preview, Comment Apr 6, 2026 8:03pm
pdr-ai-v2 Ready Ready Preview, Comment Apr 6, 2026 8:03pm

@JunzheShi0702 JunzheShi0702 requested a review from rafchen April 6, 2026 20:04
@rafchen rafchen merged commit a40090d into feature/template-logic Apr 6, 2026
5 checks passed
@rafchen rafchen deleted the junzhe/feature/legal-adeu-integration branch April 6, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants