Carry revisions and post-rename paths in repair_instance_page_slugs - #285
Open
bbliem wants to merge 1 commit into
Open
Carry revisions and post-rename paths in repair_instance_page_slugs#285bbliem wants to merge 1 commit into
bbliem wants to merge 1 commit into
Conversation
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.