Repository navigation
Conversation
|
@jhernand: This pull request explicitly references no jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhernand The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughThe PR validates migration filenames before hash generation, reports duplicate prefixes with human-readable output, updates the migrations hash test message, and adds the ChangesMigration hash validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev/update.py`:
- Around line 49-55: The migration filename prefix handling in update.py needs
to reject non-digit prefixes before converting to an integer. In the migration
parsing logic around migration_parts and migration_number, validate
migration_parts[0] with isdigit() (or otherwise catch ValueError) before calling
int(...), so names like foo_add_table.up.sql or signed prefixes like +1_... are
reported as validation errors instead of crashing. Keep the existing
logging/error_count flow and only proceed to the numeric checks when the prefix
is a valid unsigned digit string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 9e3134a0-bdc0-4f53-9623-f6a6029707c7
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
dev/update.pyinternal/database/database_migrations_test.gopyproject.toml
d9e2921 to
0ec713f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev/update.py`:
- Around line 47-71: The duplicate-migration check in update.py is using the raw
string prefix from migration_file.name, so prefixes like 1 and 01 are treated as
different keys even though the migration parsing logic normalizes them to the
same number. Update the migration_index grouping in the prefix validation loop
to normalize the validated prefix before storing it, and ensure the duplicate
detection in the migration_prefix iteration compares the canonical numeric form
used by the database migration tests.
In `@pyproject.toml`:
- Line 7: The dependency constraint for humanize is too loose and can drift
beyond the locked version; update the manifest entry in pyproject.toml to match
the exact release already captured in uv.lock. Keep the change limited to the
humanize requirement so the project resolves consistently to the locked version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: a0206678-595a-44a2-9408-9c308aa18972
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
dev/update.pyinternal/database/database_migrations_test.gopyproject.toml
0ec713f to
5e5a275
Compare
The `update hashes` command now checks that all migration files have valid numeric prefixes and that there are no duplicate migration numbers before computing and updating the hash. Previously the command would silently compute the hash even when the migration files had problems, which could mislead developers into thinking their migrations are correct. In addition, the unit test that verifies the hash no longer displays the expected value in the failure message. This reduces the chances of a developer manually updating the hash file with a potentially incorrect value. Instead it directs the developer to use the `uv run dev.py update hashes` command, which will now catch problems before updating. Assisted-by: Cursor Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
5e5a275 to
d6113bd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev/update.py`:
- Around line 39-73: The migration validation in hashes() only checks *.up.sql,
so it can miss malformed or duplicate .down.sql files and diverge from
internal/database/database_migrations_test.go. Update the validation in
dev/update.py to scan the full migrations set, normalize each file by migration
number plus direction (up/down), and report duplicates or invalid names before
proceeding; then keep the hashing step limited to the sorted .up.sql files only.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: b22a644d-a159-444a-95b2-3c31b22ddbee
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
dev/update.pyinternal/database/database_migrations_test.gopyproject.toml
Summary
update hashescommand now validates migration file prefixes and checks for duplicatemigration numbers before computing the hash, preventing developers from unknowingly working
with an incorrect hash when their migrations have problems.
to use
uv run dev.py update hashesinstead of manual updates.Test plan
uv run dev.py update hasheswith valid migrations and verify the hash is updated.without updating the hash.
ginkgo run internal/databaseand verify the hash test passes with a correct hash andfails with a helpful message when the hash is outdated.
Summary by CodeRabbit
humanizelibrary to support clearer, human-readable error output.