Skip to content

Slow-query log fields, price-change sign test, holders quantity-sort test#617

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
circleboyslimited:fix/issues-543-576-604-612
Jul 24, 2026
Merged

Slow-query log fields, price-change sign test, holders quantity-sort test#617
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
circleboyslimited:fix/issues-543-576-604-612

Conversation

@circleboyslimited

@circleboyslimited circleboyslimited commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add integration test for key holders list endpoint returning holders sorted by quantity descending #604: Added an integration test seeding four holders (quantities 5, 1, 10, 3) for a creator and asserting GET /creators/:id/holders returns them in descending order (10, 5, 3, 1), plus a single-holder scenario. The endpoint already sorts by balance descending by default (generically covered by the existing creator-holders-sort.test.ts); this test locks in the exact scope from the issue (four specific quantities, exact expected order, single-holder case).
  • Add integration test for holdings endpoint returning entries sorted by total value descending by default #543: Investigated and found this is already fully resolved — src/modules/wallets/__tests__/wallet-holdings-default-sort.integration.test.ts already seeds three holdings with distinct total values, calls the holdings endpoint with no sort param, and asserts highest-value-first / lowest-value-last ordering by total value (not balance or price alone), matching every acceptance criterion verbatim. No code or test change needed; noting this explicitly rather than adding a duplicate test.
  • Add integration test for creator detail including price_change_24h field in response #576: The price_change_24h field already exists on the creator detail response (creator-profile.service.ts, computed via compute24hPriceChange), and existing tests already cover the null/zero/no-prior-snapshot cases. The literal gap was a test asserting the sign: added one that seeds a creator with a price above its 24h-ago snapshot (asserts positive priceChange24h) and one with a lower price (asserts negative).
  • Add structured log for database query exceeding 200ms response time #612: Slow-query detection already existed in prisma.utils.ts (warn-level log gated by the configurable SLOW_QUERY_THRESHOLD_MS env var, never logging raw query parameters). Two real gaps against the issue's literal acceptance criteria: (1) the log used elapsedMs/model instead of the specified duration_ms/table field names and had no query_name or SQL-style operation (select/insert/update/delete) field — added all four alongside the existing fields for backward compatibility; (2) the threshold defaulted to 500ms instead of the specified 200ms default — updated it (still overridable via env var).

Closes #543
Closes #576
Closes #604
Closes #612

Test plan

  • npx tsc --noEmit — clean
  • npx eslint on all touched/added files — clean
  • Non-DB-dependent unit tests near the changes (config.test.ts, config.required.test.ts, config-mask.utils.test.ts, config-summary.utils.test.ts) — all pass
  • The new/updated integration tests (creator-holders-quantity-sort.test.ts, creator-detail-price-change-sign.integration.test.ts) and the full existing integration suite require a live Postgres instance, which isn't available in this environment (no Docker, no local Postgres) — could not run them end-to-end. Confirmed via git stash that pre-existing test-suite failures (e.g. creators.slow-query-plan.test.ts) are unrelated to this change. Recommend running pnpm db:up && pnpm test before merge.

…erorg#604)

Seeds four holders (quantities 5, 1, 10, 3) for a creator and asserts
the /creators/:id/holders endpoint returns them in descending order
(10, 5, 3, 1) with correct key_balance/wallet_address fields, plus a
single-holder scenario. The endpoint already sorted by balance desc
by default (covered generically by the existing
creator-holders-sort.test.ts); this test locks in the exact scope
from the issue.
The price_change_24h field already exists on the creator detail
response (creator-profile.service.ts, computed via
compute24hPriceChange), and existing tests cover the null/zero/no-prior
cases. The literal gap from the issue was a test asserting the sign:
seeds a creator with a price above its 24h-ago snapshot and asserts a
positive priceChange24h, and one with a lower price asserting a
negative value.
…rorg#612)

Slow-query detection already existed in prisma.utils.ts (warn-level
log with model/operation/fingerprint/elapsedMs, gated by the
configurable SLOW_QUERY_THRESHOLD_MS env var, and never logging raw
query parameters). Two real gaps against the issue's literal
acceptance criteria:

- The log used elapsedMs/model instead of the specified duration_ms/
  table field names, and had no query_name or SQL-style operation
  (select/insert/update/delete) field. Added all four alongside the
  existing fields.
- SLOW_QUERY_THRESHOLD_MS defaulted to 500ms; the issue specifies a
  200ms default. Updated it (still overridable via env var).
@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@circleboyslimited Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit a7dea76 into accesslayerorg:main Jul 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment