Skip to content

fix(#11959): gRPC ExecuteCommand honours projectionSettings like ExecuteQuery - #11976

Open
shaunpatterson wants to merge 1 commit into
ArcadeData:mainfrom
shaunpatterson:fix/11959-grpc-command-projection
Open

shaunpatterson wants to merge 1 commit into
ArcadeData:mainfrom
shaunpatterson:fix/11959-grpc-command-projection

Conversation

@shaunpatterson

@shaunpatterson shaunpatterson commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #11959.

Problem

executeCommandInternal never read ExecuteCommandRequest.projectionSettings (field 9). Every row went through a hard-coded new ProjectionConfig(true, PROJECTION_AS_JSON, 0), so a nested record came back as bytes_value JSON (logical_type: "json") whatever encoding the client asked for. ExecuteQuery and StreamQuery honour the field.

Change

  • One static projectionConfigOf(hasSettings, settings) in ArcadeDbGrpcService builds the ProjectionConfig. ExecuteQuery, StreamQuery and ExecuteCommand all call it. It replaces the two duplicated builders (getProjectionConfig, getProjectionConfigFromRequest) and the hard-coded config in ExecuteCommand.
  • ExecuteCommand builds its config once per request rather than once per row.
  • If the field is unset, the default is unchanged (include projections, JSON, no soft limit), so a client that sends no settings gets the same bytes as before.

Measured (E2E, grpcio 1.85.1, proto_repros.py F5, container with this branch's grpcw jar)

SELECT k, outE('E') AS oe FROM V WHERE k = 1, value of oe[0]:

RPC requested before after
ExecuteCommand PROJECTION_AS_MAP bytes {"@rid":"#4:0","@type":"E","w":1.5,...} map {@rid: link, @type: "E", w: 1.5} (same as ExecuteQuery)
ExecuteCommand PROJECTION_AS_LINK the same bytes link #4:0 (same as ExecuteQuery)

Tests

  • Issue11959GrpcCommandProjectionIT: MAP and LINK over ExecuteCommand (MAP compared with ExecuteQuery's value), and the unset-field default (JSON bytes) on both RPCs. On main the MAP and LINK tests fail (BYTES_VALUE received) and the default test passes. With the fix all 3 pass.
  • grpcw module (com/arcadedb/server/grpc/**): 938 run, 0 failed, 0 errors, 0 skipped.

Behaviour change for clients that already send the field

A client that already set projectionSettings on ExecuteCommand had it ignored until now. After this change the server applies it, so such a client gets different command output: the encoding it asked for, include_projections as sent (proto3 reads an unset bool as false, so a client that sets only the encoding now gets include_projections = false), and the soft limit, counted once per request. ArcadeDB's own Java client is not affected: RemoteGrpcDatabase.executeCommand sends no projection settings (only executeQuery does).

Does not touch any file of #11920, #11967 or #11968.

Summary by CodeRabbit

  • Bug Fixes
    • gRPC command responses now apply projection settings consistently with query responses. When map encoding is selected, nested edge projections include their RID and properties; link encoding returns the edge link. When no projection settings are provided, command and query responses both use JSON encoding.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The gRPC service now resolves projection settings through a shared helper for command, query, and streaming calls. An integration test checks map, link, and default JSON encodings.

Changes: gRPC Projection Settings

Layer / File(s) Summary
Shared projection resolution
grpcw/src/main/java/com/arcadedb/server/grpc/ArcadeDbGrpcService.java
executeCommand, executeQuery, and streamQuery use shared projection-settings resolution. Command result rows use the resolved configuration.
Projection encoding integration tests
grpcw/src/test/java/com/arcadedb/server/grpc/Issue11959GrpcCommandProjectionIT.java
The integration test checks command and query results with map encoding, link encoding, and no projection settings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: grpc

Suggested reviewers: lvca

Merge Risk: Minimal · up to aed09

gRPC ExecuteCommand now honors the request's projection settings, matching ExecuteQuery and StreamQuery, and the default behavior is preserved. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: gRPC ExecuteCommand now honours projectionSettings, as ExecuteQuery already does, and it references issue #11959. The description and changeset both center on this fix…
Linked Issues check Passed Issue #11959 requires ExecuteCommand to build its ProjectionConfig from request.getProjectionSettings(), as ExecuteQuery does, and to keep the JSON default when the field is unset. The reviewed head m…
Out of Scope Changes check Passed The ArcadeDbGrpcService.java diff changes only projection handling. It adds the shared projectionConfigOf helper, removes the duplicated getProjectionConfig and getProjectionConfigFromRequest builders…
Description check Passed The description covers the problem, the change, measured E2E results, tests, and a behaviour change for clients that already send projectionSettings. It names the affected RPCs, the shared helper, and…
Full details: Title check

Explanation

The title names the main change: gRPC ExecuteCommand now honours projectionSettings, as ExecuteQuery already does, and it references issue #11959. The description and changeset both center on this fix, so the title matches the primary change.

Full details: Linked Issues check

Explanation

Issue #11959 requires ExecuteCommand to build its ProjectionConfig from request.getProjectionSettings(), as ExecuteQuery does, and to keep the JSON default when the field is unset. The reviewed head meets both requirements. In executeCommandInternal, the diff replaces the hard-coded new ProjectionConfig(true, PROJECTION_AS_JSON, 0) with projectionConfigOf(req.hasProjectionSettings(), req.getProjectionSettings()). The config is built once per request and passed to convertResultToGrpcRecord for each row. The new static helper projectionConfigOf returns the JSON default when settings are absent. Otherwise it reads the include flag, encoding, and soft limit (default 0). ExecuteQuery and StreamQuery now call the same helper, so all three RPCs read the settings the same way. The added Issue11959GrpcCommandProjectionIT covers MAP and LINK on ExecuteCommand and the unset default on both RPCs, as described in the PR. I did not read the test file body. The test results are taken from the PR description and were not re-run. Issue #11959 is the only active directly linked issue. The PR objectives add no extra coding requirements.

Full details: Out of Scope Changes check

Explanation

The ArcadeDbGrpcService.java diff changes only projection handling. It adds the shared projectionConfigOf helper, removes the duplicated getProjectionConfig and getProjectionConfigFromRequest builders, and updates ExecuteCommand, ExecuteQuery, and StreamQuery to call the helper. It also removes the now-unused org.jspecify.annotations.NonNull import. That removal is part of the same refactor. The added test file Issue11959GrpcCommandProjectionIT supports the linked issue. No unrelated file or behavior change appears in the reviewed diff. The PR states it does not touch files of #11920, #11967, or #11968. I did not verify that claim separately.

Full details: Description check

Explanation

The description covers the problem, the change, measured E2E results, tests, and a behaviour change for clients that already send projectionSettings. It names the affected RPCs, the shared helper, and the default behaviour. It follows the template structure in substance, though it uses headings such as Problem, Change, Measured, Tests instead of the template's What does this PR do / Motivation / Related issues / Additional Notes / Checklist. It references Fixes #11959 and does not list the Checklist items (mvn clean package run, failure and success test coverage). The Related issues and Checklist content is only partly present: the issue is linked, but the checklist is not ticked and the build run via mvn clean package is not stated explicitly.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

Recent review info

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: 707aa9bf-45b5-4864-ab74-9c44546ae50f
Commits

Reviewing files that changed from the base of the PR and between 2eb615c and aed09f1.

Files selected for processing: 2

  • grpcw/src/main/java/com/arcadedb/server/grpc/ArcadeDbGrpcService.java
  • grpcw/src/test/java/com/arcadedb/server/grpc/Issue11959GrpcCommandProjectionIT.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@mergify

mergify Bot commented Nov 15, 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

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

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 grpc gRPC wire protocol (grpc/grpc-client/grpcw) has-issue The PR links an issue it resolves severity:minor Cosmetic, documentation, edge case, or a workaround exists triage:lgtm PR triage: nothing blocking, ready for a maintainer labels Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage: triage:lgtm · severity:minor · areas: grpc · has-issue

This fixes #11959. ExecuteCommand now honours projectionSettings like ExecuteQuery and StreamQuery. I could only read the diff and the base branch, so I did not compile it or run the tests.

  • Shared helper: a single static projectionConfigOf(hasSettings, settings) replaces the two duplicated builders and the hard-coded config in ExecuteCommand. The unset-field default is unchanged: include projections, JSON, no soft limit.
  • Performance: the config is built once per request instead of once per row, which is a small improvement.
  • Removed import: org.jspecify.annotations.NonNull was only used by the deleted getProjectionConfig. The base branch has no other @​NonNull use in this file, so removing the import is safe.
  • Tests: Issue11959GrpcCommandProjectionIT covers the MAP and LINK encodings over ExecuteCommand. It compares the MAP result with ExecuteQuery's value and also checks the JSON default with no settings. It follows the BaseGrpcServerTest fixture and the assertThat style from CLAUDE.md.
  • Scope: the diff touches only the gRPC service and its test, with no unrelated changes and no security concerns.

Optional: StreamQuery's use of the shared helper has no test of its own. It now uses the same helper as the two covered RPCs, so I would not block on it.

@shaunpatterson

Copy link
Copy Markdown
Contributor Author

Thanks for the triage. I added a body section on the one behaviour change. A client that already sent projectionSettings on ExecuteCommand had it ignored and now gets it applied, including include_projections, which proto3 reads as false when the client sets only the encoding. ArcadeDB's Java client sends no settings on commands, so it is not affected. StreamQuery has no test of its own. It uses the same helper as the two RPCs that are tested.

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

Labels

grpc gRPC wire protocol (grpc/grpc-client/grpcw) has-issue The PR links an issue it resolves severity:minor Cosmetic, documentation, edge case, or a workaround exists triage:lgtm PR triage: nothing blocking, ready for a maintainer

Projects

None yet

1 participant