Skip to content

[8.2] Reject Invalid Schema Options Combination - [MOD-14655]#9076

Merged
GuyAv46 merged 4 commits into8.2from
backport-8941-to-8.2
Apr 15, 2026
Merged

[8.2] Reject Invalid Schema Options Combination - [MOD-14655]#9076
GuyAv46 merged 4 commits into8.2from
backport-8941-to-8.2

Conversation

@GuyAv46
Copy link
Copy Markdown
Collaborator

@GuyAv46 GuyAv46 commented Apr 15, 2026

Description

Backport of #8941 to 8.2.

Describe the changes in the pull request

This fixes a crash caused by allowing the invalid FT.CREATE combination NOFIELDS + MAXTEXTFIELDS. That combination could produce unsupported text index storage flags and later crash during indexing when selecting the inverted-index encoder.

The fix rejects this combination at FT.CREATE time, and also hardens RDB loading by normalizing old persisted specs with that flag combination instead of failing startup. Regression tests were added for command parsing and RDB load behavior.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

Note

Medium Risk
Tightens FT.CREATE validation and changes how persisted index flags are interpreted on load; could affect users relying on previously-accepted (but invalid) option combinations or legacy RDBs with inconsistent flags.

Overview
Prevents a crash by rejecting the invalid FT.CREATE option combination NOFIELDS + MAXTEXTFIELDS (wide/expandable schema without stored field flags), returning a clear error instead of creating a broken index.

Hardens startup by normalizing legacy/persisted specs during RDB load: if an index has MAXTEXTFIELDS set while NOFIELDS is also set, the loader now drops the wide-schema flag and logs a warning. Adds regression tests covering the command error and the RDB-load normalization path.

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

* add a failing test

* fix

* add unit tests

(cherry picked from commit bf1be14)
@GuyAv46 GuyAv46 requested a review from lerman25 April 15, 2026 06:25
@GuyAv46 GuyAv46 added the bug label Apr 15, 2026
@GuyAv46 GuyAv46 enabled auto-merge April 15, 2026 06:26
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Apr 15, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 721dcc8. Configure here.

Comment thread src/spec.c
QueryError_SetError(status, QUERY_EINVAL,
SPEC_SCHEMA_EXPANDABLE_STR " cannot be used with " SPEC_NOFIELDS_STR);
goto failure;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing release note for user-facing behavior change

Low Severity

The PR checkbox indicates release notes are required but none are included. Per the project rule, here's a suggested release note:

Bug Fixes

  • Fixed a crash caused by using the invalid NOFIELDS + MAXTEXTFIELDS combination in FT.CREATE. This combination is now rejected with a clear error message. Existing RDB files persisted with this invalid configuration are automatically corrected on load.
Fix in Cursor Fix in Web

Triggered by project rule: Please assist in writing a GitHub release note for this PR, which is concise and focused on the user impact.

Reviewed by Cursor Bugbot for commit 721dcc8. Configure here.

@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.92%. Comparing base (3c61a97) to head (f65c4a1).
⚠️ Report is 3 commits behind head on 8.2.

Additional details and impacted files
@@            Coverage Diff             @@
##              8.2    #9076      +/-   ##
==========================================
- Coverage   88.98%   88.92%   -0.07%     
==========================================
  Files         260      260              
  Lines       42093    42102       +9     
  Branches     3851     3851              
==========================================
- Hits        37458    37440      -18     
- Misses       4586     4613      +27     
  Partials       49       49              
Flag Coverage Δ
flow 81.96% <77.77%> (-0.52%) ⬇️
unit 46.78% <88.88%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GuyAv46 GuyAv46 added this pull request to the merge queue Apr 15, 2026
Merged via the queue into 8.2 with commit b439550 Apr 15, 2026
35 checks passed
@GuyAv46 GuyAv46 deleted the backport-8941-to-8.2 branch April 15, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants