-
Notifications
You must be signed in to change notification settings - Fork 0
Add nix and additional commands #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| description = "Flake for development workflows."; | ||
|
|
||
| inputs = { | ||
| rainix.url = "github:rainprotocol/rainix"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
|
|
||
| outputs = { self, flake-utils, rainix }: | ||
| flake-utils.lib.eachDefaultSystem (system: | ||
| let pkgs = rainix.pkgs.${system}; | ||
| in rec { | ||
| packages = rainix.packages.${system} // { | ||
| test-wasm = rainix.mkTask.${system} { | ||
| name = "test-wasm"; | ||
| body = '' | ||
| set -euxo pipefail | ||
| cd packages/sqlite-worker-core | ||
| wasm-pack test --headless --chrome | ||
| cd ../.. | ||
| cd packages/sqlite-worker | ||
| wasm-pack test --headless --chrome | ||
| cd ../.. | ||
| ''; | ||
| }; | ||
|
|
||
| build-wasm = rainix.mkTask.${system} { | ||
| name = "build-wasm"; | ||
| body = '' | ||
| set -euxo pipefail | ||
| cd packages/sqlite-worker-core | ||
| wasm-pack build --target web --out-dir ../../pkg | ||
| cd ../.. | ||
| cd packages/sqlite-worker | ||
| wasm-pack build --target web --out-dir ../../pkg | ||
| cd ../.. | ||
| ''; | ||
| }; | ||
|
|
||
| local-bundle = rainix.mkTask.${system} { | ||
| name = "local-bundle"; | ||
| body = '' | ||
| set -euxo pipefail | ||
| ./scripts/local-bundle.sh | ||
| ''; | ||
| }; | ||
|
|
||
| test-ui = rainix.mkTask.${system} { | ||
| name = "test-ui"; | ||
| body = '' | ||
| set -euxo pipefail | ||
| ./scripts/local-bundle.sh | ||
| cd svelte-test | ||
| npm run test | ||
| cd .. | ||
| ''; | ||
| }; | ||
|
|
||
| test-full-integration = rainix.mkTask.${system} { | ||
| name = "test-full-integration"; | ||
| body = '' | ||
| set -euxo pipefail | ||
| ${packages.test-wasm}/bin/test-wasm | ||
| ${packages.test-ui}/bin/test-ui | ||
| ''; | ||
| }; | ||
| }; | ||
|
|
||
| devShells.default = pkgs.mkShell { | ||
| shellHook = rainix.devShells.${system}.default.shellHook; | ||
| packages = [ packages.test-wasm packages.build-wasm packages.local-bundle packages.test-ui packages.test-full-integration ]; | ||
|
0xgleb marked this conversation as resolved.
|
||
| inputsFrom = [ rainix.devShells.${system}.default ]; | ||
| }; | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -323,7 +323,7 @@ mod tests { | |
| } | ||
| } | ||
|
|
||
| let remaining_count = test_queries.len() - (test_queries.len() + 1) / 2; | ||
| let remaining_count = test_queries.len() - test_queries.len().div_ceil(2); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainFix computes the correct remaining count after removing even-indexed entries Using len() - len().div_ceil(2) yields floor(n/2), which matches the number of odd-indexed elements remaining after removing indices where i % 2 == 0. Good correction. One caveat: usize::div_ceil requires a relatively recent Rust toolchain. Verify the MSRV/toolchain pinned in the repo to ensure CI doesn’t break. You can run: 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Looking for rust-toolchain files..."
fd -HI '^rust-toolchain.*' -a | while read -r f; do
echo "==> $f"
cat "$f"
echo
done
echo "Searching Cargo.toml for rust-version..."
fd -a Cargo.toml | xargs -I{} sh -c 'echo "==> {}"; rg -n "^rust-version\\s*=.*" "{}" || true; echo'
echo "Searching nix flake for rust version/channel hints..."
fd -a flake.nix | xargs -I{} sh -c 'echo "==> {}"; rg -n "rust|toolchain|msrv|rustc" "{}" -n -A2 || true; echo'Length of output: 763 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Inspecting rust-version in Cargo.toml files ==="
fd -a Cargo.toml | while read -r file; do
echo "==> $file"
rg -n "^rust-version\\s*=" "$file" || echo " (no rust-version field)"
echo
done
echo "=== Scanning flake.nix for Rust toolchain hints ==="
sed -n '1,200p' flake.nix | rg -n "rust|toolchain|msrv|rustc" -n -A2 || echo " (no hints in first 200 lines)"Length of output: 1239 Pin MSRV (Rust 1.60+) for div_ceil support I didn’t find any explicit toolchain or • In your root [package]
name = "…"
version = "…"
+rust-version = "1.60"• Or create a [toolchain]
channel = "1.60.0"This will lock in the minimum supported Rust toolchain and prevent unexpected CI failures. 🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rainix, our main input to the nix flake, sets the toolchain version, however, specifying MSRV wouldn't hurt
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine i think we don't need to add it. We either get ci error or not so we can handle it later on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @findolor Understood! You're right that it's not strictly necessary if your development environment and CI are already using a recent Rust version. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| assert_eq!(pending_queries.borrow().len(), remaining_count); | ||
|
|
||
| pending_queries.borrow_mut().clear(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,10 @@ unsafe extern "C" fn rain_math_process( | |
| context, | ||
| result_cstring.as_ptr(), | ||
| result_cstring.as_bytes().len() as c_int, | ||
| Some(std::mem::transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize)), // SQLITE_TRANSIENT | ||
| Some(std::mem::transmute::< | ||
| isize, | ||
| unsafe extern "C" fn(*mut std::ffi::c_void), | ||
| >(-1isize)), // SQLITE_TRANSIENT | ||
|
Comment on lines
+102
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Minor readability nit: factor out the SQLITE_TRANSIENT sentinel The transmute-based sentinel is correct, but inlining it obscures intent. Consider a small helper to name the sentinel and avoid repeating the transmute expression inline. Apply this localized change: - Some(std::mem::transmute::<
- isize,
- unsafe extern "C" fn(*mut std::ffi::c_void),
- >(-1isize)), // SQLITE_TRANSIENT
+ sqlite_transient(), // SQLITE_TRANSIENTAnd add this helper function somewhere near the top of the file (outside the selected lines): #[inline]
fn sqlite_transient() -> Option<unsafe extern "C" fn(*mut std::ffi::c_void)> {
// Matches SQLite's (sqlite3_destructor_type)(-1) sentinel.
Some(unsafe {
std::mem::transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize)
})
}🤖 Prompt for AI Agents
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, we don't need to update it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @findolor Understood! I'll leave the current implementation as-is. The transmute expression works correctly for the SQLITE_TRANSIENT sentinel, and if you prefer keeping it inline, that's perfectly fine. |
||
| ); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.