fix(libsql): parse scientific notation cost aggregates#3296
Merged
serrrfirat merged 1 commit intoMay 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function parse_libsql_decimal_text in the libSQL backend to correctly handle decimal values that may be returned in scientific notation, particularly for very small costs. Several locations in the database layer were updated to use this new parsing logic. Additionally, a regression test was added to ensure the admin user list API can process these small cost values without error. I have no feedback to provide as there were no review comments.
serrrfirat
added a commit
that referenced
this pull request
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
7.5e-05)/api/admin/userscaller path with a tiny-cost regression testRoot cause
The failing E2E job returned 500 from
/api/admin/usersbecause libSQLCAST(SUM(l.cost) AS TEXT)can produce scientific notation for small costs.rust_decimal::Decimal::from_str_exactrejects exponent notation, souser_summary_statssurfacedinvalid cost value '7.5e-05'.Verification
cargo fmt --checkcargo test --lib --no-default-features --features libsql test_admin_user_list_handles_tiny_costs_from_libsql -- --nocapturecargo test --lib --no-default-features --features libsql test_user_summary_stats_with_jobs_and_costs -- --nocapturecargo test --lib --no-default-features --features libsql test_user_usage_stats_with_calls -- --nocapturecargo test --lib --no-default-features --features libsql test_admin_usage_summary_aggregates_in_db -- --nocapturepython -m pytest scenarios/test_settings_search.py::test_search_filters_user_rows -q(via Python 3.11 venv)cargo check --no-default-features --features libsql -qRisk
Low: scoped to libSQL parsing of text-rendered aggregate decimal values; PostgreSQL paths are unchanged.