Skip to content

feat(cli): add get-invalid-dates command [DATA-32564]#17

Open
quocnguyendinh wants to merge 5 commits intomasterfrom
DATA-32564/add-get-invalid-dates-cli
Open

feat(cli): add get-invalid-dates command [DATA-32564]#17
quocnguyendinh wants to merge 5 commits intomasterfrom
DATA-32564/add-get-invalid-dates-cli

Conversation

@quocnguyendinh
Copy link
Copy Markdown
Collaborator

@quocnguyendinh quocnguyendinh commented Apr 1, 2026

DATA-32564

Background

The data-diff recovery process currently requires manually reading diff logs and copying invalid dates into the recovery DAG. To automate this, we need a CLI command that queries the diffa DB for invalid dates.

Design

  • New get-invalid-dates CLI command that queries diffa_checks where is_valid = False
  • Reuses existing DiffaCheckService.get_invalid_check_dates() — no new DB logic
  • Accepts same source/target filter params as data-diff for matching stored records
  • Outputs JSON list of ISO date strings to stdout (e.g., ["2025-10-28", "2025-11-03"])

Impact

  • Enables automated recovery DAG to query invalid dates programmatically
  • No changes to existing data-diff command or DB schema

Caveats

n/a

Testing

  • Manual: diffa get-invalid-dates --source-table X --target-table Y

Docs

N/A

Author Checklist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@quocnguyendinh quocnguyendinh self-assigned this Apr 1, 2026
@quocnguyendinh quocnguyendinh requested a review from Copilot April 1, 2026 11:39
@quocnguyendinh quocnguyendinh marked this pull request as ready for review April 1, 2026 11:39
Copy link
Copy Markdown

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

Adds a new CLI entrypoint intended to programmatically fetch “invalid” diff check dates from the Diffa state table (diffa_checks) to support automated recovery workflows.

Changes:

  • Added get-invalid-dates Click command to query invalid check dates and print them as JSON.
  • Wired the command to existing DiffaCheckService.get_invalid_check_dates() and added JSON serialization support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/diffa/cli.py Outdated
Comment thread src/diffa/cli.py Outdated
Comment thread src/diffa/cli.py Outdated
@quocnguyendinh quocnguyendinh requested review from khoaanguyenn and removed request for khoaanguyenn April 1, 2026 12:01
Use DiffaCheckDatabase directly instead of DiffaCheckService to avoid
requiring source/target DB URIs. CLI params are now used as filters
directly, and None values skip the filter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@quocnguyendinh quocnguyendinh force-pushed the DATA-32564/add-get-invalid-dates-cli branch from 027fa02 to a1d1317 Compare April 1, 2026 13:42
Move _validate_parsed_db_info() from _parse_db_info() to get_db_config()
so individual getters like get_db_name()/get_db_schema() can work without
a full DB URI. This fixes the fragile coupling where get-invalid-dates
would crash without source/target URIs even though it only needs the
diffa DB connection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@quocnguyendinh quocnguyendinh force-pushed the DATA-32564/add-get-invalid-dates-cli branch from a1d1317 to 92b7fee Compare April 1, 2026 13:47
@quocnguyendinh quocnguyendinh changed the base branch from chore/release_to_v1.0.1 to master April 1, 2026 13:51
Run pytest on every push to main and PR targeting main.
This enables required status checks to block merges on test failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@kidlab kidlab left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@quocnguyendinh quocnguyendinh added the code approved Code review completed, good to test label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code approved Code review completed, good to test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants