Skip to content

[server] Fix exec_mut rejection when only insert or remove index queries are sent #1898#1899

Merged
michaelvlach merged 1 commit into
mainfrom
1898-server-fix-exec_mut-rejection-when-only-insert-or-remove-index-queries-are-sent
Jun 25, 2026
Merged

[server] Fix exec_mut rejection when only insert or remove index queries are sent #1898#1899
michaelvlach merged 1 commit into
mainfrom
1898-server-fix-exec_mut-rejection-when-only-insert-or-remove-index-queries-are-sent

Conversation

@michaelvlach

Copy link
Copy Markdown
Collaborator

No description provided.

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agdb Ready Ready Preview, Comment Jun 25, 2026 8:52pm

Copilot AI left a comment

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.

Pull request overview

This PR fixes server-side role classification for index mutation queries so exec_mut correctly routes InsertIndex/RemoveIndex batches through the mutable execution path (instead of being treated as read-only and rejected).

Changes:

  • Treat QueryType::InsertIndex as requiring DbUserRole::Write.
  • Treat QueryType::RemoveIndex as requiring DbUserRole::Write.
Comments suppressed due to low confidence (1)

agdb_server/src/utilities.rs:67

  • required_role drives whether exec_mut uses the mutable/cluster path; this bug fix adds InsertIndex/RemoveIndex, but there is still no regression test ensuring index-only query batches are classified as Write. Adding a unit test that builds Queries(vec![QueryType::InsertIndex(..)]) and Queries(vec![QueryType::RemoveIndex(..)]) and asserts required_role(...) == DbUserRole::Write would prevent this from reappearing.
pub(crate) fn required_role(queries: &Queries) -> DbUserRole {
    for q in &queries.0 {
        match q {
            QueryType::InsertAlias(_)
            | QueryType::InsertEdges(_)
            | QueryType::InsertIndex(_)
            | QueryType::InsertNodes(_)
            | QueryType::InsertValues(_)
            | QueryType::Remove(_)
            | QueryType::RemoveAliases(_)
            | QueryType::RemoveIndex(_)
            | QueryType::RemoveValues(_) => {
                return DbUserRole::Write;
            }
            _ => {}
        }
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@michaelvlach michaelvlach merged commit d0a6ad9 into main Jun 25, 2026
11 of 12 checks passed
@michaelvlach michaelvlach deleted the 1898-server-fix-exec_mut-rejection-when-only-insert-or-remove-index-queries-are-sent branch June 25, 2026 21:06
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.

[server] Fix exec_mut rejection when only insert or remove index queries are sent

3 participants