{"record":{"id":"9ebf02f8c36411a6","repo":"pbakaus/impeccable","slug":"impeccable-apply-returned-no-verified-edits","errorCode":null,"errorMessage":"[impeccable] apply returned no verified edits:","messagePattern":"\\[impeccable\\] apply returned no verified edits:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"skill/scripts/live-browser.js","lineNumber":4145,"sourceCode":"        const errBody = await res.json().catch(() => ({}));\n        throw new Error(errBody.error || ('HTTP ' + res.status));\n      }\n      const result = await res.json();\n      if (res.status === 202 || result.status === 'started') {\n        waitForSseCompletion = true;\n        return;\n      }\n      const remaining = remainingManualEditCount(result);\n      updatePendingCounter(remaining);\n      if (result.failed && result.failed.length > 0) {\n        console.warn('[impeccable] some copy edits failed:', result.failed);\n        showToast('Applied ' + (result.applied?.length || 0) + ', ' + result.failed.length + ' failed - see console', 5000);\n      } else {\n        const n = Array.isArray(result.applied) ? result.applied.length : (result.cleared || 0);\n        if (n > 0) {\n          showToast('Applied ' + n + ' edit' + (n === 1 ? '' : 's'), 2500);\n        } else {\n          console.warn('[impeccable] apply returned no verified edits:', result);\n          showToast('No edits applied - see console', 4000);\n        }\n      }\n    } catch (err) {\n      console.error('[impeccable] commit failed:', err);\n      showToast('Apply failed - see console', 4000);\n    } finally {\n      if (waitForSseCompletion) return;\n      const remainingCount = parseInt(pendingPillEl?.dataset.count || '0', 10) || 0;\n      if (remainingCount > 0) setPendingApplyLoading(false);\n      else hidePendingApplyDock();\n    }\n  }\n\n  async function onPendingTrashClick() {\n    const count = parseInt(pendingPillEl?.dataset.count || '0', 10);\n    if (count <= 0 || pendingApplyInFlight) return;\n    const ok = confirm('Discard ' + count + ' copy edit' + (count === 1 ? '' : 's') + ' on this page?');","sourceCodeStart":4127,"sourceCodeEnd":4163,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/skill/scripts/live-browser.js#L4127-L4163","documentation":"The impeccable live-mode browser script logs this warning when the POST to the local server's /manual-edit-commit endpoint succeeds (HTTP 2xx) but the response contains no verified applied edits — result.applied is empty/not an array and result.cleared is 0. It is a sanity check that the commit actually changed the source; the server may have journal-cleared entries without writing them, or returned an unexpected shape. A toast tells the user no edits landed and the full server response is dumped to the console for diagnosis.","triggerScenarios":"Clicking the pending-changes pill in live mode and confirming 'Apply N copy edits to source' when the /manual-edit-commit response parses but yields applied.length === 0 and cleared === 0; e.g. the server verified zero ops because stashed edits were stale, already consumed, or filtered out as unsafe before any write.","commonSituations":"Stale stash from a previous page whose entries were cleared server-side; edits the server rejected as unsafe-to-write (removed elements, changed DOM); a server version mismatch where the response shape changed; two browser tabs sharing the same stash so one tab already committed the edits.","solutions":["Open the browser console and inspect the logged result object to see what the server actually returned (status, cleared, failed).","Refresh the page so the pending count re-syncs from the server's /manual-edit-stash endpoint, then retry the apply.","Re-pick the element and redo the copy edit if the stash contained edits pointing at DOM that no longer exists.","Check that the impeccable engine/server version matches the in-page script version (mismatched shapes cause empty applied arrays)."],"exampleFix":"// before: applying possibly stale stash blindly\nawait fetch('.../manual-edit-commit?async=1', { method: 'POST' });\n// after: check stash is non-empty and server response is sane before committing\nconst pre = await fetch('.../manual-edit-stash?...').then(r => r.json());\nif (!pre.count) { showToast('No pending edits to apply'); return; }\nconst result = await fetch('.../manual-edit-commit', { method: 'POST' }).then(r => r.json());\nif (!(result.applied?.length || result.cleared)) console.warn('no verified edits:', result);","handlingStrategy":"validation","validationCode":"const pre = await fetch('/manual-edit-stash?...').then(r => r.json()).catch(() => null);\nif (!pre || !pre.count) return; // nothing to apply; skip commit\n// after commit, before trusting UI:\nconst applied = Array.isArray(result.applied) ? result.applied.length : (result.cleared || 0);\nif (applied === 0) console.warn('commit verified no edits:', result);","typeGuard":"function hasVerifiedEdits(result) {\n  return Array.isArray(result?.applied) && result.applied.length > 0\n    || (typeof result?.cleared === 'number' && result.cleared > 0);\n}","tryCatchPattern":"try {\n  const result = await commitRes.json();\n  if (!hasVerifiedEdits(result)) {\n    console.warn('[impeccable] apply returned no verified edits:', result);\n    // surface non-blocking toast, keep stash for retry after refresh\n  }\n} catch (err) {\n  console.error('[impeccable] commit failed:', err);\n}","preventionTips":["Refresh the page before applying a long-lived stash so DOM references are re-validated.","Check /manual-edit-stash count before committing to avoid empty commits.","Keep the engine/server and in-page script versions in lockstep.","Use a single browser tab per project during live sessions."],"tags":["browser","http","state-sync","empty-result"],"backgroundTag":"empty-api-response","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}