Skip to content

Course base · Re-ingestion behaviour that preserves human edits #165

Description

@lucaosti

Sub-issue of #138. Depends on #164 (manual outline editing).

Goal

Define and implement what happens to an existing, reviewed outline when the underlying documents change.

The problem

A course has a reviewed, hand-corrected outline. The user then adds a document, replaces one, or deletes one. Today the behaviour is undefined, and both obvious options are wrong:

  • Regenerate everything — discards every human correction
  • Do nothing — the outline silently no longer reflects the material, and the student cannot tell

Proposed behaviour

Targeted invalidation rather than wholesale rebuild:

  1. Detect which chapters and lessons are affected by the changed documents, via source_refs_json
  2. Mark those items stale rather than deleting or regenerating them
  3. Surface staleness in the review UI, stating why
  4. Offer targeted regeneration per item, or accept-as-is
  5. Never overwrite a human-edited item without explicit confirmation
  6. For a genuinely new document with no overlap, propose new chapters rather than restructuring existing ones

Cases to handle

  • Document added, covering new material
  • Document added, overlapping existing chapters
  • Document replaced with a newer version of the same material
  • Document deleted — lessons sourced from it must not silently keep content whose source is gone
  • Document reprocessed with a different parser (USE_DOCLING toggled), changing chunk ids
  • All documents deleted

Tasks

  • Staleness model on chapters and lessons, with a reason
  • Detection linking document changes to affected items via source references
  • Targeted regeneration preserving human edits, per Ladder · Migrate the seven modules that read QVAC_SERVICE_URL directly #160's edit provenance
  • Review UI: staleness indicators, per-item regenerate, accept-as-is
  • Handle deleted sources — lesson content citing a removed document must be flagged, not silently kept
  • Tests for every case above

Acceptance criteria

  • No document change silently discards human edits
  • No document change silently leaves a stale outline unmarked
  • Affected items identified precisely, not by regenerating the course
  • Deleted sources flagged wherever their content is still referenced
  • Every case above covered by a test

Note

Chunk ids changing under a parser switch is the subtle one: source references can appear valid while pointing at different text. Hash source content, not just ids.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmvpRequired for the MVP

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions