-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix-dev-check-always-fails #437
Conversation
✅ Deploy Preview for dailp canceled.
|
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.
Some questions/comments:
- Does this part of our commit hook need to change now? Do we still have an
sqlx-data.json
or is the new.sqlx
folder where this data lives now?
https://github.com/NEU-DSG/dailp-encoding/blob/main/.git-hooks/pre-commit#L9-L14
# Require sqlx data to be generated when a SQL query is modified.
if git-staged "types/queries/**.sql" && ! git-staged "sqlx-data.json"; then
printf "\nDatabase queries changed without generating sqlx types.\nPlease run 'dev-check' or 'dev-generate-types'.\n"
HOOKS_FAILED=1
fi
- Why not add that
--workspace
flag and keep our sqlx query type data at the root level of the project like we have been? I think I like it living intypes
like it would now, but I wonder why we had done it at the root in the first place. - If
sqlx-data.json
is no longer where this data is actually stored, I'd like to see it deleted as part of the PR. I'm interested what will happen if you delete it and run this script.
I'm so exciting that you've found a fix for this and we can get moving on other stuff!
@@ -1,5 +1,5 @@ | |||
[toolchain] | |||
channel = "1.72.0" | |||
channel = "stable" | |||
profile = "minimal" |
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.
This scares me a little bit. Do we want this to bump without us explicitly changing anything?
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.
Just what we talked about! ᎣᏍᏛ ᎡᎵᏍᏗ
ᏩᏙ.
Issue:
dev-check
always fails during backend checks.Background
The primary issue is that
dev-check
fails in all conditions and suggests runningcargo check
during backend checks. Runningcargo-check
as suggested finishes successfully and yields no further information. A closer look atcheck.sh
reveals thatcargo check
only fails once$SQLX_OFFLINE
is true, suggesting that the cause of this issue is upstream in the check script. The only upstream invocation of sqlx is in the database check phase, as shown below:Running
cargo sqlx prepare -- -p dailp
yields the following error:Adding
--workspace
as suggested results in a succsessful build of thedailp
library alongside a "no queries found" warning. This message on its own is insufficient in furthering a root cause analysis of the initial error.A series of google searches relating to issues in
sqlx prepare
eventually led to a GitHub discussion of a similar issue. A user in this thread suggested that issues of this nature could be a result of a mismatched versions of thesqlx
crate andsqlx-cli
. Looking at the version info in the dailp project, shown below, this seems to be the case.Solution
Updating the
sqlx
crate used by thedailp
lib incargo.toml
fixed the issue, but required a number of configuration updates. First, sqlx 0.7 required upgrading channel inrust-toolchain.toml
to use a more recent Rust version (previously using 1.72.0). Since Nixpkgs provides a maximum pinned Rust version, upgrading to the most stable Rust channel available seemed reasonable. The hash associated withrust-toolchain.toml
inflake.nix
also had to be updated. Second, crate dependencies inflake.lock
needed to be updated viacargo update
. Third, dereferences needed to be added indatabase_sql.rs
when using functions relying on implementations ofsqlx:Execute
to accomodate breaking changes in the implementation of sqlx'sTransaction
andPoolConnection
. Finally, additional Sqlx codegen checks and logging were added tocheck.sh
to improve developer experience.