Skip to content

Refactor: share list query building in baseDataProvider, drop stale comments - #82

Merged
buzz-code merged 1 commit into
mainfrom
claude/refactor-debt-2026-11-14
Nov 14, 2026
Merged

buzz-code merged 1 commit into
mainfrom
claude/refactor-debt-2026-11-14

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Part of buzz-code/ops#60

Scope

Weekly tech-debt pass. Only behavior-preserving changes, focused on recently changed code. No API, export or consumer-facing changes, so no CONSUMER_CHANGES.md row is needed.

Changes

  • providers/baseDataProvider.ts
    • getList, getCount and export each built the same query (q params, filter/$OR, sort, joins, extra). That code now lives in one internal helper, composeListQuery. The builder calls run in the same order as before, because RequestQueryBuilder writes the query-string params in the order they are set.
    • mergeEncodedQueries: removed a .map((query) => query) that did nothing.
    • Header docblock: replaced the usage example copied from upstream ra-data-nestjsx-crud, which no longer matched how this provider is built.
    • getCount return type Promise<Number> changed to Promise<number>. The error from fileResponseError now has a type with an optional details field, so the as any cast is gone.
  • components/views/YemotSimulator.jsx: removed commented-out sample phone numbers from DEFAULT_VALUES.

Helper added

  • composeListQuery(params, perPage?) in providers/baseDataProvider.ts (module-internal, not exported): builds the query string for list-style requests. When perPage is omitted the query has no pagination (used by getCount).

Tests

  • Byte-for-byte check: before and after the change, a throwaway Jest test recorded every URL that getList (plain resource and resource with a query string), getCount and export built for three param sets (nested filters, $OR, q, extra, perPage over the cap, and undefined filter and sort). The two sets of URLs were identical. The throwaway test is not committed.
  • Ad-hoc tsc --noEmit on baseDataProvider.ts: clean.
  • yarn test: 230 passed, 2 failed, 1 skipped, the same before and after the change. The 2 failures are 5s timeouts in AdvancedSort.test.jsx and CommonEntity.integration.test.jsx under parallel load. Run with --runInBand --testTimeout=30000, those suites and all provider suites pass (83/83).

Generated by Claude Code

…omments

- Extract composeListQuery for the identical query building in getList,
  getCount and export (URLs unchanged, byte for byte).
- Drop the identity map in mergeEncodedQueries.
- Replace the upstream usage example in the header docblock, which no longer
  matches how this provider is built.
- Type getCount as Promise<number> and the file-response error's details
  field instead of casting to any.
- Remove commented-out sample phone numbers in YemotSimulator defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GTictqecCYiBSiCMj1RKN
@buzz-code
buzz-code merged commit 82a5562 into main Nov 14, 2026
1 check passed
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.

2 participants