Skip to content

RI-8220: Add AROP aggregate endpoint for Array data type#6088

Open
pawelangelow wants to merge 9 commits into
mainfrom
be/RI-8220/add-aggregate
Open

RI-8220: Add AROP aggregate endpoint for Array data type#6088
pawelangelow wants to merge 9 commits into
mainfrom
be/RI-8220/add-aggregate

Conversation

@pawelangelow

@pawelangelow pawelangelow commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

Adds the POST /databases/:instanceId/array/aggregate endpoint, the API wrapper around Redis 8.8's AROP command for the new Array data type.

Supported operations: SUM, MIN, MAX, AND, OR, XOR, MATCH, USED

Behavior:

  • Range [start, end] is inclusive and direction-agnostic (mirrors AROP semantics)
  • Reuses the same 1 000 000-element span cap as ARGETRANGE
  • MATCH requires a non-empty value; ignored for other ops
  • Result is always serialized as a string so u64 / large-number precision survives the wire
  • Standard error mapping: WRONGTYPE → 400, missing key → 404, NOPERM → 403

Note

Medium Risk
New Redis command path on live database connections with a large allowed scan window; behavior aligns with existing array read endpoints and is heavily tested, but wrong-type and ACL failures still depend on Redis/server-side numeric rules.

Overview
Adds POST /databases/:instanceId/array/aggregate, exposing Redis 8.8 AROP for the Array browser API. Callers pass an inclusive start/end range, an operation (SUM, MIN, MAX, AND, OR, XOR, MATCH, USED), and optionally value for MATCH.

The service issues arop via BrowserToolArrayCommands.ArOp, reuses the same 1,000,000-element span cap as get-range, verifies the key exists, and maps WRONGTYPE → 400, missing key → 404, ACL → 403. MATCH appends the comparison value (string or Buffer, including empty); other ops ignore value. The response result is always a string (or null when AROP returns nil), using toIndexString so large numeric sums stay precise on the wire.

New AggregateArrayDto / AggregateArrayResponse types and Swagger on the controller; unit tests on ArrayService.aggregate and integration tests cover validation, each operation, binary/empty MATCH, nil results, range boundaries, and ACL on arop.

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

Adds POST /array/aggregate exposing the AROP command. Supports SUM, MIN, MAX, AND, OR, XOR, MATCH (with value arg) and USED operations over an inclusive index range. Results are serialized as strings to preserve full u64 / large-number precision.

References: #RI-8220
@pawelangelow pawelangelow self-assigned this Jun 18, 2026
@pawelangelow pawelangelow requested a review from a team as a code owner June 18, 2026 10:52
@jit-ci

jit-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39b3fb7117

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread redisinsight/api/src/modules/browser/array/array.service.ts Outdated
Comment thread redisinsight/api/src/modules/browser/array/dto/aggregate.array.dto.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3edb863f9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread redisinsight/api/src/modules/browser/array/array.service.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 980655b8a0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread redisinsight/api/src/modules/browser/array/array.service.ts Outdated
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Backend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 93.01% 16157/17371
🟡 Branches 75.17% 5096/6779
🟢 Functions 87.31% 2497/2860
🟢 Lines 92.84% 15440/16630

Test suite run success

3597 tests passing in 317 suites.

Report generated by 🧪jest coverage report action from 93a743e

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Integration Tests

Status Category Percentage Covered / Total
🟡 Statements 78.49% 17786/22660
🟡 Branches 61.25% 8217/13415
🟡 Functions 66.34% 2421/3649
🟡 Lines 78.05% 16728/21432

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 69d54b9. Configure here.

Comment thread redisinsight/api/test/api/array/POST-databases-id-array-aggregate.test.ts Outdated
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