Skip to content

RDBC-1156 RavenDB-22083 Report a proper IndexCompilationException for a C# index whose outer from clause does not enumerate the documents source - #316

Merged
poissoncorp merged 3 commits into
ravendb:v7.2from
poissoncorp:sdk-sync/RDBC-1156
Oct 22, 2026
Merged

poissoncorp merged 3 commits into
ravendb:v7.2from
poissoncorp:sdk-sync/RDBC-1156

Conversation

@poissoncorp

@poissoncorp poissoncorp commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Index compilation errors from the server now raise IndexCompilationException, with the failing index_definition_property and problematic_text, instead of a plain RavenException.

  • Changed: new CompilationException and IndexCompilationException, exported from ravendb, mapped in ExceptionDispatcher, which fills both fields from the error body. AbstractIndexCreationTask.create_index_definition raises IndexCompilationException instead of RuntimeError, as the C# client does.
  • Not ported: IndexDefinitionHelper.FormatLinqQuery whole-word matching of the query source. It is C# LINQ expression tree code, and Python index maps are plain strings.
  • Tests: new test_ravenDB_22083.py with 7 server tests from RavenDB_22083, with the LINQ maps written as index text, and 3 dispatcher tests that need no server. The tests for LINQ parameter name substitution and AddMapForAll are C#-specific.
  • Checks: black --check . passed; the dispatcher tests, test_exception_dispatcher and test_commercial_limits passed (15); the server tests run only in CI.

Decision needed

The C# change itself is LINQ-only. The Python client had no IndexCompilationException, so the server error that this ticket improves could not be told apart from other errors. Adding it is about 30 lines plus the dispatcher wiring.

  1. Merge as is (recommended): it matches the C# public API and makes the improved server error usable. IndexCompilationException is still a RuntimeError, so existing handlers keep working. The one visible difference in create_index_definition is that the inner error is now in .cause instead of args[1].
  2. Keep the new exceptions but leave create_index_definition raising RuntimeError.
  3. Do not merge, and mark the ticket not needed for Python because the client change is LINQ-only.

Ticket: RDBC-1156
C# change: ravendb/ravendb#23581

SDK Sync Agent

@poissoncorp poissoncorp added the sdk-sync Port of C# client changes from an SDK sync task label Oct 7, 2026
@poissoncorp
poissoncorp marked this pull request as ready for review October 7, 2026 12:24
…d name, expect the server message for a query-syntax map
@poissoncorp

Copy link
Copy Markdown
Contributor Author

Fixed the failing RavenDB_22083 tests in d43a14e.

  • ref is a C# keyword, so the server could not read it as a field name in the index maps. The test indexes now use reference. This fixes test_index_with_constant_array_as_inner_source_deploys_and_indexes and test_index_with_ordered_reduce_deploys_and_indexes.
  • The Python map is a query-syntax string. For it, the server returns "must start its enumeration from 'docs'", the same message as for the C# map sent as text. The C# wording "a C# map must start its enumeration from one of these sources" applies only to maps that the C# client builds from LINQ in method syntax. test_index_with_constant_array_as_outer_source_is_rejected_at_compilation now expects the server message.

Checks: black passes and the dispatch unit tests pass. The server tests run only in CI.

SDK Sync Agent

@poissoncorp

Copy link
Copy Markdown
Contributor Author

The failing build job is not caused by this PR.

SDK Sync Agent

@poissoncorp

Copy link
Copy Markdown
Contributor Author

The failing check is not caused by this PR. No code change.

SDK Sync Agent

@poissoncorp

Copy link
Copy Markdown
Contributor Author

Merged v7.2 into this branch (81621be) to pick up the test fix from #318. No change to the code of this PR.

  • test_secured_subscription_basic: the tests now wait 15 seconds for a batch instead of 4, longer than the 5-second reconnect delay of the worker.
  • black --check passes locally. The tests need a server and run only in CI.

SDK Sync Agent

@poissoncorp
poissoncorp merged commit 5860905 into ravendb:v7.2 Oct 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-sync Port of C# client changes from an SDK sync task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant