feat(mentor): apply/skip fix cards (#25)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Fix Cards become actionable. Mechanical cards offer Apply behind a blocking ask-before sheet showing the exact edit (anchored quote -> replacement, occurrence + context; empty fix cuts); the sheet is the only path to a write, one card at a time, no apply-all. The edit lands through the editing session (pending edits flush first, the editor re-seeds via adoptText, the card closes applied); Skip and Done close the card in place, recording nothing; demonstration cards close Done/Skip only (ADR-0006). Cards arrive ranked (store-stamped, scan-ordered, open-first palette) and capped at ten per submit — the app keeps the ranked head and the wire reply discloses the drop. Stale anchors re-validate at apply: no text selected or changed, the card flags itself. Includes the finish-audit round (11 fixes, 2 flip-verified pins); 316 tests green. Closes #25
This commit is contained in:
1 parent
5700264628
commit
4d33676a08
15 files changed
+1012
-74
No files matched your search
@@ -263,6 +263,30 @@ final class EditorSession {
|
||||
onError?(nil)
|
||||
}
|
||||
|
||||
/// #25: adopt externally-computed text (Fix Card apply) — Yes-reload's
|
||||
/// body with a provided text: bumps loadGeneration so both surfaces
|
||||
/// (the prose coordinator seeds from session.text on a generation move,
|
||||
/// PostEditorView.swift:405; OutlineEditorView re-parses on the bump)
|
||||
/// re-seed, then flushes to disk now. Writer-consented explicit action
|
||||
/// (like ⌘S) — the #67 conflict guard is the CALLER's job.
|
||||
@discardableResult
|
||||
func adoptText(_ newText: String) -> Bool {
|
||||
// A session that never loaded must never write (the flush guard's
|
||||
// own rule, made explicit here: flush reports success on a clean
|
||||
// no-op, so a loadFailed session would close cards over a write
|
||||
// that never landed).
|
||||
guard !loadFailed else { return false }
|
||||
// A session that never loaded must never write (the flush guard's
|
||||
// own rule, made explicit here: flush reports success on a clean
|
||||
// no-op, so a loadFailed session would close cards over a write
|
||||
// that never landed).
|
||||
debounceTask?.cancel()
|
||||
text = newText
|
||||
loadText = newText
|
||||
loadGeneration += 1
|
||||
return flush()
|
||||
}
|
||||
|
||||
/// #67 No: keep local — the next autosave overwrites disk (the writer's
|
||||
/// explicit choice). Marks the disk state as seen so the same external
|
||||
/// content doesn't re-alert on every watcher tick; a new external write
|
||||
|
||||
Reference in new issue
Block a user