test(docs): verify #281 overview BRIN index + 60s cache #805

Merged
PlasticDigits merged 1 commit from cursor/gitlab-issue-workflow-43b1 into main 2026-06-05 12:43:15 +00:00
PlasticDigits commented 2026-06-05 12:42:24 +00:00 (Migrated from gitlab.com)

Summary

Closes verification/documentation gap for GitLab #281.

The core fix is already on main (fd11a22): BRIN index idx_swaps_block_timestamp_brin on swap_events(block_timestamp) plus a 60s TTL whole-response cache on GET /api/v1/overview.

This MR adds integration tests and indexer invariant docs.

Acceptance criteria

Criterion Verification Result
24h global aggregate no longer does a full seq scan at scale BRIN index present; integration test swap_events_block_timestamp_brin_index_exists PASS
/overview latency stays bounded as swap_events grows 60s cache; integration test overview_response_cached_within_ttl PASS

Relates to #281.


Note

Low Risk
Docs and integration tests only; no runtime or API behavior changes in this diff.

Overview
Documents and regression-tests GitLab #281 for GET /api/v1/overview global 24h stats. The BRIN index and 60s response cache landed on main in fd11a22; this MR closes the verification gap.

Adds indexer/tests/indexer_overview_global_stats.rs: one test asserts migration idx_swaps_block_timestamp_brin exists on swap_events.block_timestamp; another asserts back-to-back /overview responses match within the 60s TTL.

Updates docs/indexer-invariants.md with an indexing row for overview global stats, expands the expensive-DB DoS bullet, and adds an Overview global stats (#281) section (live aggregate vs pair_volume_24h, operator notes).

Updates skills/AGENTS_INDEXER_VOLUME_PAGINATION.md with invariant V5, test file references, and the extended cargo test command including indexer_overview_global_stats.

Reviewed by Cursor Bugbot for commit 22d3ad6300. Bugbot is set up for automated code reviews on this repo. Configure here.

## Summary Closes verification/documentation gap for [GitLab #281](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/281). The core fix is **already on `main`** (`fd11a22`): BRIN index `idx_swaps_block_timestamp_brin` on `swap_events(block_timestamp)` plus a **60s TTL** whole-response cache on `GET /api/v1/overview`. This MR adds integration tests and indexer invariant docs. ## Acceptance criteria | Criterion | Verification | Result | |-----------|--------------|--------| | 24h global aggregate no longer does a full seq scan at scale | BRIN index present; integration test `swap_events_block_timestamp_brin_index_exists` | **PASS** | | `/overview` latency stays bounded as `swap_events` grows | 60s cache; integration test `overview_response_cached_within_ttl` | **PASS** | Relates to #281. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Docs and integration tests only; no runtime or API behavior changes in this diff. > > **Overview** > Documents and regression-tests GitLab **#281** for `GET /api/v1/overview` global 24h stats. The BRIN index and 60s response cache landed on `main` in `fd11a22`; this MR closes the verification gap. > > Adds **`indexer/tests/indexer_overview_global_stats.rs`**: one test asserts migration **`idx_swaps_block_timestamp_brin`** exists on `swap_events.block_timestamp`; another asserts back-to-back `/overview` responses match within the **60s** TTL. > > Updates **`docs/indexer-invariants.md`** with an indexing row for overview global stats, expands the expensive-DB DoS bullet, and adds an **Overview global stats (#281)** section (live aggregate vs `pair_volume_24h`, operator notes). > > Updates **`skills/AGENTS_INDEXER_VOLUME_PAGINATION.md`** with invariant **V5**, test file references, and the extended `cargo test` command including `indexer_overview_global_stats`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 22d3ad6300a874001f84696860b70c6099a2ade4. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
PlasticDigits commented 2026-06-05 12:42:30 +00:00 (Migrated from gitlab.com)

mentioned in issue #281

mentioned in issue #281
ghost1 commented 2026-06-05 12:42:32 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 12:42:37 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits (Migrated from gitlab.com) merged commit 76e12abef1 into main 2026-06-05 12:43:15 +00:00
PlasticDigits commented 2026-06-05 12:43:16 +00:00 (Migrated from gitlab.com)

mentioned in commit 76e12abef1

mentioned in commit 76e12abef146e191fb71528c78f8848f99c2e2d9
PlasticDigits commented 2026-06-05 12:43:26 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: 22d3ad6300a874001f84696860b70c6099a2ade4
Scope: 3 files — indexer/tests/indexer_overview_global_stats.rs (new), docs/indexer-invariants.md, skills/AGENTS_INDEXER_VOLUME_PAGINATION.md
Outcome: FINDINGS: 0 medium+

Summary

Security review: no medium+ findings on this diff.

This MR adds integration tests and documentation only. No runtime, API, migration, or dependency changes are introduced. The BRIN index and 60s /overview response cache it verifies were already merged on main (fd11a22).

Reviewed attack surfaces

Area Assessment
SQL injection New test uses a static pg_indexes lookup with hardcoded tablename / indexname — no attacker-controlled input reaches a query sink.
Authn / authz Tests call the existing public read-only GET /api/v1/overview endpoint via TestServer; no new routes or permission boundaries.
SSRF / path traversal / deserialization Not applicable — no new network clients, file I/O, or deserialization paths.
Secret leakage No credentials, tokens, or sensitive env values added; docs describe public API behavior and operator runbook notes only.
DoS Docs expand the existing expensive-DB DoS mitigation bullet (#281 cache + BRIN); this documents a defense, it does not weaken one.
Supply chain No new dependencies.

Inline threads

None — no medium+ findings to anchor on specific diff lines.


Automated security review (Cursor Cloud Agent)

## Security review **Commit reviewed:** `22d3ad6300a874001f84696860b70c6099a2ade4` **Scope:** 3 files — `indexer/tests/indexer_overview_global_stats.rs` (new), `docs/indexer-invariants.md`, `skills/AGENTS_INDEXER_VOLUME_PAGINATION.md` **Outcome:** `FINDINGS: 0` medium+ ### Summary Security review: **no medium+ findings** on this diff. This MR adds integration tests and documentation only. No runtime, API, migration, or dependency changes are introduced. The BRIN index and 60s `/overview` response cache it verifies were already merged on `main` (`fd11a22`). ### Reviewed attack surfaces | Area | Assessment | |------|------------| | **SQL injection** | New test uses a static `pg_indexes` lookup with hardcoded `tablename` / `indexname` — no attacker-controlled input reaches a query sink. | | **Authn / authz** | Tests call the existing public read-only `GET /api/v1/overview` endpoint via `TestServer`; no new routes or permission boundaries. | | **SSRF / path traversal / deserialization** | Not applicable — no new network clients, file I/O, or deserialization paths. | | **Secret leakage** | No credentials, tokens, or sensitive env values added; docs describe public API behavior and operator runbook notes only. | | **DoS** | Docs expand the existing expensive-DB DoS mitigation bullet (#281 cache + BRIN); this documents a defense, it does not weaken one. | | **Supply chain** | No new dependencies. | ### Inline threads None — no medium+ findings to anchor on specific diff lines. --- *Automated security review (Cursor Cloud Agent)*
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!805
No description provided.