Skip to content

fix(#12519): a gRPC projection row with a @type column stays a projection - #13203

Merged
lvca merged 1 commit into
mainfrom
fix/12519-grpc-projection-type-column
Nov 23, 2026
Merged

lvca merged 1 commit into
mainfrom
fix/12519-grpc-projection-type-column

Conversation

@lvca

@lvca lvca commented Nov 23, 2026

Copy link
Copy Markdown
Member

Fixes #12519

Problem

Over gRPC, SELECT @type, name FROM P reached the client as a RemoteImmutableVertex of type P without the @type column. ArcadeDbGrpcService.convertResultToGrpcRecord recovers the record type of any non-element row from a String @type property, because a row forwarded from the Raft leader is rebuilt on the follower as a plain ResultInternal made of a map (#4688). A local projection with a column of that name has the same shape and took the same path. #12226 only narrowed the guess for rows holding a record column.

Fix

  • ResultInternal.FORWARDED_ROW_METADATA is a metadata key in the engine, which grpcw already sees (grpcw must not depend on ha-raft).
  • RaftReplicatedDatabase.parseResultSetFromJson marks every row it builds from the leader's JSON.
  • convertResultToGrpcRecord recovers the type only for a marked row. holdsRecordColumn is gone: it was a guess for the same problem.

The key starts with @, so no LET variable or $depth-style metadata can read or shadow it.

Limitation, same as before: a projection forwarded from the leader whose JSON has an @type column is indistinguishable from a forwarded record and stays typed.

Tests

  • Issue12519GrpcProjectionTypeColumnTest (grpcw, unit): the converter on a plain projection row with an @type column (no mark: stays a projection, column kept, also with a list column) and on a marked row (typed).
  • RaftReplicatedDatabaseTest.parseResultSetFromJsonMarksEveryRowItBuilds (ha-raft, unit).
  • Issue12519GrpcProjectionTypeColumnIT (grpc-client): SELECT @type, name, SELECT @type, out() AS friends, Cypher RETURN 'P' AS @type, collect(n), the streamed form, and a whole record still a record.
  • Issue12519GrpcFollowerRowTypeIT (grpcw, 2-node Raft): an INSERT forwarded by a follower answers a typed record, a local SELECT @type, name on the follower stays a projection. Without the mark the forwarded half fails.

Also run: TimeSeriesGrpcForwardedInsertTypeIT, TimeSeriesGrpcInsertResultTypeIT, Issue12196GrpcRecordRowsIT, all grpc-client ITs, the grpcw unit tests and a set of grpcw ITs (including the follower forwarding ones).

…tion, only the rows a follower rebuilt from its leader's JSON are typed

The gRPC service recovered the record type of any non-element row from its @type property, because a row forwarded from the Raft leader is rebuilt on the follower as a plain ResultInternal made of a map (#4688). A local projection such as SELECT @type, name FROM P has the same shape, so the client read it as a record of that type and the row lost its columns. The follower now marks the rows it builds from the leader's JSON (ResultInternal.FORWARDED_ROW_METADATA) and the service recovers the type only for a marked row, which also makes the holdsRecordColumn guess of #12196 unnecessary.
@lvca lvca added this to the 26.12.1 milestone Nov 23, 2026
@lvca lvca self-assigned this Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 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 30 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: 6a708a46-2377-463c-999c-36ce9c9603ae
Commits

Reviewing files that changed from the base of the PR and between 28140cb and 064af07.

Files selected for processing: 7

  • engine/src/main/java/com/arcadedb/query/sql/executor/ResultInternal.java
  • grpc-client/src/test/java/com/arcadedb/remote/grpc/Issue12519GrpcProjectionTypeColumnIT.java
  • grpcw/src/main/java/com/arcadedb/server/grpc/ArcadeDbGrpcService.java
  • grpcw/src/test/java/com/arcadedb/server/grpc/Issue12519GrpcFollowerRowTypeIT.java
  • grpcw/src/test/java/com/arcadedb/server/grpc/Issue12519GrpcProjectionTypeColumnTest.java
  • ha-raft/src/main/java/com/arcadedb/server/ha/raft/RaftReplicatedDatabase.java
  • ha-raft/src/test/java/com/arcadedb/server/ha/raft/RaftReplicatedDatabaseTest.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 Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@codacy-production

codacy-production Bot commented Nov 23, 2026 •

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

🟢 Coverage 100.00% diff coverage · -4.09% coverage variation

Metric Results
Coverage variation ✅ -4.09% coverage variation
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (28140cb) 302634 267117 88.26%
Head commit (064af07) 336240 (+33606) 283030 (+15913) 84.17% (-4.09%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#13203) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

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 grpc gRPC wire protocol (grpc/grpc-client/grpcw) ha High availability / replication (Raft) 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 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

LGTM. The fix replaces the holdsRecordColumn guess in ArcadeDbGrpcService.convertResultToGrpcRecord with an explicit mark. RaftReplicatedDatabase.parseResultSetFromJson sets ResultInternal.FORWARDED_ROW_METADATA on every row it builds from the leader's JSON, and the converter recovers the type only for a marked row. The design is clean, and grpcw still doesn't depend on ha-raft.

  • Mark: @​forwardedRow starts with @, so user queries and LET variables can't read or shadow it. The metadata isn't serialized into row properties, so it doesn't leak to clients.
  • Cost: The change is cheap. The only extra work on a forwarded row is one lazily created map, and the per-row column scan is gone.
  • Tests: Coverage follows the repo's TDD and regression-test rules.
    • Unit tests: converter with and without the mark, and parseResultSetFromJson marking every row.
    • Integration tests: grpc-client and a 2-node Raft follower test.
    • The Raft IT is tagged @​Tag("slow") and uses allocated ports, as CLAUDE.md requires.
  • Known limitation: A forwarded projection whose JSON has an @​type column stays typed. The PR body already states this.
  • Nit, ArcadeDbGrpcService: The com.arcadedb.database.Document import is still used elsewhere in the file, so no cleanup is needed there.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.44%. Comparing base (28140cb) to head (064af07).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../com/arcadedb/server/grpc/ArcadeDbGrpcService.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13203   +/-   ##
=========================================
  Coverage     80.44%   80.44%           
  Complexity      582      582           
=========================================
  Files          2629     2629           
  Lines        302634   302632    -2     
  Branches      67070    67069    -1     
=========================================
- Hits         243458   243457    -1     
+ Misses        35557    35544   -13     
- Partials      23619    23631   +12     

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lvca
lvca merged commit 8b89f3c into main Nov 23, 2026
40 of 43 checks passed
@lvca
lvca deleted the fix/12519-grpc-projection-type-column branch November 23, 2026 23:13
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 grpc gRPC wire protocol (grpc/grpc-client/grpcw) ha High availability / replication (Raft) 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