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:
- Detect which chapters and lessons are affected by the changed documents, via
source_refs_json
- Mark those items stale rather than deleting or regenerating them
- Surface staleness in the review UI, stating why
- Offer targeted regeneration per item, or accept-as-is
- Never overwrite a human-edited item without explicit confirmation
- For a genuinely new document with no overlap, propose new chapters rather than restructuring existing ones
Cases to handle
Tasks
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.
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:
Proposed behaviour
Targeted invalidation rather than wholesale rebuild:
source_refs_jsonCases to handle
USE_DOCLINGtoggled), changing chunk idsTasks
Acceptance criteria
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.