fix: handle edge case where two end points provide same resource which efers two 2 datasets - #570
Merged
tombrooks248 merged 1 commit intoJun 29, 2026
Conversation
… refers two 2 datasets
tombrooks248
marked this pull request as ready for review
June 26, 2026 15:12
pooleycodes
approved these changes
Jun 26, 2026
tombrooks248
deleted the
fix/handel-double-endpoint-double-dataset-single-resource-edge-case
branch
June 29, 2026 08:35
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.
What type of PR is this? (check all applicable)
Description
When the collection process records which dataset(s) are contained in what resource it was overwriting that list instead of adding to it whenever a resource came from more than one endpoint. So if a resource contained several datasets, only the last one survived and the rest were lost.
We changed it to add each dataset to the list rather than replace it, so a resource that belongs to more than one dataset now keeps all of them. The same small fix was applied in the two places that build this record (one for brand-new files, one for updating existing ones), and we added unit tests covering both.
Why
A resource is identified by a fingerprint of its contents.
If two different URLs serve a file with identical contents, the system correctly treats them as the same resource.
Adur is the first case we've hit where two different endpoints feed two different datasets but happen to serve the identical file — their A4D and A4DA URLs return the same data. The correct record is "this file belongs to both
article-4-direction and article-4-direction-area." But because of the overwrite bug, the file ended up recorded against only one of them (and which one was essentially random, depending on processing order).
That single-dataset record then flows through to datasette, and the submit service uses it to work out which dataset a file belongs to. With a dataset missing, the Adur task showed up in some views but not others and wasn't clickable from the task list. This fix makes the file correctly belong to both datasets, so the task resolves properly.
(Note: this corrects how the record is generated going forward — the Adur data fixes itself the next time that collection runs and regenerates its files. No manual backfill is needed.)
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
How we know it's safe
Ran a before/after comparison of the regenerated records on the real DEV
article-4-directioncollection (346 resources):both. No file lost a dataset, no endpoints changed, no rows added or removed.
resource from the original bug report). The other 343 were untouched.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above. Please refer to the Digital Land Testing Guidance for more information.
have not been included
[optional] Are there any post deployment tasks we need to perform?
[optional] Are there any dependencies on other PRs or Work?