Repository navigation
fix(core): skip slug-change redirects without a URL pattern - #4337
emdash-autofix[bot] wants to merge 1 commit into
Conversation
Return null before redirect writes when the collection URL pattern is NULL or empty, preventing guessed fallback redirects for both direct slug updates and staged publishes. Added repository and handler regressions, a patch changeset, and SEO documentation including the upgrade action for sites relying on fallback URLs. Verified root build, focused redirect/content tests, core typecheck, quick lint (zero diagnostics), formatting, docs build, and whitespace checks. Independent review and follow-up completed without outstanding findings. EmDash-Bot-Case: 1198246700-issue-5972562856 EmDash-Bot-Candidate: cand-1-11e0f8a029
EmDash bot: Changes requiredPlan Implementation and focused verification are complete, but review identified a release-policy blocker: a maintainer must decide how to handle existing sites relying on NULL-pattern fallback redirects.
Status
Next action: The bot will respond to the review. Details
Required checks on the current head:
This status is generated from recorded evidence. It is not a review and contains no instructions. |
🦋 Changeset detectedLatest commit: 8ee30a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://emdash-bot-issue-4334.try.emdashcms.com, https://emdash-bot-issue-4334-emdash-playground.emdash-cms.workers.dev (commit 8ee30a9)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 8ee30a9 | Oct 22 2026, 03:50 AM |
There was a problem hiding this comment.
The approach is sound: guarding createAutoRedirect in the shared repository, before the write lock, stops invented /{collection}/{slug} redirects. It covers both the direct slug edit and the staged _slug publish, and it leaves manual rules alone. Reviewers agreed there are no implementation defects, and the new tests cover both paths with real databases. They disagreed on the verdict. One approved with no findings. The other requested changes because the change silently alters default behavior for existing sites that serve the fallback URLs, and it ships as a patch without the maintainer sign-off that AGENTS.md and the changeset README require. Because one reviewer raised a blocking finding, the verdict is request_changes.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
| oldPublishedAt?: string | null, | ||
| newPublishedAt?: string | null, | ||
| ): Promise<Redirect | null> { | ||
| if (!urlPattern) return null; |
There was a problem hiding this comment.
[needs fixing] This also disables working behavior for existing collections with a NULL pattern that actually serve /{collection}/{slug}. After upgrading, renaming a published entry from b to c leaves /posts/b returning 404, and an existing /posts/a → /posts/b rule is no longer collapsed. The previous fallback regression test covered this supported behavior, and the changeset acknowledges that users must change their configuration to keep it.
AGENTS.md requires an explicit compatibility decision and a major release for breaking changes on 1.x. .changeset/README.md also requires prior maintainer approval for significant default changes. The PR context says that approval is still outstanding, yet this ships as "emdash": patch. Get the maintainer's compatibility decision and release strategy before shipping, or provide a compatibility-preserving way to opt custom-routed collections out. Documenting the workaround alone does not satisfy the policy.
The other reviewer (claude-opus-5-5) did not flag this as blocking. It noted the behavior change and the maintainer sign-off requirement but approved, since the changeset gives a concrete migration (set /posts/{slug} explicitly) and the PR description calls out the need for sign-off.
There was a problem hiding this comment.
Agreed that the migration note does not supply release approval. The same NULL value currently represents both sites using the fallback paths and sites with unknown custom routes, so this guard cannot distinguish them. It fixes the reported guessed redirects but also stops working redirect creation and chain collapse for the former group.
I’m requesting a maintainer decision on whether to approve the explicit-pattern requirement and its release strategy, or retain fallback behavior and pursue a compatibility-preserving opt-out. I won’t change the release classification or add a new configuration API without that decision.
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-ai-search
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
What does this PR do?
Skips automatic slug-change redirects when a collection's URL pattern is NULL or empty. Previously, the URL interpolation fallback invented
/{collection}/{slug}redirect paths even when the site served entries through custom Astro routes. The shared repository now returns null before acquiring the redirect write lock or changing any redirect rules, so both direct updates and staged slug publishes treat the redirect as not created.This deliberately stops automatic redirects for NULL-pattern collections, including sites that really serve the fallback paths. To preserve those redirects, set an explicit matching URL pattern, such as
/posts/{slug}. The changeset and SEO guide explain this upgrade action and the difference from sitemap/menu fallbacks. The empty-string case already produced no redirect; tests retain coverage for it.Adds regressions for both publish paths, no-pattern repository calls, and preservation of manual rules. Configured URL patterns remain authoritative: this does not infer custom nested routes or fix a configured pattern that differs from the site's routing. Trailing-slash handling (#3437) is unchanged. No migration removes existing incorrect redirects; sites with custom routing must manage redirects for their real public URLs. Existing publish-time cleanup of auto rules shadowing a fallback path is unchanged.
Closes #4334
Type of change
Your connection to this change
Project-operated autofix bot working on the reported bug through auto-intake, under the AI policy's autofix exception. Maintainer approval is required before merge.
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI assistance disclosure
Screenshots / test output
Screenshots: Not applicable; no UI rendering changes.
Passed:
pnpm buildpnpm --filter emdash exec vitest run tests/integration/redirects tests/unit/api/content-handlers.test.tspnpm --filter emdash typecheckpnpm lint:quick(zero diagnostics)pnpm formatpnpm --dir docs buildgit diff --checkThe new NULL-pattern repository tests failed before the fix by returning
/posts/old-slug→/posts/new-slug. Tests pass with the guard. Direct-update tests use the dialect wrapper; SQLite ran locally, PostgreSQL was not configured. Full workspace typecheck and type-aware lint are left to CI.The EmDash bot took this issue on automatically when it was opened; no maintainer has assigned it yet.