{"record":{"id":"8000658169ca8177","repo":"jackwener/OpenCLI","slug":"expected-expected-actual-result-va","errorCode":null,"errorMessage":"定时设置未验证成功: expected=${expected} actual=${result.value || ''}","messagePattern":"定时设置未验证成功: expected=(.+?) actual=(.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/wechat-channels/publish.js","lineNumber":513,"sourceCode":"      await sleep(300);\n\n      // 6. Read back the display input to confirm the value landed.\n      var inp = deepQuery('input[placeholder*=\"发表时间\"]');\n      return { ok: true, value: inp ? inp.value : null };\n    })(${targetYear}, ${targetMonth}, ${targetDay}, ${targetHour}, ${targetMin})\n  `);\n\n  if (!result?.ok) {\n    await page.screenshot({ path: '/tmp/wechat-channels_schedule_debug.png' });\n    const reason = result?.reason ? String(result.reason) : 'empty picker result';\n    throw new CommandExecutionError(\n      `定时设置失败 (${reason})，截图: /tmp/wechat-channels_schedule_debug.png`,\n    );\n  }\n\n  const expected = `${targetYear}-${pad(targetMonth)}-${pad(targetDay)} ${pad(targetHour)}:${pad(targetMin)}`;\n  if (!String(result.value || '').includes(expected)) {\n    throw new CommandExecutionError(`定时设置未验证成功: expected=${expected} actual=${result.value || ''}`);\n  }\n  process.stderr.write(`  定时设置完成: ${result.value || expected}\\n`);\n}\n\n// ── Helper: click publish or draft button ────────────────────────────────────\nasync function clickPublish(page, isDraft) {\n  const labels = isDraft\n    ? ['存草稿', '保存草稿', '草稿']\n    : ['发表', '发布'];\n\n  const clicked = await evalPage(page, `\n    (function(labels) {\n      ${DEEP_QUERY_FN}\n      var btns = deepQueryAll('button');\n      for (var i = 0; i < btns.length; i++) {\n        var btn = btns[i];\n        var text = (btn.innerText || btn.textContent || '').trim();\n        var isDisabled = btn.disabled || btn.getAttribute('disabled') !== null ||","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/wechat-channels/publish.js#L495-L531","documentation":"After setScheduleTime fills the schedule picker, it verifies the picker's displayed value contains the expected 'YYYY-MM-DD HH:mm' string. If the displayed value differs, it throws CommandExecutionError, meaning the schedule was applied but the confirmation readback does not match the requested time.","triggerScenarios":"String(result.value) does not include the expected formatted datetime, e.g. picker zero-padding differs, value was normalized/clamped by the site, or the picker silently ignored one of the fields.","commonSituations":"Requesting a time that the site rounds (e.g. only minute granularity of 5 allowed); locale-formatted dates; site clamping near-midnight times; DOM readback returning concatenated values in a different format after a frontend update.","solutions":["Log the actual result.value to see how the site formatted the time","Check the requested time is valid and not auto-corrected by the site (past time, rounded minutes)","Adjust the expected format or comparison to match current site output format","Take a manual look at the page (or screenshot) to confirm whether the schedule actually took effect"],"exampleFix":"// before\nif (!String(result.value || '').includes(expected)) {\n  throw new CommandExecutionError(`定时设置未验证成功: expected=${expected} actual=${result.value || ''}`);\n}\n// after\nconst normalized = String(result.value || '').replace(/\\s+/g, ' ').trim();\nif (!normalized.includes(expected) && !normalized.includes(expected.replace(/\\b0(\\d)/g, '$1'))) {\n  throw new CommandExecutionError(`定时设置未验证成功: expected=${expected} actual=${normalized}`);\n}","handlingStrategy":"try-catch","validationCode":"const expected = `${y}-${String(mo).padStart(2,'0')}-${String(d).padStart(2,'0')} ${String(h).padStart(2,'0')}:${String(mi).padStart(2,'0')}`;\nif (!/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$/.test(expected)) throw new Error('Bad schedule format');","typeGuard":"function isScheduleResult(r) {\n  return !!r && typeof r === 'object' && typeof r.value === 'string' && r.value.length > 0;\n}","tryCatchPattern":"try {\n  await setScheduleTime(page, y, mo, d, h, mi);\n} catch (e) {\n  if (/定时设置未验证成功/.test(e.message)) {\n    const actual = e.message.split('actual=')[1];\n    console.warn(`Schedule readback mismatch (expected vs actual): ${actual}`); // verify manually before retry\n  } else throw e;\n}","preventionTips":["Normalize date formats (zero-padding) before comparison","Verify the requested time is not auto-rounded by the site","Log result.value for diagnostics","Confirm schedule visually with --manual on first run of a new site version"],"tags":["wechat-channels","scheduling","verification"],"backgroundTag":"schedule-verification-mismatch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}