Skip to content

RI-8219: Integration tests for array read endpoints#6078

Merged
pawelangelow merged 2 commits into
mainfrom
be/RI-8219/add-integration-tests
Jun 18, 2026
Merged

RI-8219: Integration tests for array read endpoints#6078
pawelangelow merged 2 commits into
mainfrom
be/RI-8219/add-integration-tests

Conversation

@pawelangelow

@pawelangelow pawelangelow commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

Add integration coverage for the seven Array read endpoints landed
in #6064, plus a Redis 8.8-gated section in keys/get-info that exercises the
new GetArrayKeyInfoResponse oneOf branch.

Eight test files:

  • array/POST-databases-id-array-get_range.test.ts — ARGETRANGE
  • array/POST-databases-id-array-scan.test.ts — ARSCAN
  • array/POST-databases-id-array-get_length.test.ts — ARLEN
  • array/POST-databases-id-array-get_count.test.ts — ARCOUNT
  • array/POST-databases-id-array-get_next_index.test.ts — ARNEXT
  • array/POST-databases-id-array-get_element.test.ts — ARGET
  • array/POST-databases-id-array-get_elements.test.ts — ARMGET
  • keys/POST-databases-id-keys-get_info.test.ts — Array branch

What the suite pins, beyond what unit specs already cover:

  • decimal-string contract for length / count / scan-index / next-index
    (incl. a u64 boundary case above Number.MAX_SAFE_INTEGER);
  • gap-preserving semantics — empty slots surface as JSON null;
  • RedisStringToBufferTransformer null passthrough on encoding=buffer;
  • explicit limit: null on scan treated as omitted;
  • the 400 paths hardened in RI-8219: Add Array read endpoints + key-info strategy #6064 (reversed range, range > 1M, ARMGET
    @ArrayMinSize(1) and the per-call indexes cap, non-decimal / out-of-u64);
  • WrongType, missing key, missing instance per endpoint;
  • per-command ACL denials (-arget, -arlen, -arcount, -arnext,
    -armget, -argetrange, -arscan).

All assertions go through the existing deps / validateApiCall /
getMainCheckFn harness; every Array describe is gated by
requirements('rte.version>=8.8') so non-preview RTE jobs skip cleanly
rather than fail.

Testing

  • yarn lint:api — clean
  • yarn --cwd redisinsight/api type-check — passes against the baseline
  • yarn --cwd redisinsight/api test:api — runs the new suite end-to-end
    against an Array-capable RTE; skips on RTE jobs without Redis 8.8 preview.

Note

Low Risk
Test-only changes with no production API or runtime behavior modified; risk is limited to CI duration on Redis 8.8 array RTE jobs.

Overview
Adds Redis 8.8–gated API integration coverage for the seven array read routes (get-count, get-element, get-elements, get-length, get-next-index, get-range, scan) using the existing validateApiCall / getMainCheckFn harness. Suites assert wire contracts that unit tests do not fully exercise end-to-end: decimal-string length/count/indexes (including u64 above MAX_SAFE_INTEGER), sparse gap behavior (null for empty or past-end slots vs 404 only for missing keys), encoding=buffer with null passthrough, get-range 1M span caps (including reversed ranges), scan limit validation and huge sparse spans without a span cap, and ARNEXT cursor semantics after ARINSERT/ARSEEK.

Each endpoint gets shared validation, wrong-type / missing key / bad instance, and per-command ACL cases. Array create tests gain cases for duplicate sparse indexes (last wins), the 2^64−1 reserved index, and empty sparse elements. keys/get-info array coverage moves to test/api/array/POST-databases-id-keys-get_info-array.test.ts so array-tagged RTE jobs run it without duplicating untagged suites.

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

@pawelangelow pawelangelow self-assigned this Jun 16, 2026
@pawelangelow pawelangelow requested a review from a team as a code owner June 16, 2026 12:52
@jit-ci

jit-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Backend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 93% 16112/17325
🟡 Branches 75.14% 5081/6762
🟢 Functions 87.33% 2495/2857
🟢 Lines 92.83% 15396/16585

Test suite run success

3584 tests passing in 317 suites.

Report generated by 🧪jest coverage report action from 6704543

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Integration Tests

Status Category Percentage Covered / Total
🟡 Statements 78.21% 17686/22611
🟡 Branches 60.9% 8148/13378
🟡 Functions 65.84% 2400/3645
🟡 Lines 77.77% 16632/21384

@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: 907a9e60d4

ℹ️ 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/test/api/array/POST-databases-id-array-get_count.test.ts Outdated
pawelangelow added a commit that referenced this pull request Jun 16, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.

@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: c7101cf2ae

ℹ️ 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".

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Frontend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 83.17% 25302/30421
🟡 Branches 68.44% 10672/15594
🟡 Functions 78.3% 6797/8681
🟢 Lines 83.63% 24699/29533

Test suite run success

7182 tests passing in 816 suites.

Report generated by 🧪jest coverage report action from ee9c833

pawelangelow added a commit that referenced this pull request Jun 16, 2026
ARNEXT on Redis 8.8.0 GA returns 0 for every populated array — its
documented summary 'returns the next index ARINSERT would use' is a
different operation from what this endpoint exposes (the next safe
write index after the highest populated slot).

ARLEN already returns max_index + 1 for both dense and sparse arrays,
which is exactly the value the endpoint, its response DTO description,
and its integration tests promise. Swap the primitive, tighten the
response shape (`index` is now non-nullable string), drop the
unreachable '(exhausted)' unit case, and remove the now-unused ArNext
enum member plus its ioredis builtin registration.

Caught by the new oss-st-8 RTE on PR #6078, where every
get-next-index Main case was returning index '0' regardless of array
shape. Verified against redis:8.8-alpine: ARLEN k → 3 for a dense
[0,1,2], 6 for sparse [0,_,_,_,_,5] — matches the test expectations.
pawelangelow added a commit that referenced this pull request Jun 16, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch from 10d3ed3 to 8e2f2c9 Compare June 16, 2026 14:04

@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: 8e2f2c9311

ℹ️ 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

@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: c3f9cc1560

ℹ️ 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".

@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: 0432a78835

ℹ️ 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/test/helpers/test/conditionalIgnore.ts Outdated
pawelangelow added a commit that referenced this pull request Jun 16, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch from 0432a78 to 6e19140 Compare June 16, 2026 14:52
Comment thread redisinsight/api/test/helpers/test/conditionalIgnore.ts Outdated
Comment thread redisinsight/api/test/api/.mocharc.cjs 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: 72d645ad8d

ℹ️ 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/test/api/.mocharc.cjs Outdated
pawelangelow added a commit that referenced this pull request Jun 17, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch from 72d645a to ee9c833 Compare June 17, 2026 07:45

@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: ee9c8333c1

ℹ️ 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/test/api/array/POST-databases-id-array-get_next_index.test.ts Outdated
pawelangelow added a commit that referenced this pull request Jun 17, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch from ee9c833 to 57a399f Compare June 17, 2026 09:37

@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 57a399f. Configure here.

Comment thread redisinsight/api/test/api/array/POST-databases-id-array-get_next_index.test.ts Outdated
pawelangelow added a commit that referenced this pull request Jun 17, 2026
The outer `beforeEach(rte.data.truncate)` wipes data between every test,
including ACL cases. Only the authorised-user case re-seeded `aclKey` in
its `before`; the forbidden-command cases just flipped ACL rules. As a
result `checkIfKeyNotExists` returned 404 before Redis ever ran the
target array command, so the suite expected 403 but got Not Found on
ACL-enabled runs.

Reseed `aclKey` via the root `rte.client` (which bypasses ACL) in each
deny case's `before`, then flip the ACL rules for the API request. Fixes
the same pattern in all seven array integration test files.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch from 57a399f to 6d70bdc Compare June 17, 2026 10:02

@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: 6d70bdc488

ℹ️ 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/test/api/array/POST-databases-id-array-scan.test.ts Outdated
Base automatically changed from be/RI-8219/add-api-endpoints to main June 17, 2026 10:30
Adds integration coverage for the Array read API surface, gated by
`requirements('rte.version>=8.8')` so they only run against RTEs that
ship the Array data type:

- Per-endpoint suites under test/api/array/ for get-count, get-element,
  get-elements, get-length, get-next-index, get-range and scan.
- Array branch of the shared /keys/get-info endpoint in
  test/api/array/POST-databases-id-keys-get_info-array.test.ts (the
  matching branch is removed from the keys suite to avoid duplicate
  runs); a forwarding comment is added on the keys side.
- Extra cases for the existing create endpoint:
  duplicate-index last-write-wins, 2^64-1 sentinel rejection, and the
  symmetric empty-elements guard for sparse mode.
@pawelangelow pawelangelow force-pushed the be/RI-8219/add-integration-tests branch 2 times, most recently from 6778c49 to 6d8034b Compare June 17, 2026 11:48
].map(mainCheckFn);
});

// Array coverage for this endpoint lives in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: not sure if this brings too much value as a comment

@pawelangelow pawelangelow merged commit 669391f into main Jun 18, 2026
29 checks passed
@pawelangelow pawelangelow deleted the be/RI-8219/add-integration-tests branch June 18, 2026 10:54
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