Skip to content

fix: handle edge case where two end points provide same resource which efers two 2 datasets - #570

Merged
tombrooks248 merged 1 commit into
mainfrom
fix/handel-double-endpoint-double-dataset-single-resource-edge-case
Jun 29, 2026
Merged

fix: handle edge case where two end points provide same resource which efers two 2 datasets#570
tombrooks248 merged 1 commit into
mainfrom
fix/handel-double-endpoint-double-dataset-single-resource-edge-case

Conversation

@tombrooks248

@tombrooks248 tombrooks248 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

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-direction collection (346 resources):

  • Only 3 of 346 resources changed.
  • Every change was additive — a file that had one dataset now correctly has
    both. No file lost a dataset, no endpoints changed, no rows added or removed.
  • The 3 changed resources are exactly the shared-file edge case (including the
    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.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[optional] Are there any post deployment tasks we need to perform?

[optional] Are there any dependencies on other PRs or Work?

@tombrooks248
tombrooks248 marked this pull request as ready for review June 26, 2026 15:12
@tombrooks248
tombrooks248 merged commit 3e5ec5c into main Jun 29, 2026
5 checks passed
@tombrooks248
tombrooks248 deleted the fix/handel-double-endpoint-double-dataset-single-resource-edge-case branch June 29, 2026 08:35
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.

2 participants