Allow Welsh-language mainstream URLs [WHIT-3436]#11442
Open
GDSNewt wants to merge 1 commit into
Open
Conversation
80db2fe to
7bc045a
Compare
jamiestamp
reviewed
May 13, 2026
f368fb0 to
1cabc1c
Compare
522daf1 to
b72739f
Compare
…on groups The Publishing API's lookup_content_id endpoint does not index translated (Welsh) base paths, causing a false "must reference a GOV.UK page" error when users tried to add Welsh mainstream URLs to a document collection. Fall back to the Content Store when both Publishing API lookups return no content ID, as the Content Store resolves content items by any translated base path. If the Content Store also returns a 404, the original error is still raised. Adds Services.content_store using GdsApi::ContentStore, and updates tests to cover the Welsh URL case and to stub the Content Store in the existing "not found" test.
b72739f to
adc8991
Compare
Contributor
ChrisBAshton
left a comment
There was a problem hiding this comment.
Looks broadly fine - document collections need a bit more love in general anyway - but we do have an opportunity to simplify with Content Store calls and dropping Publishing API calls 🤞
Comment on lines
+34
to
+35
| content_id | ||
| @content_item ||= content_item_from_content_store |
Contributor
There was a problem hiding this comment.
This kind of 'side effect' method (content_id) isn't very readable. Probably best being more open that one is dependent on the other:
Suggested change
| content_id | |
| @content_item ||= content_item_from_content_store | |
| @content_item ||= content_item_from_content_store(content_id) |
| end | ||
|
|
||
| def content_id | ||
| @content_id ||= Services.publishing_api.lookup_content_id(base_path: parsed_url.path, with_drafts: true) |
Contributor
There was a problem hiding this comment.
I thought we agreed to drop this call and just call Content Store right off the bat? It would simplify things a lot.
Contributor
|
I assume we're willing to live with any lag between publishing-api pushing the latest content to the content store? Worst that would happen is the user would see the same error as now. |
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.
Welsh-only GOV.UK pages (e.g. /talu-treth-twe) were failing validation with "Url must reference a GOV.UK page" when added to document collection groups. The root cause was that get_content in the Publishing API defaults to locale: en, so Welsh-only content — which only exists in locale: cy — returned a 404.
This PR replaces get_content with the Content Store for fetching content items. The Content Store serves content regardless of locale, so Welsh URLs now resolve correctly.
The guide sub-page check (which validates that a two-segment path like /guidance/subpage belongs to a guide) continues to work because the Content Store returns the parent guide's content item for sub-page paths, making document_type available directly from that response.
BEFORE
Screen.Recording.2026-05-13.at.17.24.09.mov
AFTER
Screen.Recording.2026-05-13.at.17.23.03.mov
Jira