Skip to content

chore(sqlx): trim stale offline query cache files#678

Draft
nicolasburtey wants to merge 1 commit intomainfrom
chore/sqlx-cache-trim-list-for-filters
Draft

chore(sqlx): trim stale offline query cache files#678
nicolasburtey wants to merge 1 commit intomainfrom
chore/sqlx-cache-trim-list-for-filters

Conversation

@nicolasburtey
Copy link
Copy Markdown
Member

@nicolasburtey nicolasburtey commented Feb 25, 2026

Summary

  • replace macro-generated list_for(...) usage in ledger repos with explicit query methods for only the by(created_at) paths we actually call:
    • AccountSetRepo::list_for_name_by_created_at(_in_op)
    • EntryRepo::{list_for_account_id_by_created_at, list_for_journal_id_by_created_at, list_for_transaction_id_by_created_at}
    • TransactionRepo::list_for_tx_template_id_by_created_at(_in_op)
  • remove list_for(...) annotations from those columns to avoid generating unused fallback filter/sort combinations
  • regenerate SQLx offline metadata

Impact

  • significantly reduces .sqlx cache surface in both cala-ledger/.sqlx and cala-server/.sqlx
  • keeps existing service-layer behavior intact for the currently used listing APIs (all call *_by_created_at methods)

Validation

  • cargo sqlx migrate run (cala-ledger)
  • make sqlx-prepare
  • SQLX_OFFLINE=true cargo check -p cala-ledger
  • SQLX_OFFLINE=true cargo check -p cala-server

Note

Medium Risk
Mostly a cache-surface reduction, but it changes the generated SQL and pagination ordering/cursors for some list queries (e.g., account sets by name now ordered by created_at), which could subtly affect result ordering or paging behavior.

Overview
Refactors repo listing APIs to stop relying on macro-generated list_for(...) query permutations and instead provide explicit, instrumented *_by_created_at methods for the only call paths in use (account sets by name, entries by account_id/journal_id/transaction_id, and transactions by tx_template_id, including *_in_op variants where needed).

As a result, regenerates SQLx offline metadata and deletes a large set of now-unused .sqlx/query-*.json cache files in both cala-ledger and cala-server, leaving only the narrowed query shapes (notably changing account-set pagination to be ordered/cursored by created_at rather than name).

Written by Cursor Bugbot for commit 5bdb9b0. This will update automatically on new commits. Configure here.

@nicolasburtey nicolasburtey force-pushed the chore/sqlx-cache-trim-list-for-filters branch from 5bdb9b0 to 3032db8 Compare February 25, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant