Skip to content

fix(admin): allow publication-date retry after a conflict - #3491

Merged
ascorbic merged 1 commit into
mainfrom
codex/fix-publication-date-conflict
Sep 26, 2026
Merged

ascorbic merged 1 commit into
mainfrom
codex/fix-publication-date-conflict

Conversation

@ascorbic

Copy link
Copy Markdown
Member

What does this PR do?

Fixes the Browser Tests failure on main where a publication-date change cannot be retried after a 409 conflict. The editor fetches the latest revision token, but its conflict guard rejects the second date-only submission before it reaches the API.

Allow that retry only when the form has no unsaved content changes. Keep the save queue and conflict guard for content payloads, so a date retry cannot overwrite another writer's fields. The existing browser regression now also checks that the retry sends no content data.

Related: #2966, #3118. Main failure: https://github.com/emdash-cms/emdash/actions/runs/36242081870

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). No new strings.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/... (not applicable; bug fix)
  • I have included screenshots below if this PR changes the UI (no visual or layout change; behavior-only retry)

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Codex (gpt-6-sol)

Screenshots / test output

No visual or layout change. The browser regression exercises the conflict dialog, retries the date-only write with the recovered token, and verifies that no content fields are sent.

  • pnpm build
  • pnpm typecheck
  • pnpm lint
  • pnpm lint:quick; pnpm --silent lint:json | jq '.diagnostics | length' → 0
  • pnpm --dir packages/admin test --run tests/published-at-rev.test.tsx tests/publish-autosave-race.test.tsx → 29 passed

@changeset-bot

changeset-bot Bot commented Sep 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 20106ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-fix-publication-date-conflict.try.emdashcms.com, https://codex-fix-publication-date-conflict-emdash-playground.emdash-cms.workers.dev (commit 20106ce)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://cc8e260c.try.emdashcms.com, https://cc8e260c-emdash-playground.emdash-cms.workers.dev 20106ce 2026-09-26T14:52:32.946Z Visit the dashboard ↗

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Sep 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3491

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3491

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3491

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3491

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3491

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3491

emdash

npm i https://pkg.pr.new/emdash@3491

create-emdash

npm i https://pkg.pr.new/create-emdash@3491

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3491

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3491

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@3491

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3491

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3491

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3491

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@3491

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3491

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3491

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3491

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3491

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3491

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3491

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3491

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3491

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3491

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3491

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3491

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3491

commit: 20106ce

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a focused, low-risk bug fix for the admin publication-date conflict retry flow. The approach is sound: it special-cases a date-only retry by threading an opt-in flag through ContentEditor.runScheduleChange and ContentEditPage.serializeEditorSave, while preserving the existing conflict guard and save queue whenever the editor has pending content changes. That matches the PR goal of preventing a date retry from overwriting another writer’s content.

What I checked:

  • Read the full diff and the changed sections of ContentEditor.tsx, router.tsx, and packages/admin/tests/published-at-rev.test.tsx.
  • Traced the conflict/recovery flow (hasSaveConflict, conflictedEntryIdRef, recoverFromSaveConflict, publishedAtMutation) to confirm the retry uses the recovered revision token and does not send content data when there are no unsaved changes.
  • Verified the gate in ContentEditor.runScheduleChange still rejects when hasPendingSaveRef.current is true, even with allowUnmodifiedConflict: true.
  • Confirmed no new user-facing strings were added, so Lingui coverage is unaffected.
  • Reviewed the changeset against .changeset/README.md; the entry names the affected admin UI surface, identifies the user-visible problem, and is proportional for a patch fix.

Everything looks correct. The implementation is consistent with the existing code, the test now asserts the retry body carries no data, and I found no regressions or AGENTS.md violations.

@github-actions github-actions Bot added area/admin size/S review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Sep 26, 2026
@ascorbic
ascorbic enabled auto-merge (squash) September 26, 2026 15:23
@ascorbic
ascorbic merged commit bf1aa14 into main Sep 26, 2026
40 checks passed
@ascorbic
ascorbic deleted the codex/fix-publication-date-conflict branch September 26, 2026 15:44
@emdashbot emdashbot Bot mentioned this pull request Sep 26, 2026
@kgni kgni mentioned this pull request Sep 26, 2026
8 of 19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin review/approved Approved; no new commits since size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant