Skip to content

Conversation

@cka-y
Copy link
Contributor

@cka-y cka-y commented Dec 15, 2025

Summary:
This pull request introduces a new mechanism for redirecting duplicate MDB feeds to their corresponding TDG-imported feeds, along with comprehensive tests and a supporting database constraint update. The main changes include the implementation of a new handler for updating redirects based on a CSV mapping, integration of this handler into the task executor, and the addition of tests to ensure correctness. Additionally, a database migration enforces non-null operational status for feeds.

Redirects and Data Import Improvements:

  • Added a new handler (update_tdg_redirects_handler) in update_tdg_redirects.py to process a CSV mapping of MDB to TDG feeds, ensuring database redirects are created or updated as needed, with support for dry-run and batch commits.
  • Registered the new "mdb_to_tdg_redirect" task in main.py, making the handler available as a callable task with a description. [1] [2]

Testing:

  • Introduced a new test suite (test_redirect_mdb_feeds.py) covering various scenarios for the redirect logic, including creation, missing feeds, existing redirects, and CSV load failures.

Database Migration:

  • Added a new Liquibase migration (fix_operation_status_constraint.sql) to set all null operational_status values in the feed table to 'published' and enforce the column as non-null, referenced in the main changelog. [1] [2]

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@cka-y cka-y self-assigned this Dec 15, 2025
@cka-y cka-y requested a review from Copilot December 15, 2025 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@cka-y cka-y requested a review from Copilot December 15, 2025 15:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Copy link
Contributor

@qcdyx qcdyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cka-y cka-y requested review from davidgamez and qcdyx December 18, 2025 12:23
@cka-y
Copy link
Contributor Author

cka-y commented Dec 18, 2025

Post release we can set the TDG redirects by running the task-executor-prod function with parameters:

{
  "task": "mdb_to_tdg_redirect",
  "payload": {
    "dry_run": false
  }
}

I suggest running the function after TDG feeds as set as published to avoid redirecting to a wip feed that is not accessible to users.

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

-- 2. Set default for future inserts
ALTER TABLE feed
ALTER COLUMN operational_status
SET DEFAULT 'published';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


feed.status = _compute_status_from_end_date(resource.get("metadata") or {})
feed.operational_status = "wip"
feed.operational_status = "published"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@davidgamez davidgamez merged commit 9cd5f52 into main Dec 18, 2025
3 checks passed
@davidgamez davidgamez deleted the feat/tdg-redirect branch December 18, 2025 14:16
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.

4 participants