Repository navigation
feat(gremlin): add the projects of the core and of Azure Cosmos DB - #75
xperiandri wants to merge 1 commit into
Conversation
|
Warning Review limit reachedYou'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 45 minutes. View limit details
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. |
There was a problem hiding this comment.
🟡 Changes recommended
Database and graph ID validation still accepts trailing spaces that Cosmos DB forbids, allowing both factories to construct invalid settings.
2 open issues
What changed in this PR
Adds the foundation for Gremlin support alongside the existing Cosmos library, separating provider-independent graph types from Azure Cosmos DB connection settings. Both libraries remain non-packable until end-to-end queries are supported.
Changes:
- Introduces graph attributes and a struct-based vertex property type with meta-properties.
- Adds Azure and emulator connection factories, input validation, and key-free display formatting.
- Adds unit-test projects and integrates all four projects into the solution.
| File | Description |
|---|---|
tests/Gremlin.Tests/VertexPropertyTests.fs |
Tests property creation, optional values, and structural equality. |
tests/Gremlin.Tests/testconfig.json |
Enables method-level test parallelism. |
tests/Gremlin.Tests/TestCategories.fs |
Defines the graph-model test category. |
tests/Gremlin.Tests/FSharp.Gremlin.Tests.fsproj |
Configures the core unit-test project. |
tests/Gremlin.Tests/AttributeTests.fs |
Tests attribute placement on records and properties. |
tests/Cosmos.Gremlin.Tests/testconfig.json |
Enables method-level test parallelism. |
tests/Cosmos.Gremlin.Tests/TestCategories.fs |
Defines the connection test category. |
tests/Cosmos.Gremlin.Tests/FSharp.Azure.Cosmos.Gremlin.Tests.fsproj |
Configures the provider unit-test project. |
tests/Cosmos.Gremlin.Tests/CosmosGremlinConnectionTests.fs |
Tests connection defaults, validation, and display formatting. |
src/Gremlin/VertexProperty.fs |
Adds vertex properties with typed meta-properties and helpers. |
src/Gremlin/FSharp.Gremlin.fsproj |
Defines the non-packable, provider-independent library. |
src/Gremlin/Attributes.fs |
Adds label and partition-key attributes. |
src/Gremlin/AssemblyInfo.fs |
Supplies core assembly metadata. |
src/Cosmos.Gremlin/FSharp.Azure.Cosmos.Gremlin.fsproj |
Defines the non-packable provider library referencing the core. |
src/Cosmos.Gremlin/CosmosGremlinConnection.fs |
Adds connection settings and validated Azure/emulator factories. |
src/Cosmos.Gremlin/AssemblyInfo.fs |
Supplies provider assembly metadata. |
FSharp.Azure.Cosmos.slnx |
Registers the four new projects. |
FSharp.Azure.Cosmos.slnf |
Includes the new projects in the solution filter. |
.github/copilot-instructions.md |
Documents the new library and test directories. |
Review effort: Balanced
774d3e3 to
4e88454
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The two GraphModel test files are placed at the project root, contrary to the required topic-folder layout, and need updated compile paths and layout documentation.
1 open issue
2 resolved since last review
Review effort: Balanced
| <Compile Include="AttributeTests.fs" /> | ||
| <Compile Include="VertexPropertyTests.fs" /> |
The Gremlin libraries are two packages from the start. `FSharp.Gremlin` is the core and does not depend on a provider. `FSharp.Azure.Cosmos.Gremlin` adds Azure Cosmos DB for Apache Gremlin. A client of a TinkerPop Gremlin Server references the core alone. `src/Gremlin` contains the types that a graph model declares: `LabelAttribute`, which sets the label of a record type, `PartitionKeyAttribute`, which marks the field that holds the partition key, and the struct record `VertexProperty<'Value, 'Meta>`, a vertex property with its meta-properties. `src/Cosmos.Gremlin` contains `CosmosGremlinConnection`, the settings of a graph: `azure` for an account in Azure (port 443 with TLS) and `emulator` for the local emulator (port 8901 without TLS, the well-known key). On 2026-11-08 the emulator accepted only `ws` on port 8901, and the TLS handshake of `wss` failed. `ToString`, `%A` and an interpolated string of the settings show `Description`, which does not contain the key. `azure` refuses an account name that does not obey the rule of Azure. The two functions refuse an id that Cosmos DB does not allow, and an id that ends in a space, which Data Explorer refuses. No package is made of the two projects until a query runs end to end. Each project has a test project: `tests/Gremlin.Tests` and `tests/Cosmos.Gremlin.Tests`. The test layout instruction lists their groups of test categories, so the two test files of the graph model are in `tests/Gremlin.Tests/GraphModel/`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4e88454 to
757ac46
Compare


Summary
This change adds the two projects of the Gremlin libraries, with the split into a core and a provider from the start:
src/Gremlin(FSharp.Gremlin): the core. It does not depend on a provider. A client of a TinkerPop Gremlin Server references it alone.src/Cosmos.Gremlin(FSharp.Azure.Cosmos.Gremlin): Azure Cosmos DB for Apache Gremlin on top of the core.No package is made of the two projects (
IsPackable=false) until a query runs end to end. This change is independent of the first two steps (branchesfeat/cosmos-json-packageandtest/baseline-extension).Content
LabelAttributesets the label of the vertices or the edges of a record type. Without it, the label is the name of the type, as ExRam.Gremlinq writes it. Thus a graph that ExRam.Gremlinq wrote keeps its labels.PartitionKeyAttributemarks the field of a vertex record that holds the partition key.VertexProperty<'Value, 'Meta>is a struct record: the value of a vertex property and a record of its meta-properties.VertexProperty.createandVertexProperty.somecreate it.CosmosGremlinConnectionholds the settings of a graph.CosmosGremlinConnection.azuregives<account>.gremlin.cosmos.azure.com, port 443 and TLS.CosmosGremlinConnection.emulatorgiveslocalhost, port 8901 without TLS, and the well-known key.UserNameis/dbs/<database>/colls/<graph>.Facts from the emulator
On 2026-11-08 I connected Gremlin.Net 3.8.2 to the Windows emulator that runs with
/EnableGremlinEndpoint:ws. Withwss, the TLS handshake fails. ThusemulatorsetsUseSsl = false./dbs/<database>/colls/<graph>and the key authenticate through the SASL challenge of the server.The key and the logs
StructuredFormatDisplaymakesToString,%Aand an interpolated string of the record giveDescription: the endpoint and the user name, without the key. A structured logger that reads the public properties of the record writes the key. Thus the documentation tells a caller to writeDescriptionto a log, not the record.Checks of the input
azurerefuses an account name that does not obey the rule of Azure: 3 to 44 lowercase letters, numbers and hyphens, with a letter or a number first. Thus a host that a caller gives as an account name (myaccount.gremlin.cosmos.azure.com) fails at once. A null account name, which a caller in C# can give, fails with anArgumentExceptiontoo.azureandemulatorrefuse an empty id, an id with/,\,?or#, an id with more than 255 characters, and an id that ends in a space. Data Explorer refuses such an id (ValidCosmosDbIdDescriptioninsrc/Utils/ValidationUtils.tsof Azure/cosmos-explorer). I could not ask the emulator itself, because it did not run at the time.azurerefuses an empty key.Tests
tests/Gremlin.Tests: 6 unit tests. They check thatLabelAttributeis on the record type, and that F# puts thePartitionKeyAttributeof a record field on the property that it generates. The graph model of the next step reads the attribute there.tests/Cosmos.Gremlin.Tests: 27 unit tests of the settings.ToString. No test failed, because the record already formats itself throughStructuredFormatDisplay. Thus I removed that override.Review
Round 1 (Copilot): an id that ends in a space, and a documentation text that promised too much about logs. The commit has the fixes for both. I also replaced an
isNullcheck of astringparameter, which gave a nullness warning, withString.IsNullOrEmpty.Not in this change
The plan also lists the attributes for the id, the out-vertex and the in-vertex of an edge, and the cardinality of a property. The next step (the graph model) does without them: the id is the field named
Id, and the type of a field gives its cardinality.🤖 Generated with Claude Code