Skip to content

Carry revisions and post-rename paths in repair_instance_page_slugs - #285

Open
bbliem wants to merge 1 commit into
mainfrom
fix/repair-page-slugs-revisions
Open

Carry revisions and post-rename paths in repair_instance_page_slugs#285
bbliem wants to merge 1 commit into
mainfrom
fix/repair-page-slugs-revisions

Conversation

@bbliem

@bbliem bbliem commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The command repaired live rows only, which left three ways for its own fix to come undone.

Revisions kept the slug and url_path they were saved with. The Wagtail edit form populates from the latest revision, so after a repair one Save draft in the admin wrote the old slug straight back. On a swap it was worse than a revert: after Longmont's September 2026 rename, longmont-2021's Spanish root still held a revision saying longmont-1, by then the live slug of longmont's Spanish root, and publishing it would have put two live siblings on one url_path. Every revision in the repaired trees is now rewritten to the live values -- which also gives the command something to do on an instance whose slugs already look right, the state a hand-applied rename leaves behind.

Disconnected descendants were collected before the renames and applied after them, so their targets were built from a prefix the renames had already moved. A child that Wagtail left orphaned was written back under the old prefix -- still unreachable, now behind a plausible-looking path. The repair is recomputed from live rows after both slug passes instead.

Both scans covered only the primary-language tree, so the same faults in a translated tree went unnoticed. They now walk every root in the translation_key set, the same set the slug pass already uses.

Also corrects the docs' claim that old paths keep working via Wagtail redirects: the public site resolves pages only through the GraphQL page(path:) resolver, which never consults wagtail.contrib.redirects, and instance root pages are not Site roots, so no redirects are created.

Each new test fails against the previous command and passes against this one.

The command repaired live rows only, which left three ways for its own fix
to come undone.

Revisions kept the slug and url_path they were saved with. The Wagtail edit
form populates from the latest revision, so after a repair one Save draft in
the admin wrote the old slug straight back. On a swap it was worse than a
revert: after Longmont's September 2026 rename, longmont-2021's Spanish root
still held a revision saying longmont-1, by then the live slug of longmont's
Spanish root, and publishing it would have put two live siblings on one
url_path. Every revision in the repaired trees is now rewritten to the live
values -- which also gives the command something to do on an instance whose
slugs already look right, the state a hand-applied rename leaves behind.

Disconnected descendants were collected before the renames and applied after
them, so their targets were built from a prefix the renames had already
moved. A child that Wagtail left orphaned was written back under the old
prefix -- still unreachable, now behind a plausible-looking path. The repair
is recomputed from live rows after both slug passes instead.

Both scans covered only the primary-language tree, so the same faults in a
translated tree went unnoticed. They now walk every root in the
translation_key set, the same set the slug pass already uses.

Also corrects the docs' claim that old paths keep working via Wagtail
redirects: the public site resolves pages only through the GraphQL
page(path:) resolver, which never consults wagtail.contrib.redirects, and
instance root pages are not Site roots, so no redirects are created.

Each new test fails against the previous command and passes against this one.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@kausal-code-coverage

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #285   +/-   ##
=======================================
  Coverage   56.98%   56.99%           
=======================================
  Files         357      357           
  Lines       52684    52684           
  Branches     8151     8151           
=======================================
+ Hits        30024    30026    +2     
+ Misses      20339    20338    -1     
+ Partials     2321     2320    -1     
Flag Coverage Δ
e2e-tests 18.59% <ø> (ø)
unittests 55.56% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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