Ninlil connects to an optional ValKey server and reports its state on /status #70

Open
opened 2026-10-31 12:42:00 -04:00 by claude · 0 comments
Owner
  • Draft: INT-2
  • Priority: high (every other ValKey issue builds on it)
  • Agent: coder
  • Depends on: none
  • Decisions: none

Why

The connection, options and test container are shared ground for #71 to #75 and #74, and for the benchmark harness (#95).

What changes

  • New project src/dotnet/src/Ninlil.Common.Valkey (NuGet-packable like its siblings):
    • Wraps StackExchange.Redis, which speaks the Redis protocol that ValKey implements. It is the client Microsoft.AspNetCore.SignalR.StackExchangeRedis already depends on, so the solution carries one client library.
    • Exposes IValkeyConnection with bool IsConnected, ISubscriber Subscriber, IDatabase Database, string Key(string suffix) (adds the key prefix) and an event that fires on reconnect.
    • Has a ServiceCollectionValkeyExtension.
    • AbortOnConnectFail = false: a missing server never blocks startup.
  • ValkeyOptions, SectionName = "Valkey". Properties:
    • ConnectionString: empty means off.
    • KeyPrefix: default ninlil.
    • EnableCacheInvalidation: default true.
    • EnableSignalRBackplane, EnableSharedRateLimit, EnableSharedForwardedCache: default false. Each adds a network round trip or changes behaviour, so each is opt-in. EnableSharedRateLimit covers both the DNS query limiter (#73) and the admin sign-in limiter (#74).
  • Add the class to src/dotnet/src/Ninlil.Web/EnvironmentVariables/OptionsEnvironmentVariableRegistry.cs. Add the rows to ENVIRONMENT.md and recount the totals.
  • A valkey health check in Program.cs next to eventBroker (src/dotnet/src/Ninlil.Web/Program.cs:702-713): Healthy when not configured or connected, Degraded when configured and disconnected.
  • Test host: ValkeyHost in src/dotnet/tests/Ninlil.Dns.Data.EngineHosts/, a Testcontainers generic container from a digest-pinned valkey/valkey image. The digest lives only there: the benchmarks and the benchmark compose file (#95) reuse it, so .forgejo/scripts/bump-pins.sh updates one place. Check that bump-pins.sh finds the new pin and extend it if not.
  • New test project src/dotnet/tests/Ninlil.Common.Valkey.Tests. Its container tests carry [Trait("Category", "RequiresDocker")].

Acceptance

  • Test Connect_WithNoConnectionString_RegistersNothingAndStatusIsHealthy passes.
  • Test Connect_ToStoppedContainer_StatusIsDegradedAndHostStillStarts passes (RequiresDocker).
  • Test Reconnect_AfterContainerRestart_RaisesReconnectedEvent passes (RequiresDocker).
  • The env-var registry test passes. ENVIRONMENT.md is updated with recounted totals.
  • bump-pins.sh reports the ValkeyHost pin (dry run output in the PR).
  • dotnet build Ninlil.slnx -p:NinlilSkipAngularBuild=true reports 0 warnings.
  • dotnet test src/dotnet/tests/Ninlil.Common.Valkey.Tests and src/dotnet/tests/Ninlil.Web.Tests pass.
  • No REST change, no schema change.

Source

  • Owner scope in the INT area brief (2026-10-09).
  • Owner decision 2026-10-31 (Q-INT-3): the shared rate-limit switch also covers the admin sign-in limiter.
  • DEDUPE.md I3 (one pinned digest, shared with #95).
- **Draft:** INT-2 - **Priority:** high (every other ValKey issue builds on it) - **Agent:** coder - **Depends on:** none - **Decisions:** none ### Why The connection, options and test container are shared ground for #71 to #75 and #74, and for the benchmark harness (#95). ### What changes - New project `src/dotnet/src/Ninlil.Common.Valkey` (NuGet-packable like its siblings): - Wraps `StackExchange.Redis`, which speaks the Redis protocol that ValKey implements. It is the client `Microsoft.AspNetCore.SignalR.StackExchangeRedis` already depends on, so the solution carries one client library. - Exposes `IValkeyConnection` with `bool IsConnected`, `ISubscriber Subscriber`, `IDatabase Database`, `string Key(string suffix)` (adds the key prefix) and an event that fires on reconnect. - Has a `ServiceCollectionValkeyExtension`. - `AbortOnConnectFail = false`: a missing server never blocks startup. - `ValkeyOptions`, `SectionName = "Valkey"`. Properties: - `ConnectionString`: empty means off. - `KeyPrefix`: default `ninlil`. - `EnableCacheInvalidation`: default true. - `EnableSignalRBackplane`, `EnableSharedRateLimit`, `EnableSharedForwardedCache`: default false. Each adds a network round trip or changes behaviour, so each is opt-in. `EnableSharedRateLimit` covers both the DNS query limiter (#73) and the admin sign-in limiter (#74). - Add the class to `src/dotnet/src/Ninlil.Web/EnvironmentVariables/OptionsEnvironmentVariableRegistry.cs`. Add the rows to `ENVIRONMENT.md` and recount the totals. - A `valkey` health check in `Program.cs` next to `eventBroker` (`src/dotnet/src/Ninlil.Web/Program.cs:702-713`): Healthy when not configured or connected, Degraded when configured and disconnected. - Test host: `ValkeyHost` in `src/dotnet/tests/Ninlil.Dns.Data.EngineHosts/`, a Testcontainers generic container from a digest-pinned `valkey/valkey` image. The digest lives only there: the benchmarks and the benchmark compose file (#95) reuse it, so `.forgejo/scripts/bump-pins.sh` updates one place. Check that `bump-pins.sh` finds the new pin and extend it if not. - New test project `src/dotnet/tests/Ninlil.Common.Valkey.Tests`. Its container tests carry `[Trait("Category", "RequiresDocker")]`. ### Acceptance - [ ] Test `Connect_WithNoConnectionString_RegistersNothingAndStatusIsHealthy` passes. - [ ] Test `Connect_ToStoppedContainer_StatusIsDegradedAndHostStillStarts` passes (RequiresDocker). - [ ] Test `Reconnect_AfterContainerRestart_RaisesReconnectedEvent` passes (RequiresDocker). - [ ] The env-var registry test passes. `ENVIRONMENT.md` is updated with recounted totals. - [ ] `bump-pins.sh` reports the `ValkeyHost` pin (dry run output in the PR). - [ ] `dotnet build Ninlil.slnx -p:NinlilSkipAngularBuild=true` reports 0 warnings. - [ ] `dotnet test src/dotnet/tests/Ninlil.Common.Valkey.Tests` and `src/dotnet/tests/Ninlil.Web.Tests` pass. - [ ] No REST change, no schema change. ### Source - Owner scope in the INT area brief (2026-10-09). - Owner decision 2026-10-31 (Q-INT-3): the shared rate-limit switch also covers the admin sign-in limiter. - DEDUPE.md I3 (one pinned digest, shared with #95).
claude added this to the Release: ValKey milestone 2026-10-31 12:42:00 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#70
No description provided.