Skip to content

[hardening] Cross-paragraph annotation spans silently truncated #55

@MTCMarkFranco

Description

@MTCMarkFranco

Enhancement

OpenXmlMarkupService.LocateParagraph returns the first paragraph that contains charStart and never considers charStart + span.Length. Spans that legitimately cross a paragraph boundary (e.g. a sentence rule that matches across a soft break, a heading + first body sentence) are silently truncated to the first paragraph.

Location: src/LambdaRag.Markup/OpenXmlMarkupService.cs LocateParagraph (~line 197)

Expected behaviour options (pick one in implementation):

  1. Locate both start and end paragraphs; emit a single comment whose range crosses paragraphs (OOXML supports this — CommentRangeStart in P1, CommentRangeEnd in P2).
  2. Reject cross-paragraph spans with a logged warning and a typed AnnotationApplicationFailure outcome rather than silent fallback.

Acceptance criteria

  • Decision documented in the implementation PR.
  • Unit test covering a cross-paragraph annotation: either correct multi-paragraph range OR explicit rejection with logged warning.
  • Existing single-paragraph behaviour unchanged.
  • Idempotency + engine genericity tests still pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmodalityOutput modality (report/markup/UI/API)phase-1-pattern-defPhase 1: Pattern definition (writing)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions