refactor(data): introduce simple query helper

This commit is contained in:
HsungKayphoon
2026-05-17 14:07:23 +08:00
parent a2f91b4108
commit f0a6fffa87
39 changed files with 3169 additions and 2037 deletions

View File

@@ -0,0 +1,78 @@
# Aether Data Simple Query Inventory
This inventory tracks repository read paths that are intended to use the
internal `aether-data-query` helpers. The helper layer is for SQL fragments only:
repositories still own their table-specific projections, joins, row mapping, and
business rules.
## Included In This Pass
- `background_tasks`
- `find_run`
- `list_runs`
- `list_events`
- simple `summarize_runs` count/group reads remain behavior-locked in SQL
- `announcements`
- `find_by_id`
- `list_announcements`
- `count_unread_active_announcements`
- `auth_modules`
- `list_enabled_oauth_providers`
- `get_ldap_config`
- `oauth_providers`
- `list_oauth_provider_configs`
- `get_oauth_provider_config`
- `quota`
- `find_by_provider_id`
- `find_by_provider_ids`
- `provider_catalog`
- provider by-id/provider list reads in PG/SQLite
- endpoint/key by-id and by-provider-id `IN` reads in PG/SQLite
- provider key page filters, search, order, limit/offset in PG/SQLite
- key stats by provider ids in PG/SQLite
- `proxy_nodes`
- node list/find reads
- event list/filter reads
- `management_tokens`
- `list_management_tokens`
- `get_management_token_with_user`
- `get_management_token_with_user_by_hash`
- `pool_scores`
- `find_scores_by_identity`
- `list_ranked_pool_members`
- `list_pool_member_scores`
- `list_pool_member_probe_candidates`
- `get_pool_member_scores_by_ids`
- `candidates`
- `list_by_request_id`
- `list_recent`
- `list_by_provider_id`
- `list_finalized_by_endpoint_ids_since`
- simple finalized status count
- `gemini_file_mappings`
- list/count filters and search
## Deferred
- `usage` aggregation, dashboard, leaderboard, cache-hit, provider/key/user
statistics, rebuild paths, and body/blob reads.
- `candidate_selection` JSON/alias matching and scoring.
- `wallet` ledger, order, refund, callback, and redeem-code list logic.
- write/upsert/delete paths, transactions, `RETURNING`, CTEs, window functions,
advisory locks, and schema compatibility probes.
- MySQL `provider_catalog` still delegates read paths through the existing
memory adapter; migrate it in a focused follow-up so MySQL parity can be tested
independently.
- `users/auth` and `global_models` still contain additional simple read paths.
`global_models/sqlite.rs` had pre-existing local edits and must be handled
carefully in a dedicated slice.
## Helper Coverage
- dialect-aware identifier quoting
- `WHERE`/`AND` sequencing
- equality and optional equality filters
- `IN` filters
- case-insensitive contains/search
- whitelisted order-by rendering
- `LIMIT` and `LIMIT/OFFSET`