Skip to content

fix: Exclude ended resources from duplicate endpoint check in query - #1228

Merged
gibahjoe merged 2 commits into
mainfrom
1198-dont-allow-duplicate-endpoint-to-be-submitted
Jul 13, 2026
Merged

fix: Exclude ended resources from duplicate endpoint check in query#1228
gibahjoe merged 2 commits into
mainfrom
1198-dont-allow-duplicate-endpoint-to-be-submitted

Conversation

@gibahjoe

@gibahjoe gibahjoe commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

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

Description

Updates the duplicate endpoint check so ended resources no longer prevent an endpoint from being recognised as already collected for the same dataset and organisation.

The check still excludes ended endpoints.

Related Tickets & Documents

  • Ticket Link
  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

Run the focused unit test:

npx vitest run test/unit/utils/endpointAlreadyCollected.test.js

Expected result: the test file passes, including coverage that the Datasette query no longer filters on r.end_date but still filters on e.end_date.

No screenshots or recordings are included because this is a backend query change with no UI impact.

Added/updated tests?

  • Yes
  • No, and this is why:
  • I need help with writing tests

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

None.

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

None.

Summary by CodeRabbit

  • Bug Fixes

    • Adjusted duplicate-endpoint checking so ended resources are no longer incorrectly excluded.
    • Improved the query logic used to identify existing endpoint records.
  • Tests

    • Added coverage to confirm the duplicate-check query no longer applies the removed resource-end-date filter.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b1123103-39f4-470b-a172-ee93c8a393e2

📥 Commits

Reviewing files that changed from the base of the PR and between 325cd18 and 5385679.

📒 Files selected for processing (2)
  • src/utils/datasetteQueries/endpointAlreadyCollected.js
  • test/unit/utils/endpointAlreadyCollected.test.js
💤 Files with no reviewable changes (1)
  • src/utils/datasetteQueries/endpointAlreadyCollected.js

Walkthrough

The SQL query in endpointAlreadyCollectedForDataset was modified to remove the r.end_date filter condition from its WHERE clause. A corresponding unit test was added to verify the query no longer excludes ended resources based on r.end_date.

Changes

Duplicate Endpoint Query Fix

Layer / File(s) Summary
Remove end_date filter and add test
src/utils/datasetteQueries/endpointAlreadyCollected.js, test/unit/utils/endpointAlreadyCollected.test.js
The r.end_date condition is removed from the duplicate-endpoint query's WHERE clause, and a new unit test asserts the query retains ended resources by checking for an e.end_date condition and the absence of an r.end_date filter.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A single filter hopped away,
No more r.end_date in the fray.
Tests now check the query stays true,
Ended resources welcomed through! 🐇
Hop, hop, review's done today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adjusting the duplicate endpoint query to ignore ended resources.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1198-dont-allow-duplicate-endpoint-to-be-submitted

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 70.98% 2540 / 3578
🔵 Statements 70.14% 2679 / 3819
🔵 Functions 64.13% 506 / 789
🔵 Branches 63.97% 1250 / 1954
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/utils/datasetteQueries/endpointAlreadyCollected.js 100% 100% 100% 100%
Generated in workflow #1554 for commit 20a3cc2 by the Vitest Coverage Report Action

@gibahjoe
gibahjoe merged commit fc68d4a into main Jul 13, 2026
5 checks passed
@gibahjoe
gibahjoe deleted the 1198-dont-allow-duplicate-endpoint-to-be-submitted branch July 13, 2026 11:21
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