Skip to content

fix(#15034): COMPACT INDEX of an index that does not exist answers 400, not 500 - #15040

Open
iklas-titan wants to merge 1 commit into
ArcadeData:mainfrom
iklas-titan:fix/15034-compact-index-missing-400
Open

iklas-titan wants to merge 1 commit into
ArcadeData:mainfrom
iklas-titan:fix/15034-compact-index-missing-400

Conversation

@iklas-titan

Copy link
Copy Markdown
Contributor

Closes #15034

What

COMPACT INDEX nope looked the index up inside the try that wraps every failure in an IndexException, so the SchemaException of a missing name was logged at SEVERE and answered HTTP 500. The named index is now resolved before the try, as REBUILD INDEX does (#11803). A missing name answers HTTP 400 SchemaException "Index with name 'nope' was not found" (gRPC still answers NOT_FOUND). COMPACT INDEX * is unchanged.

Tests

  • CompactIndexStatementTest#compactingAnIndexThatDoesNotExistIsRefusedAsASchemaError (engine)
  • HttpErrorStatusServerTest.SqlUserErrors#compactingAnIndexThatDoesNotExistIs400 (server)

Checked against a server built from this branch: HTTP 400 / gRPC NOT_FOUND, the same answer as REBUILD INDEX and DROP INDEX.

🤖 Generated with Claude Code

…answers 400, not 500

The index is resolved before the try that wraps every failure in an IndexException, as REBUILD INDEX does, so a
missing name is refused with the lookup's SchemaException (HTTP 400, gRPC NOT_FOUND) instead of an IndexException
that reads as a server fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 938f995f-064d-4a81-ad69-0a0605c3a8e2
Commits

Reviewing files that changed from the base of the PR and between 8fc98db and 21a1ec4.

Files selected for processing: 3

  • engine/src/main/java/com/arcadedb/query/sql/parser/CompactIndexStatement.java
  • engine/src/test/java/com/arcadedb/index/CompactIndexStatementTest.java
  • server/src/test/java/com/arcadedb/server/http/handler/HttpErrorStatusServerTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@mergify

mergify Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions github-actions Bot added engine Core engine: document/schema API has-issue The PR links an issue it resolves severity:minor Cosmetic, documentation, edge case, or a workaround exists sql triage:lgtm PR triage: nothing blocking, ready for a maintainer labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Triage: triage:lgtm · severity:minor · areas: sql, engine · has-issue

The change looks good. COMPACT INDEX <name> now resolves the index before the try, the same way REBUILD INDEX does. A missing name now surfaces as the SchemaException (HTTP 400) instead of being wrapped in an IndexException (HTTP 500). COMPACT INDEX * is unchanged because namedIndex is null when all is set.

  • Scope: the diff is small and limited to the issue. It adds no dependencies and has no security impact.
  • Tests: there is an engine regression test and a server HTTP test that checks the 400 status. Both follow the project conventions: AssertJ, no hard-coded ports and no wall-clock assertions.
  • Severity: this fixes a wrong HTTP status for a user mistake, and the operation was already failing, so I rated it minor.

I could only read the diff and could not run the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine Core engine: document/schema API has-issue The PR links an issue it resolves severity:minor Cosmetic, documentation, edge case, or a workaround exists sql triage:lgtm PR triage: nothing blocking, ready for a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL: COMPACT INDEX of an index that does not exist answers HTTP 500 IndexException instead of 400 (gRPC answers NOT_FOUND)

1 participant