Skip to content

fix(WikiPage): send fetch time as starttimestamp instead of touched - #69

Merged
dragon-fish merged 2 commits into
masterfrom
fix/edit-timestamps
Dec 3, 2026
Merged

dragon-fish merged 2 commits into
masterfrom
fix/edit-timestamps

Conversation

@dragon-fish

@dragon-fish dragon-fish commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

问题

WikiPage.edit() 用 pageInfo.touched 作为 starttimestamp。touched 是页面最后一次被触碰的时间;页面不存在时,它会退回到 DEFAULT_PAGE_INFO.touched,也就是 IPE 加载时的客户端时间。MediaWiki 会把 starttimestamp 之后发生的删除判定为 pagedeleted,所以:

  • 用快速删除删掉页面后不刷新,再用快速编辑重建,会被拒绝([BUG][IPE-0.14.2] 删后重建必须刷新一次 #10 的根因,之前是靠“再提交一次就改用 recreate”绕过去的)
  • newBlankPage().edit()(快速重定向、偏好导出到用户页)在页面开着期间目标被删过,也会被拒绝

改动

  • 所有取页查询都带 curtimestamp,实例新增 fetchedAt 字段记录本次取页的服务器时间(newFromApi / newBatchFromApi / reloadSelfInfo)
  • edit() 用 fetchedAt 作为 starttimestamp;没取过页的空白页不发送 starttimestamp,也不发送 basetimestamp
  • 新增单测,覆盖已加载页面、批量取页和空白页三种情况发出的时间戳(换回旧代码时 3 条全部失败)

Spec:docs/specs/2026-12-03-edit-conflict-timestamps.md。快速编辑的冲突处理(spec 决策 2–4)在后续的 PR 里做。

验证

  • vitest run src/models:58 条全部通过
  • typecheck:本次改动没有新增错误;preferences-ui 里原有的 4 条 Vue 组件类型错误与本次改动无关
  • 端到端测试(本地开发 wiki):IPE 加载后删除页面,不刷新直接用快速编辑重建——master 上报“在您取得页面时间戳以来,页面已被删除”,本分支第一次提交即成功;newBlankPage().edit() 不带时间戳也能正常写入

starttimestamp came from pageInfo.touched, which for a missing page falls back
to the client clock at IPE load. Recreating a page deleted after that, or
saving a blank page, was rejected as pagedeleted. Record curtimestamp of every
fetch and send it; blank pages send neither timestamp.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying inpageedit-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 91b8b06
Status:🚫  Build failed.

View logs

@dragon-fish
dragon-fish added this pull request to stack #71 December 3, 2026 10:34
@dragon-fish
dragon-fish merged commit b866731 into master Dec 3, 2026
2 of 3 checks passed
@dragon-fish
dragon-fish deleted the fix/edit-timestamps branch December 3, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant