Skip to main content

Document Editing

16 requirements · 48 scenarios

Outgoing Attachment Linking (Bug Fix)

JR-document-editing-001
The system SHALL set both original_attachment_id AND ticket_id on outgoing document attachments.
3 test scenarios
  • Revised clean docx links to source attachment JR-document-editing-001.1
  • Tracked changes and redline attachments link to source JR-document-editing-001.2
  • Database contains proper linking for sent attachments JR-document-editing-001.3

Previous Sent Draft Retrieval by original_attachment_id

JR-document-editing-002
The system SHALL retrieve the most recent previously-sent clean draft using original_attachment_id linkage.
3 test scenarios
  • Retrieve previous draft by source attachment_id JR-document-editing-002.1
  • No previous draft exists (first edit) JR-document-editing-002.2
  • Multiple previous drafts exist JR-document-editing-002.3

Incremental Redline Generation

JR-document-editing-003
The system SHALL generate incremental redlines showing only changes made since the previous AI-generated draft.
2 test scenarios
  • Generate incremental redline from previous sent draft JR-document-editing-003.1
  • Incremental redline reflects only new changes JR-document-editing-003.2

Cumulative Redline Generation

JR-document-editing-004
The system SHALL continue generating cumulative redlines showing all changes from the original document.
1 test scenario
  • Generate cumulative redline from preserved original JR-document-editing-004.1

Dual Redline Output Files

JR-document-editing-005
The system SHALL generate both cumulative and incremental redline PDFs when a previous draft exists.
2 test scenarios
  • Follow-up edit generates both redline PDFs JR-document-editing-005.1
  • First edit generates single redline PDF JR-document-editing-005.2

Edit Snippets Based on Incremental Changes

JR-document-editing-006
The system SHALL generate edit snippets in the cover note based on incremental changes (since last sent draft), not cumulative changes.
3 test scenarios
  • Follow-up edit snippets show only incremental changes JR-document-editing-006.1
  • First edit snippets show all changes JR-document-editing-006.2
  • Empty incremental changes JR-document-editing-006.3

Explicit Definition Auto-Tagging

JR-document-editing-007
The system SHALL automatically apply bold formatting to explicit definition terms when inserting new definitions, using the document's existing definition style as a role model.
9 test scenarios
  • Explicit definition gets bold term when nearby definitions are bold JR-document-editing-007.1
  • Multiple explicit definitions inserted together JR-document-editing-007.2
  • Definition with "shall mean" variant JR-document-editing-007.3
  • Definition with "has the meaning" variant JR-document-editing-007.4
  • Multi-word definition term JR-document-editing-007.5
  • Placeholder bracket definition JR-document-editing-007.6
  • No double-tagging of already-tagged definitions JR-document-editing-007.7
  • Non-definition quoted text not tagged JR-document-editing-007.8
  • No role model available (fallback) JR-document-editing-007.9

Edit Snippet Generation

JR-document-editing-008
When document edits are finalized, the system SHALL generate HTML snippets showing the changes made to the document. Snippets display deleted text with red strikethrough and inserted text with blue underline.
3 test scenarios
  • Single edit change JR-document-editing-008.1
  • Multiple edit changes JR-document-editing-008.2
  • No changes made JR-document-editing-008.3

Cover Note Integration

JR-document-editing-009
The document editing workflow SHALL include a "Snippets of Changes Made" section in the cover email body, showing visual representation of text changes.
2 test scenarios
  • Cover note includes snippets JR-document-editing-009.1
  • Snippet styling matches redline pipeline JR-document-editing-009.2

Edit Citation Field on Edit Tools

JR-document-editing-012
The system SHALL support an optional citation field on edit tools (smart_edit, smart_insert) to track the source of each edit for traceability.
3 test scenarios
  • smart_edit called with citation JR-document-editing-012.1
  • smart_insert called with citation JR-document-editing-012.2
  • Citation not provided (backward compatibility) JR-document-editing-012.3

Citation Model Structure

JR-document-editing-013
The system SHALL define an EditCitation model to capture edit provenance.
2 test scenarios
  • Playbook-sourced edit citation JR-document-editing-013.1
  • Email-sourced edit citation JR-document-editing-013.2

Smart Edit Rationale Parameter

JR-document-editing-017
The smart_edit_word_document tool SHALL accept an optional rationale_to_share_with_opposing_counsel parameter that, when provided, inserts a comment on the edited paragraph.
3 test scenarios
  • Edit with rationale creates comment JR-document-editing-017.1
  • Edit without rationale has no comment JR-document-editing-017.2
  • Failed edit does not create comment JR-document-editing-017.3

Smart Insert Rationale Parameter

JR-document-editing-018
The smart_insert_paragraph tool SHALL accept an optional rationale_to_share_with_opposing_counsel parameter that, when provided, inserts a comment on the newly inserted paragraph.
2 test scenarios
  • Insert with rationale creates comment on new paragraph JR-document-editing-018.1
  • Insert without rationale has no comment JR-document-editing-018.2

Multi-Paragraph Insertion Tool

JR-document-editing-020
The system MUST provide an insert_multiple_paragraphs tool that allows inserting multiple paragraphs in a single function call with automatic $LAST_INSERT chaining.
2 test scenarios
  • Insert section with subsections JR-document-editing-020.1
  • Error handling on partial failure JR-document-editing-020.2

List Deletion Interception

JR-document-editing-024
When the AI performs a DELETE operation (replacing text with empty string) that would remove an entire list item's content, and that list item is not the last item in its list, the system SHALL replace the deletion with [Intentionally omitted.] instead of actually deleting the content.

This preserves list numbering and prevents downstream section references from becoming stale.
4 test scenarios
  • Delete middle list item - intercept JR-document-editing-024.1
  • Delete last list item - allow JR-document-editing-024.2
  • Delete non-list paragraph - allow JR-document-editing-024.3
  • Partial text deletion within list item - allow JR-document-editing-024.4

Structural Paragraph Deletion

JR-document-editing-027
The system SHALL provide a delete_paragraph tool that removes a paragraph from a Word document by its structural para-N identifier, without requiring text-based string matching.

The tool SHALL:
- Accept a file_path parameter identifying the document attachment
- Accept a paragraph_id parameter in para-N format (e.g., para-15)
- Accept an optional rationale_to_share_with_opposing_counsel parameter
- Use get_paragraph_by_id() to locate the target paragraph
- Remove the paragraph via Aspose DOM operations
- Use run_document_modification() for file lifecycle management

When a rationale is provided, the system SHALL insert a Word comment on the paragraph immediately following the deleted paragraph (or preceding, if the deleted paragraph was last).
4 test scenarios
  • Delete paragraph by ID JR-document-editing-027.1
  • Delete paragraph with rationale JR-document-editing-027.2
  • Invalid paragraph ID JR-document-editing-027.3
  • Malformed paragraph ID JR-document-editing-027.4