-
Notifications
You must be signed in to change notification settings - Fork 0
Add FLOAT_ZERO_HEX database function and tests #17
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
Conversation
WalkthroughAdds a new zero-value float scalar function FLOAT_ZERO_HEX (arity 0) in sqlite-web-core, registers it during function setup, includes tests verifying its hex and aggregation/default-behavior, and updates test cleanup and test dependency references. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor TestRunner as Test Runner
participant JS as Test JS
participant Core as sqlite-web-core
participant SQLite as SQLite Engine
TestRunner->>JS: run test calling FLOAT_ZERO_HEX()
JS->>Core: ensure custom functions registered
Core->>SQLite: sqlite3_create_function_v2("FLOAT_ZERO_HEX", arity=0, cb=float_zero_hex)
SQLite-->>Core: registration OK
TestRunner->>SQLite: SELECT FLOAT_ZERO_HEX();
SQLite->>Core: invoke float_zero_hex(context, argc=0, argv)
Core->>Core: compute Float::default().as_hex()
Core->>SQLite: sqlite3_result_text(hex_ptr, len, sqlite_transient())
SQLite-->>TestRunner: returns hex string
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-09-17T08:04:44.062ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
Comment |
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.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
svelte-test/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs(1 hunks)packages/sqlite-web-core/src/database_functions/mod.rs(2 hunks)svelte-test/tests/database-functions/float-zero-hex.test.ts(1 hunks)svelte-test/tests/fixtures/test-helpers.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
📚 Learning: 2025-09-17T08:04:44.062Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.tssvelte-test/tests/fixtures/test-helpers.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.tspackages/sqlite-web-core/src/database_functions/mod.rspackages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-09-17T17:09:58.740Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-08-27T05:55:40.481Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rspackages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-09-17T18:08:06.145Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: packages/sqlite-web-core/src/database_functions/float_negate.rs:16-17
Timestamp: 2025-09-17T18:08:06.145Z
Learning: The rain-math-float Float type implements arithmetic operations (including unary negation with the - operator) to return Result types rather than direct values, requiring .map_err(...)? for error handling of potential mathematical errors like overflow or underflow.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rs
🧬 Code graph analysis (2)
svelte-test/tests/database-functions/float-zero-hex.test.ts (1)
svelte-test/tests/fixtures/test-helpers.ts (2)
createTestDatabase(6-22)cleanupDatabase(173-202)
packages/sqlite-web-core/src/database_functions/mod.rs (1)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (2)
float_zero_hex(4-37)std(32-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (4)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (1)
9-16: Good arity guard and clear error.The argc check with a static C string error is correct and consistent with other functions.
packages/sqlite-web-core/src/database_functions/mod.rs (2)
12-18: Module wiring looks correct.
mod float_zero_hex;anduse float_zero_hex::*;integrate the new scalar into the existing registry cleanly.
83-101: Mark FLOAT_ZERO_HEX as SQLITE_DETERMINISTIC (and SQLITE_INNOCUOUS if available) — verify binding exposureRepo search returned no matches for SQLITE_DETERMINISTIC/SQLITE_INNOCUOUS; confirm your SQLite bindings (or C headers) expose these constants. If available, register the scalar with those flags (file: packages/sqlite-web-core/src/database_functions/mod.rs, ~lines 83–101).
- 0, // 0 arguments - SQLITE_UTF8, + 0, // 0 arguments + SQLITE_UTF8 + | SQLITE_DETERMINISTIC + | SQLITE_INNOCUOUS, std::ptr::null_mut(), Some(float_zero_hex), // Scalar functionIf SQLITE_INNOCUOUS isn't available, at minimum add SQLITE_DETERMINISTIC.
svelte-test/tests/database-functions/float-zero-hex.test.ts (1)
31-51: Solid end‑to‑end happy‑path coverage.The canonical zero hex assertion and decoding back to "0" exercise both DB and library layers.
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs
Outdated
Show resolved
Hide resolved
| sqlite3_result_text( | ||
| context, | ||
| zero_cstring.as_ptr(), | ||
| zero_cstring.as_bytes().len() as c_int, | ||
| Some(std::mem::transmute::< | ||
| isize, | ||
| unsafe extern "C" fn(*mut std::ffi::c_void), | ||
| >(-1isize)), | ||
| ); |
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.
🧹 Nitpick
🧩 Analysis chain
Use a safe/centralized SQLITE_TRANSIENT helper instead of transmute.
std::mem::transmute::<isize, extern "C" fn(*mut c_void)>(-1) works but is fragile across targets. If sqlite_wasm_rs::export exposes SQLITE_TRANSIENT (or you can add a small helper), prefer that for clarity and safety.
Proposed change (keeping the same behavior but clearer):
- zero_cstring.as_ptr(),
- zero_cstring.as_bytes().len() as c_int,
- Some(std::mem::transmute::<
- isize,
- unsafe extern "C" fn(*mut std::ffi::c_void),
- >(-1isize)),
+ zero_hex.as_ptr() as *const c_char,
+ zero_hex.len() as c_int,
+ SQLITE_TRANSIENT, // or a crate-local helper wrapping the -1 castTo check availability of flags/helpers across the codebase:
🏁 Script executed:
#!/bin/bash
rg -n "SQLITE_TRANSIENT|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS|transmute::<\s*isize" -C2 --type=rustLength of output: 1358
Centralize SQLITE_TRANSIENT and replace unsafe transmute(-1isize)
Add a crate-local SQLITE_TRANSIENT helper (an Option<unsafe extern "C" fn(*mut std::ffi::c_void)> wrapper for the SQLite transient destructor) and replace every occurrence of:
transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize)
with that helper for portability and clarity.
Files to update:
- packages/sqlite-web-core/src/database_functions/float_zero_hex.rs:28-36
- packages/sqlite-web-core/src/database_functions/bigint_sum.rs:149-151
- packages/sqlite-web-core/src/database_functions/rain_math.rs:97-99
- packages/sqlite-web-core/src/database_functions/float_sum.rs:143-145
🤖 Prompt for AI Agents
In packages/sqlite-web-core/src/database_functions/float_zero_hex.rs around
lines 28-36, create a crate-local SQLITE_TRANSIENT helper (type Option<unsafe
extern "C" fn(*mut std::ffi::c_void)>) and use it instead of the current unsafe
transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize); update
this file and likewise replace the transmute occurrence in
packages/sqlite-web-core/src/database_functions/bigint_sum.rs (around lines
149-151), packages/sqlite-web-core/src/database_functions/rain_math.rs (around
lines 97-99), and packages/sqlite-web-core/src/database_functions/float_sum.rs
(around lines 143-145) so each sqlite3_result_text/related call passes the new
SQLITE_TRANSIENT helper for clarity and portability.
| it("should integrate with queries storing and aggregating zero floats", async () => { | ||
| await db.query(` | ||
| CREATE TABLE float_zero_usage ( | ||
| id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
| amount TEXT NOT NULL | ||
| ) | ||
| `); | ||
|
|
||
| await db.query( | ||
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | ||
| ); | ||
| await db.query( | ||
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | ||
| ); | ||
|
|
||
| const stored = await db.query( | ||
| "SELECT amount FROM float_zero_usage ORDER BY id", | ||
| ); | ||
| const storedData = JSON.parse(stored.value || "[]"); | ||
| expect(storedData).toHaveLength(2); | ||
| for (const row of storedData) { | ||
| expect(row.amount).toBe(canonicalZeroHex); | ||
| expect(decodeFloatHex(row.amount)).toBe("0"); | ||
| } | ||
|
|
||
| const sumResult = await db.query( | ||
| "SELECT FLOAT_SUM(amount) as total FROM float_zero_usage", | ||
| ); | ||
| const sumData = JSON.parse(sumResult.value || "[]"); | ||
| expect(sumData).toHaveLength(1); | ||
| expect(sumData[0].total).toBe(canonicalZeroHex); | ||
| expect(decodeFloatHex(sumData[0].total)).toBe("0"); | ||
| }); |
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.
🧹 Nitpick
Add a negative test for arity enforcement.
Cover the error path by passing an argument to FLOAT_ZERO_HEX and asserting an error. This guards against accidental signature changes.
it("should integrate with queries storing and aggregating zero floats", async () => {
…
});
+
+ it("should error when called with arguments", async () => {
+ const res = await db.query('SELECT FLOAT_ZERO_HEX(1) AS z');
+ const rows = JSON.parse(res.value || "[]");
+ // Expect no row or an error message depending on driver behavior; most wrappers return an error object.
+ // If your wrapper surfaces errors via result.error, assert that instead:
+ expect(res.error).toBeTruthy();
+ });If the WASM wrapper surfaces SQL errors differently, adjust the assertion accordingly.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it("should integrate with queries storing and aggregating zero floats", async () => { | |
| await db.query(` | |
| CREATE TABLE float_zero_usage ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| amount TEXT NOT NULL | |
| ) | |
| `); | |
| await db.query( | |
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | |
| ); | |
| await db.query( | |
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | |
| ); | |
| const stored = await db.query( | |
| "SELECT amount FROM float_zero_usage ORDER BY id", | |
| ); | |
| const storedData = JSON.parse(stored.value || "[]"); | |
| expect(storedData).toHaveLength(2); | |
| for (const row of storedData) { | |
| expect(row.amount).toBe(canonicalZeroHex); | |
| expect(decodeFloatHex(row.amount)).toBe("0"); | |
| } | |
| const sumResult = await db.query( | |
| "SELECT FLOAT_SUM(amount) as total FROM float_zero_usage", | |
| ); | |
| const sumData = JSON.parse(sumResult.value || "[]"); | |
| expect(sumData).toHaveLength(1); | |
| expect(sumData[0].total).toBe(canonicalZeroHex); | |
| expect(decodeFloatHex(sumData[0].total)).toBe("0"); | |
| }); | |
| it("should integrate with queries storing and aggregating zero floats", async () => { | |
| await db.query(` | |
| CREATE TABLE float_zero_usage ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| amount TEXT NOT NULL | |
| ) | |
| `); | |
| await db.query( | |
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | |
| ); | |
| await db.query( | |
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | |
| ); | |
| const stored = await db.query( | |
| "SELECT amount FROM float_zero_usage ORDER BY id", | |
| ); | |
| const storedData = JSON.parse(stored.value || "[]"); | |
| expect(storedData).toHaveLength(2); | |
| for (const row of storedData) { | |
| expect(row.amount).toBe(canonicalZeroHex); | |
| expect(decodeFloatHex(row.amount)).toBe("0"); | |
| } | |
| const sumResult = await db.query( | |
| "SELECT FLOAT_SUM(amount) as total FROM float_zero_usage", | |
| ); | |
| const sumData = JSON.parse(sumResult.value || "[]"); | |
| expect(sumData).toHaveLength(1); | |
| expect(sumData[0].total).toBe(canonicalZeroHex); | |
| expect(decodeFloatHex(sumData[0].total)).toBe("0"); | |
| }); | |
| it("should error when called with arguments", async () => { | |
| const res = await db.query('SELECT FLOAT_ZERO_HEX(1) AS z'); | |
| const rows = JSON.parse(res.value || "[]"); | |
| // Expect no row or an error message depending on driver behavior; most wrappers return an error object. | |
| // If your wrapper surfaces errors via result.error, assert that instead: | |
| expect(res.error).toBeTruthy(); | |
| }); |
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 is not needed. we don't have any arguments so it's a noop
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.
@findolor I understand your perspective. You're right that the function is designed to take zero arguments, so testing the error path isn't essential for the core functionality. I'll respect your decision to keep the test suite focused on the primary use cases.
🧠 Learnings used
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
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.
It would be good to have error coverage since we don't get this from the compiler
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
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.
Actionable comments posted: 3
♻️ Duplicate comments (2)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (2)
3-9: Centralized SQLITE_TRANSIENT helper — good; please apply repo‑wide.This avoids fragile transmute usage at each call site. Recommend replacing remaining occurrences across the crate to use this helper.
Run to find remaining sites to update:
#!/bin/bash rg -n --type=rust -C2 -e 'transmute::<\s*isize[^>]*>\s*\(-1isize\)' -e 'sqlite3_result_text\([^,]+,[^,]+,[^,]+,\s*None\)' -e 'SQLITE_TRANSIENT'
26-31: LGTM: no CString, correct TRANSIENT usage.Passing ptr+len with SQLITE_TRANSIENT is the right pattern here and resolves earlier nitpicks.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
svelte-test/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (1)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-08-27T05:55:40.481Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Applied to files:
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web/worker_template.rs : Ensure the worker JavaScript generated by worker_template.rs embeds the WASM (base64) and does not fetch external WASM files
Applied to files:
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
| /// Scalar SQLite function that returns the canonical zero Float as a hex string. | ||
| pub(crate) unsafe extern "C" fn float_zero_hex( | ||
| context: *mut sqlite3_context, | ||
| argc: c_int, | ||
| _argv: *mut *mut sqlite3_value, | ||
| ) { |
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.
🧹 Nitpick
Document FFI safety invariants.
Brief “Safety” notes help maintainers keep this unsafe extern "C" sound when edited later.
-/// Scalar SQLite function that returns the canonical zero Float as a hex string.
+/// Scalar SQLite function that returns the canonical zero Float as a hex string.
+///
+/// Safety:
+/// - Called by SQLite with a valid `context`.
+/// - `argc` must be 0; `_argv` may be null and is ignored.
+/// - Result uses SQLITE_TRANSIENT so no lifetime ties to Rust memory.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// Scalar SQLite function that returns the canonical zero Float as a hex string. | |
| pub(crate) unsafe extern "C" fn float_zero_hex( | |
| context: *mut sqlite3_context, | |
| argc: c_int, | |
| _argv: *mut *mut sqlite3_value, | |
| ) { | |
| /// Scalar SQLite function that returns the canonical zero Float as a hex string. | |
| /// | |
| /// Safety: | |
| /// - Called by SQLite with a valid `context`. | |
| /// - `argc` must be 0; `_argv` may be null and is ignored. | |
| /// - Result uses SQLITE_TRANSIENT so no lifetime ties to Rust memory. | |
| pub(crate) unsafe extern "C" fn float_zero_hex( | |
| context: *mut sqlite3_context, | |
| argc: c_int, | |
| _argv: *mut *mut sqlite3_value, | |
| ) { |
🤖 Prompt for AI Agents
In packages/sqlite-web-core/src/database_functions/float_zero_hex.rs around
lines 11 to 16, the unsafe extern "C" function is missing FFI safety
documentation; add a brief doc comment block labeled "Safety" immediately above
the function that enumerates the invariants callers and maintainers must uphold
(e.g., that context is non-null and points to a valid sqlite3_context, argc has
the expected value, _argv may be null and must not be dereferenced, the function
must not panic across the FFI boundary, must only call async-unsafe or
reentrant-safe code, and must preserve ABI and threading expectations of
SQLite), and include any notes about required casting, lifetime assumptions, and
expectations about error reporting so future edits keep the function sound.
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 is not needed
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.
@findolor Understood, I'll skip the FFI safety documentation suggestion. Thanks for the clarification!
/| /|
( ._. )
o_(")(")
🧠 Learnings used
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
packages/sqlite-web-core/src/database_functions/mod.rs (1)
83-101: Registration flags and arity are correct.Deterministic + innocuous on a 0‑arity scalar is appropriate; error handling mirrors existing patterns.
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (1)
17-25: Good arity check with explicit errcode.Clear message plus
SQLITE_MISUSEtagging.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
svelte-test/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs(1 hunks)packages/sqlite-web-core/src/database_functions/mod.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rspackages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-08-27T05:55:40.481Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rspackages/sqlite-web-core/src/database_functions/float_zero_hex.rs
📚 Learning: 2025-09-17T18:08:06.145Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: packages/sqlite-web-core/src/database_functions/float_negate.rs:16-17
Timestamp: 2025-09-17T18:08:06.145Z
Learning: The rain-math-float Float type implements arithmetic operations (including unary negation with the - operator) to return Result types rather than direct values, requiring .map_err(...)? for error handling of potential mathematical errors like overflow or underflow.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rs
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web/worker_template.rs : Ensure the worker JavaScript generated by worker_template.rs embeds the WASM (base64) and does not fetch external WASM files
Applied to files:
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs
🧬 Code graph analysis (1)
packages/sqlite-web-core/src/database_functions/mod.rs (1)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (1)
float_zero_hex(12-32)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (2)
packages/sqlite-web-core/src/database_functions/mod.rs (1)
12-12: Module wiring LGTM.New module and import are correct and scoped appropriately.
Also applies to: 17-17
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (1)
3-9: Centralize SQLITE_TRANSIENT helperMove sqlite_transient() into a single shared helper (e.g. packages/sqlite-web-core/src/database_functions/mod.rs) and reuse to avoid duplication and drift.
Apply in this file:
- pub(crate) fn sqlite_transient() -> Option<unsafe extern "C" fn(*mut std::ffi::c_void)> { - // SQLite uses the value -1 cast to a function pointer as a sentinel meaning - // "make your own copy" for the result buffer (a.k.a. SQLITE_TRANSIENT). - Some(unsafe { - std::mem::transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize) - }) - }Then add once in packages/sqlite-web-core/src/database_functions/mod.rs:
// Shared helper for SQLITE_TRANSIENT sentinel pub(crate) fn sqlite_transient() -> Option<unsafe extern "C" fn(*mut std::ffi::c_void)> { Some(unsafe { std::mem::transmute::<isize, unsafe extern "C" fn(*mut std::ffi::c_void)>(-1isize) }) }Run a repo search to find remaining occurrences (example):
rg -n --hidden -S '-1isize|sqlite_transient|transmute::<isize' || true
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.
should we add some tests to this module?
| it("should integrate with queries storing and aggregating zero floats", async () => { | ||
| await db.query(` | ||
| CREATE TABLE float_zero_usage ( | ||
| id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
| amount TEXT NOT NULL | ||
| ) | ||
| `); | ||
|
|
||
| await db.query( | ||
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | ||
| ); | ||
| await db.query( | ||
| "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", | ||
| ); | ||
|
|
||
| const stored = await db.query( | ||
| "SELECT amount FROM float_zero_usage ORDER BY id", | ||
| ); | ||
| const storedData = JSON.parse(stored.value || "[]"); | ||
| expect(storedData).toHaveLength(2); | ||
| for (const row of storedData) { | ||
| expect(row.amount).toBe(canonicalZeroHex); | ||
| expect(decodeFloatHex(row.amount)).toBe("0"); | ||
| } | ||
|
|
||
| const sumResult = await db.query( | ||
| "SELECT FLOAT_SUM(amount) as total FROM float_zero_usage", | ||
| ); | ||
| const sumData = JSON.parse(sumResult.value || "[]"); | ||
| expect(sumData).toHaveLength(1); | ||
| expect(sumData[0].total).toBe(canonicalZeroHex); | ||
| expect(decodeFloatHex(sumData[0].total)).toBe("0"); | ||
| }); |
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.
It would be good to have error coverage since we don't get this from the compiler
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.
Actionable comments posted: 1
♻️ Duplicate comments (1)
svelte-test/tests/fixtures/test-helpers.ts (1)
191-192: Table added for cleanup tracking.Adding 'float_zero_usage' to the cleanup table list ensures proper test isolation for the new FLOAT_ZERO_HEX function tests.
Note: The indentation inconsistency was already flagged in past reviews and is being addressed in a separate PR.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locksvelte-test/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
packages/sqlite-web-core/src/database_functions/mod.rs(2 hunks)pkg/package.json(1 hunks)svelte-test/package.json(1 hunks)svelte-test/tests/database-functions/float-zero-hex.test.ts(1 hunks)svelte-test/tests/fixtures/test-helpers.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
svelte-test/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
In the Svelte test app, depend on the sqlite-web package via the locally packed tarball produced by npm pack
Files:
svelte-test/package.json
🧠 Learnings (11)
📓 Common learnings
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
📚 Learning: 2025-09-17T08:04:44.062Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Applied to files:
svelte-test/tests/fixtures/test-helpers.tssvelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to svelte-test/package.json : In the Svelte test app, depend on the sqlite-web package via the locally packed tarball produced by npm pack
Applied to files:
svelte-test/package.json
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-19T07:06:37.278Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.tspackages/sqlite-web-core/src/database_functions/mod.rs
📚 Learning: 2025-09-17T17:09:58.740Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-19T07:06:20.147Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:39-57
Timestamp: 2025-09-19T07:06:20.147Z
Learning: PRAGMA function_list is not available in the WASM SQLite test environment used by svelte-test, so availability testing should rely on direct function calls rather than PRAGMA queries.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-08-27T05:55:40.481Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rs
📚 Learning: 2025-09-17T18:08:06.145Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: packages/sqlite-web-core/src/database_functions/float_negate.rs:16-17
Timestamp: 2025-09-17T18:08:06.145Z
Learning: The rain-math-float Float type implements arithmetic operations (including unary negation with the - operator) to return Result types rather than direct values, requiring .map_err(...)? for error handling of potential mathematical errors like overflow or underflow.
Applied to files:
packages/sqlite-web-core/src/database_functions/mod.rs
🧬 Code graph analysis (2)
svelte-test/tests/database-functions/float-zero-hex.test.ts (2)
svelte-test/tests/fixtures/float-utils.ts (2)
decodeFloatHex(20-31)encodeFloatHex(5-11)svelte-test/tests/fixtures/test-helpers.ts (2)
createTestDatabase(6-22)cleanupDatabase(173-203)
packages/sqlite-web-core/src/database_functions/mod.rs (1)
packages/sqlite-web-core/src/database_functions/float_zero_hex.rs (2)
float_zero_hex(12-32)std(7-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (6)
pkg/package.json (1)
15-15: LGTM!No functional changes to this package manifest. The version and dependencies remain unchanged.
svelte-test/package.json (1)
44-44: Dependency update aligns with PR changes.The update from alpha.1 to alpha.3 tarball correctly reflects the new version containing the FLOAT_ZERO_HEX functionality. This follows the coding guideline for using locally packed tarballs.
svelte-test/tests/database-functions/float-zero-hex.test.ts (2)
43-51: LGTM!The test correctly validates that FLOAT_ZERO_HEX() returns the canonical zero hex value and that it decodes to "0". The approach is thorough and follows existing test patterns in the codebase.
53-85: Comprehensive integration test.This test effectively validates the complete workflow: function registration, data insertion, storage verification, and aggregation with FLOAT_SUM. The test properly ensures that multiple zero values sum to zero, confirming both individual function behavior and interaction with existing aggregate functions.
packages/sqlite-web-core/src/database_functions/mod.rs (2)
13-13: Module integration follows established patterns.The addition of the
float_zero_hexmodule and its imports follows the same pattern as existing function modules in the codebase.Also applies to: 19-19
85-103: Function registration is correctly configured.The SQLITE_DETERMINISTIC flag is appropriate since FLOAT_ZERO_HEX() always returns the same canonical zero hex value regardless of when called. The SQLITE_INNOCUOUS flag is correctly applied since the function has no side effects and only returns a deterministic constant value. The zero-argument arity and scalar function configuration match the intended functionality.
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.
Actionable comments posted: 2
♻️ Duplicate comments (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts (1)
7-8: Deduplicate helpers: import from fixtures and drop local encode/decode + Float importReuse the shared utilities to avoid divergence and to benefit from ensurePrefixedHex and consistent error handling.
-import { Float } from "@rainlanguage/float"; +import { encodeFloatHex, decodeFloatHex } from "../fixtures/float-utils.js";-function decodeFloatHex(hex: string): string { - const floatRes = Float.fromHex(hex as `0x${string}`); - if (floatRes.error) { - throw new Error(`fromHex failed: ${String(floatRes.error)}`); - } - const fmtRes = floatRes.value.format(); - if (fmtRes.error) { - throw new Error(`format failed: ${String(fmtRes.error)}`); - } - return fmtRes.value as string; -} - -function encodeFloatHex(decimal: string): `0x${string}` { - const parseRes = Float.parse(decimal); - if (parseRes.error) { - throw new Error( - `Float.parse failed: ${String(parseRes.error.msg ?? parseRes.error)}`, - ); - } - return parseRes.value.asHex(); -} +// Use encodeFloatHex/decodeFloatHex from fixtures instead of redefining locally.Also applies to: 9-29
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
📚 Learning: 2025-09-17T08:04:44.062Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-19T07:06:37.278Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:09:58.740Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
🧬 Code graph analysis (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts (2)
svelte-test/tests/fixtures/float-utils.ts (2)
decodeFloatHex(20-31)encodeFloatHex(5-11)svelte-test/tests/fixtures/test-helpers.ts (2)
createTestDatabase(6-22)cleanupDatabase(173-203)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (3)
svelte-test/tests/database-functions/float-zero-hex.test.ts (3)
31-35: LGTM: canonical reference derived via encodeFloatHex("0")Good invariant: comparing FLOAT_ZERO_HEX() to the canonical zero hex computed via the same Float lib.
53-85: LGTM: integration tests (storage, aggregation, defaults) are solidCovers storage, FLOAT_SUM aggregation, and DEFAULT usage paths for the new scalar function.
Also applies to: 103-126
1-8: CI/runtime: confirm Node ≥ 22 and declare engines.nodeCurrent Node: v24.3.0 (satisfies ≥22). pkg/package.json and svelte-test/package.json have no engines.node — add "engines": { "node": ">=22" } or align your CI matrix to that minimum to avoid install/runtime failures for @rainlanguage/float.
| const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex"); | ||
| const data = JSON.parse(result.value || "[]"); | ||
| expect(data).toHaveLength(1); | ||
| expect(data[0].zero_hex).toBe(canonicalZeroHex); | ||
|
|
||
| const decimal = decodeFloatHex(data[0].zero_hex); | ||
| expect(decimal).toBe("0"); | ||
| }); |
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.
🧹 Nitpick
Assert query success before parsing JSON
Guard against silent failures by asserting no error prior to JSON.parse; replicate for other queries in this file.
- const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex");
- const data = JSON.parse(result.value || "[]");
+ const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex");
+ expect(result.error).toBeFalsy();
+ const data = JSON.parse(result.value || "[]");📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex"); | |
| const data = JSON.parse(result.value || "[]"); | |
| expect(data).toHaveLength(1); | |
| expect(data[0].zero_hex).toBe(canonicalZeroHex); | |
| const decimal = decodeFloatHex(data[0].zero_hex); | |
| expect(decimal).toBe("0"); | |
| }); | |
| const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex"); | |
| expect(result.error).toBeFalsy(); | |
| const data = JSON.parse(result.value || "[]"); | |
| expect(data).toHaveLength(1); | |
| expect(data[0].zero_hex).toBe(canonicalZeroHex); | |
| const decimal = decodeFloatHex(data[0].zero_hex); | |
| expect(decimal).toBe("0"); | |
| }); |
🤖 Prompt for AI Agents
In svelte-test/tests/database-functions/float-zero-hex.test.ts around lines 44
to 51, the test parses result.value without first asserting the query succeeded;
update the test to assert the query succeeded before JSON.parse (e.g.,
expect(result.error).toBeFalsy() or expect(result.ok).toBeTrue() or at minimum
expect(result.value).toBeDefined()), then parse result.value and continue
existing assertions; apply the same guard (assert no error / value defined) to
all other query usages in this file.
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.
no need to do this
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.
@findolor Understood, I'll skip that suggestion. Thanks for the clarification!
🧠 Learnings used
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
svelte-test/tests/database-functions/float-zero-hex.test.ts (2)
20-22: Ensure cleanup drops float_zero_defaults to prevent cross-test leaks.cleanupDatabase currently doesn’t drop the float_zero_defaults table created in this file. This can cause CREATE TABLE failures in subsequent tests if DBs are reused.
Apply in svelte-test/tests/fixtures/test-helpers.ts:
- 'bigint_test', 'categories', 'float_test', 'float_categories', 'float_zero_usage' + 'bigint_test', 'categories', 'float_test', 'float_categories', 'float_zero_usage', 'float_zero_defaults'
35-41: Check DDL/INSERT results to surface unexpected failures early.Assert no error on CREATE TABLE and INSERT statements.
Examples:
- await db.query(` + const createUsageRes = await db.query(` CREATE TABLE float_zero_usage ( id INTEGER PRIMARY KEY AUTOINCREMENT, amount TEXT NOT NULL ) `); + expect(createUsageRes.error).toBeFalsy();- await db.query( - "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", - ); + const ins1 = await db.query( + "INSERT INTO float_zero_usage (amount) VALUES (FLOAT_ZERO_HEX())", + ); + expect(ins1.error).toBeFalsy();- await db.query(` + const createDefaultsRes = await db.query(` CREATE TABLE float_zero_defaults ( id INTEGER PRIMARY KEY AUTOINCREMENT, amount TEXT NOT NULL DEFAULT (FLOAT_ZERO_HEX()) ) `); + expect(createDefaultsRes.error).toBeFalsy();- await db.query("INSERT INTO float_zero_defaults DEFAULT VALUES"); + const insDefault = await db.query("INSERT INTO float_zero_defaults DEFAULT VALUES"); + expect(insDefault.error).toBeFalsy();Also applies to: 42-47, 85-91, 92-95
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#5
File: packages/sqlite-web-core/src/database_functions/bigint_sum.rs:76-93
Timestamp: 2025-08-27T05:55:40.481Z
Learning: In the sqlite-web-core codebase, for SQLite aggregate function context initialization, the maintainer prefers using byte-scanning to detect zero-initialized memory rather than using explicit initialization flags or Option wrappers.
📚 Learning: 2025-09-17T08:04:44.062Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:17:41.827Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-19T07:06:37.278Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-17T17:09:58.740Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:64-72
Timestamp: 2025-09-17T17:09:58.740Z
Learning: FLOAT_SUM functionality is available and working in the codebase, so tests can rely on it without needing availability checks or gating logic.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
📚 Learning: 2025-09-19T07:06:20.147Z
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:39-57
Timestamp: 2025-09-19T07:06:20.147Z
Learning: PRAGMA function_list is not available in the WASM SQLite test environment used by svelte-test, so availability testing should rely on direct function calls rather than PRAGMA queries.
Applied to files:
svelte-test/tests/database-functions/float-zero-hex.test.ts
🧬 Code graph analysis (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts (2)
svelte-test/tests/fixtures/float-utils.ts (2)
encodeFloatHex(5-11)decodeFloatHex(20-31)svelte-test/tests/fixtures/test-helpers.ts (2)
createTestDatabase(6-22)cleanupDatabase(173-203)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (1)
svelte-test/tests/database-functions/float-zero-hex.test.ts (1)
8-10: Good reuse of shared float utilities.Importing decodeFloatHex/encodeFloatHex from fixtures avoids duplication and keeps behavior consistent across tests.
| const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex"); | ||
| const data = JSON.parse(result.value || "[]"); | ||
| expect(data).toHaveLength(1); | ||
| expect(data[0].zero_hex).toBe(canonicalZeroHex); | ||
|
|
||
| const decimal = decodeFloatHex(data[0].zero_hex); | ||
| expect(decimal).toBe("0"); |
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.
🧹 Nitpick
Assert query success before JSON.parse to avoid masking failures.
Parse only after confirming no error and that value is present.
Example for the first query (replicate for the other SELECTs in this file):
- const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex");
- const data = JSON.parse(result.value || "[]");
+ const result = await db.query("SELECT FLOAT_ZERO_HEX() as zero_hex");
+ expect(result.error).toBeFalsy();
+ expect(result.value).toBeTruthy();
+ const data = JSON.parse(result.value!);And for a later SELECT:
- const stored = await db.query(
- "SELECT amount FROM float_zero_usage ORDER BY id",
- );
- const storedData = JSON.parse(stored.value || "[]");
+ const stored = await db.query(
+ "SELECT amount FROM float_zero_usage ORDER BY id",
+ );
+ expect(stored.error).toBeFalsy();
+ const storedData = JSON.parse(stored.value!);Also applies to: 49-53, 59-65, 68-73, 97-101
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.
not needed
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.
@findolor Understood, I'll skip this suggestion. Your current approach with result.value || "[]" works fine for your testing needs.
🧠 Learnings used
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:60-90
Timestamp: 2025-09-19T07:06:37.278Z
Learning: For floating-point database functions in the rainlanguage/sqlite-web codebase, negative zero handling is not required and doesn't need to be tested.
Learnt from: findolor
PR: rainlanguage/sqlite-web#6
File: svelte-test/tests/database-functions/float-sum.test.ts:78-86
Timestamp: 2025-09-17T08:04:44.062Z
Learning: In svelte-test/tests/database-functions/float-sum.test.ts, the schema defines `amount TEXT NOT NULL` but the NULL value handling tests attempt to insert NULL values, creating a constraint violation that prevents the tests from passing.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies characters matching /[a-f]/ (hex digits a-f), preserving the 'x' in '0x' prefixes and all other characters unchanged, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: findolor
PR: rainlanguage/sqlite-web#11
File: svelte-test/tests/database-functions/float-negate.test.ts:105-119
Timestamp: 2025-09-17T17:17:41.827Z
Learning: The toMixedCase function in svelte-test/tests/fixtures/float-utils.ts only modifies [a-f] characters, preserving the 'x' in '0x' prefixes, so it won't create conflicts with tests that reject '0X' prefixes.
Learnt from: CR
PR: rainlanguage/sqlite-web#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries
Learnt from: findolor
PR: rainlanguage/sqlite-web#14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:39-57
Timestamp: 2025-09-19T07:06:20.147Z
Learning: PRAGMA function_list is not available in the WASM SQLite test environment used by svelte-test, so availability testing should rely on direct function calls rather than PRAGMA queries.
fix #16
Summary
FLOAT_ZERO_HEXSQLite scalar function that surfaces the canonical zero rain-math float hex stringTesting
rain-math-floatsource path missing)https://chatgpt.com/codex/tasks/task_e_68cbb532e16883338defbbf23f7c753b
Summary by CodeRabbit
New Features
Tests
Chores