Skip to content

Fix evidence validation, debug diagnostics, and media bundling - #3

Merged
FFFFFFpy merged 11 commits into
mainfrom
fix/evidence-debug-media
Jul 10, 2026
Merged

FFFFFFpy merged 11 commits into
mainfrom
fix/evidence-debug-media

Conversation

@FFFFFFpy

Copy link
Copy Markdown
Owner

Summary

This fixes the failure pattern reproduced by the supplied wxarticle2md article, where all entities and relations were discarded as invalid evidence and a referenced local MP4 was omitted from the supposedly self-contained bundle.

Evidence extraction

  • Standardize concepts, entities, and relations on quote-based evidence:
    • section_id
    • verbatim quote
  • Resolve quotes deterministically inside the selected section and calculate absolute source line ranges in the compiler.
  • Keep legacy line-based evidence validation for compatibility.
  • Return structured rejection reasons such as quote_not_found, ambiguous_quote, and line_range_outside_section.

Diagnostics and degraded state

  • Add --debug-dir structured sidecar diagnostics.
  • Add opt-in --debug-llm-payloads for prompts, raw responses, and parsed JSON.
  • Add stage-level returned/accepted/rejected counts.
  • Distinguish ok, degraded, and failed extraction.
  • Add --strict to return a non-zero exit code for degraded extraction while retaining the generated bundle for inspection.

Portable assets

  • Bundle referenced local HTML img, video, audio, and source assets in addition to Markdown images.
  • Rewrite references into assets/images/ or assets/media/.
  • Expose media counts and all collected assets in manifest.json / source_map.json.

Validation

  • 25 passed
  • ruff check src tests: passed
  • Reproduced against the supplied article package:
    • 5 sections retained
    • 2 images bundled
    • video_001.mp4 bundled and rewritten
    • quote evidence resolved to real source lines, including lines 54, 125, and 129

This PR is intentionally left as Draft for review and a live LLM rerun before merge.

@FFFFFFpy
FFFFFFpy marked this pull request as ready for review July 10, 2026 18:27
@FFFFFFpy
FFFFFFpy merged commit ff58679 into main Jul 10, 2026
4 checks passed
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.

1 participant