[UI-1491] Expose cluster identity on /info endpoint#5569
[UI-1491] Expose cluster identity on /info endpoint#5569George-Payne wants to merge 1 commit intomasterfrom
/info endpoint#5569Conversation
Review Summary by QodoExpose cluster identity on /info endpoint via epoch 0
WalkthroughsDescription• Expose cluster identity via clusterId field on /info endpoint • Add GetFirstEpoch() method to EpochManager for stable cluster identification • Capture epoch 0 during initialization, writes, and replication caching • Add comprehensive tests for first epoch retrieval across scenarios Diagramflowchart LR
A["EpochManager"] -- "GetFirstEpoch()" --> B["First Epoch Record"]
B -- "EpochId as ClusterId" --> C["InfoController"]
C -- "JSON Response" --> D["/info Endpoint"]
E["Init/WriteNewEpoch/CacheEpoch"] -- "Capture epoch 0" --> A
File Changes1. src/KurrentDB.Core.Tests/Http/Info/when_getting_info.cs
|
Code Review by Qodo
1. KurrentDB.Core.Tests missing TestEnvironmentWireUp.cs
|
| [TestFixture(typeof(LogFormat.V2), typeof(string))] | ||
| public class when_getting_info<TLogFormat, TStreamId> : HttpBehaviorSpecification<TLogFormat, TStreamId> { | ||
| private JObject _response; | ||
|
|
||
| protected override Task Given() => Task.CompletedTask; | ||
|
|
||
| protected override async Task When() { | ||
| await Get("/info", ""); | ||
| _response = _lastResponseBody.ParseJson<JObject>(); | ||
| } |
There was a problem hiding this comment.
1. kurrentdb.core.tests missing testenvironmentwireup.cs 📘 Rule violation ⛯ Reliability
This PR adds new tests to the KurrentDB.Core.Tests project but the project does not include the required TestEnvironmentWireUp.cs using ToolkitTestEnvironment.Initialize/Reset. This can lead to inconsistent test initialization/teardown and shared infrastructure leakage across test runs.
Agent Prompt
## Issue description
`src/KurrentDB.Core.Tests` is being extended with new tests, but it lacks the required `TestEnvironmentWireUp.cs` that configures standard test initialization/teardown via `ToolkitTestEnvironment.Initialize` and `ToolkitTestEnvironment.Reset`.
## Issue Context
Compliance requires consistent assembly-level hooks for test infrastructure in every test project.
## Fix Focus Areas
- src/KurrentDB.Core.Tests/TestEnvironmentWireUp.cs[1-120]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Currently, Navigator uses the server address as database identity, but this isn't ideal as when a different database starts on the same address (e.g. dev environments, reprovisioning), Navigator reuses stale credentials and cached state for what is actually a different database.
Without admin credentials, there is currently no way of knowing if a cluster you are speaking to is the same one you were speaking to previously, as
instanceIdis only for the uptime of the individual nodes, and any attempt at fingerprinting is slow and fragile.This PR adds
clusterIdto/infoendpoint response, which acts as a stable identifier for the database, persists across restarts, and is consistent across all nodes in a cluster.The
clusterIdis epoch 0'sEpochId, as it already does everything we need:The main addition, other than wiring up epoch manager to the info endpoint, is adding a simple way to read epoch 0 from
EpochManager:EpochManagerstores epoch 0 separately from the rolling epoch cache (which only holds the 10 most recent epochs). It's populated in three places:InfoControllerreads it viaGetFirstEpoch()on each request.Example response
{ "dbVersion": "26.1.0-prerelease", "state": "leader", "clusterId": "8e739e5f-3f1e-412b-b42c-e032afc4b4ae", "features": { ... } }