-
Notifications
You must be signed in to change notification settings - Fork 24
chore(ci): add db migration check #2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fix breaking down migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @jrschumacher, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello! Gemini-code-assist here to provide a summary of this pull request. Based on the title and description, the primary goal of this PR is to address a breaking database migration issue and potentially lay the groundwork for adding a CI check for migrations. The core change implemented in the patch is a fix within the 20241125220354_keys_table.sql migration file, specifically correcting a syntax error in a DROP FUNCTION statement.
Highlights
- Fix Database Migration Syntax: Corrected a syntax error in the
DROP FUNCTION IF EXISTS update_was_mappedstatement within thekeys_table.sqlmigration script by removing unnecessary parentheses.
Changelog
- service/policy/db/migrations/20241125220354_keys_table.sql
- Removed unnecessary parentheses
()from theDROP FUNCTION IF EXISTS update_was_mappedstatement on line 315 to fix a potential syntax error in the migration script.
- Removed unnecessary parentheses
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Migration script runs,
Parens gone, the syntax clean,
Database is pleased.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a breaking database down migration by making a minor syntax adjustment to a DROP FUNCTION statement in the SQL migration file. The change from DROP FUNCTION IF EXISTS update_was_mapped (); to DROP FUNCTION IF EXISTS update_was_mapped; is correct, as parentheses are optional for no-argument functions in PostgreSQL when dropping them.
This modification not only fixes the reported issue but also enhances consistency within the file, aligning the syntax with another DROP FUNCTION statement (for update_active_key).
For future pull requests, even for small fixes like this, it would be beneficial to briefly fill out the 'Proposed Changes' section in the PR description to provide a clear summary of the change. The checklist items (tests, documentation) seem appropriate for this type of change (likely not requiring updates).
Overall, this is a good, straightforward fix.
Summary of Findings
- SQL Syntax Fix for Migration: The pull request corrects the syntax in a
DROP FUNCTIONstatement within a database migration file. This change reportedly resolves an issue that was causing the down migration to fail. - Code Consistency: The syntax adjustment for
DROP FUNCTION update_was_mappednow aligns with the style used forDROP FUNCTION update_active_keyin the same file, improving overall consistency.
Merge Readiness
The change is clear, addresses the stated problem of a breaking down migration, and improves consistency. Based on the review of the code changes, this pull request appears ready for merging. As an AI, I am not authorized to approve pull requests; please ensure it undergoes any further necessary human review and approval processes before merging.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
| run: | | ||
| set -eo pipefail | ||
| goose_exe_name="goose" # Always Linux, so no .exe | ||
| determined_goose_path="" | ||
| gobin_dir="${{ steps.go_paths.outputs.gobin_path }}" | ||
| gopath_bin_dir="${{ steps.go_paths.outputs.gopath_bin_path }}" | ||
| # Prefer GOBIN if set and goose is there | ||
| if [[ -n "$gobin_dir" && -x "$gobin_dir/$goose_exe_name" ]]; then | ||
| determined_goose_path="$gobin_dir/$goose_exe_name" | ||
| # Fallback to GOPATH/bin | ||
| elif [[ -x "$gopath_bin_dir/$goose_exe_name" ]]; then | ||
| determined_goose_path="$gopath_bin_dir/$goose_exe_name" | ||
| else | ||
| echo "Error: goose executable ('$goose_exe_name') not found in GOBIN ('$gobin_dir') or GOPATH/bin ('$gopath_bin_dir')." >&2 | ||
| ls -la "$gobin_dir" || true # List contents for debugging | ||
| ls -la "$gopath_bin_dir" || true # List contents for debugging | ||
| exit 1 | ||
| fi | ||
| echo "Found goose at: $determined_goose_path" | ||
| echo "goose_executable_path=${determined_goose_path}" >> "$GITHUB_OUTPUT" |
Check notice
Code scanning / zizmor
steps.go_paths.outputs.gobin_path may expand into attacker-controllable code Note
| run: | | ||
| set -eo pipefail | ||
| goose_exe_name="goose" # Always Linux, so no .exe | ||
| determined_goose_path="" | ||
| gobin_dir="${{ steps.go_paths.outputs.gobin_path }}" | ||
| gopath_bin_dir="${{ steps.go_paths.outputs.gopath_bin_path }}" | ||
| # Prefer GOBIN if set and goose is there | ||
| if [[ -n "$gobin_dir" && -x "$gobin_dir/$goose_exe_name" ]]; then | ||
| determined_goose_path="$gobin_dir/$goose_exe_name" | ||
| # Fallback to GOPATH/bin | ||
| elif [[ -x "$gopath_bin_dir/$goose_exe_name" ]]; then | ||
| determined_goose_path="$gopath_bin_dir/$goose_exe_name" | ||
| else | ||
| echo "Error: goose executable ('$goose_exe_name') not found in GOBIN ('$gobin_dir') or GOPATH/bin ('$gopath_bin_dir')." >&2 | ||
| ls -la "$gobin_dir" || true # List contents for debugging | ||
| ls -la "$gopath_bin_dir" || true # List contents for debugging | ||
| exit 1 | ||
| fi | ||
| echo "Found goose at: $determined_goose_path" | ||
| echo "goose_executable_path=${determined_goose_path}" >> "$GITHUB_OUTPUT" |
Check notice
Code scanning / zizmor
steps.go_paths.outputs.gopath_bin_path may expand into attacker-controllable code Note
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
service/policy/db/migrations/20240618000000_add_delete_cascade.sql
Outdated
Show resolved
Hide resolved
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
|
I think it could be worth a step back before merging this because running the up/down migrations without data in the database could lead to false positives and greater confidence than is justified. I think this is positive progress to run up/down on the schema alone for SQL & migration validity, but without stored data, the test passing could lead to overconfidence. |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
Error Summary:
Standard Benchmark Metrics Skipped or Failed |
Revising the above to state that this is great incremental progress and we will choose not to be overconfident and aware of enhancements as capacity allows. |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
fix breaking down migration
Proposed Changes
Checklist
Testing Instructions