Every cluster-synced settings key is catalogued and can be backfilled, secrets included #332

Closed
opened 2026-11-05 20:48:50 -05:00 by claude · 1 comment
Owner

Part of epic #59.

  • Kind: feature
  • Area: dns
  • Priority: medium
  • Milestone: Post-release fixes
  • Agent: coder
  • Depends on: #331
  • Decisions: Q-CL-4 (#260)

Why

A settings envelope carries only the keys a write patched, and nothing lists a section's synced keys. A backfill must send every key, and #192's RA prefixes must not be forgotten.

What changes

ClusterSyncedSettingsCatalog, SettingsClusterConfigSyncSource (reads the runtime file and decrypts with this node's key ring), and RuntimeConfigurationFileReader. The recorder refuses a section or key that is not in the catalogue. See the work package detail below (59-3.

Acceptance

  • The ten tests listed in design 59-3 pass in src/dotnet/tests/Ninlil.Web.Tests.
  • Every item in Before you finish that applies is done.

Source

ClusterConfigSyncSettingsRecorder.cs:61-108, SettingsClusterConfigSyncApplier.cs:46-152, ConfigurationSecretSettings.cs:66-179, ConfigurationSecretMigrationService.cs:146, README :4200-4202, #192.

Work package detail

  • Goal: the five settings sections (and any later one, such as the RA prefixes from #192) can be backfilled with every key.
  • Files (Ninlil.Web/ClusterSync/):
    • ClusterSyncedSettingsCatalog.cs (new, static): IReadOnlyList<ClusterSyncedSettingsSection> Sections, each with SectionName and IReadOnlyList<(string SectionPath, string Key)> Keys, filled from the keys the six callers write:
      • Event broker: Transport, plus every RabbitMq and ActiveMq field AddBrokerFields writes.
      • Rate limiting: the 14 fields at RateLimitingSettingsController.cs:105-306.
      • DNS Cookies: Enable, Require, SecretRotationInterval.
      • Reverse proxy: Enable, KnownProxies, KnownNetworks, SharedSecretHeaderName, SharedSecret, plus ProxyProtocol Enable, KnownProxies, KnownNetworks.
      • Rewrites: Enable, TimeToLiveSeconds.
    • SettingsClusterConfigSyncSource.cs (new, IClusterConfigSyncSource, stage 2): for each catalogue section that has a state row, read the runtime file (RuntimeConfigurationOptions.ConfigurationFilePath) and add each catalogued key present as a SettingsSyncEntry. For a ConfigurationSecretSettings plain key, use a non-empty plain value from the file, or else Unprotect the encrypted sibling. On a CryptographicException, leave the key out and log a Warning. Stamp the envelope with the state row's time and origin.
    • Extract the section walk at Startup/ConfigurationSecretMigrationService.cs:146 into a shared Configuration/RuntimeConfigurationFileReader.cs.
    • ClusterConfigSyncSettingsRecorder.RecordAndPublishAsync throws InvalidOperationException for a section or key that is not in the catalogue.
    • Register the source in Program.cs next to the settings applier (:542-548).
  • Constraints: never read IConfiguration for values (an environment variable pins a value only on its own node). Update the summaries: recorder :13-35, settings applier.
  • Acceptance (fail first, src/dotnet/tests/Ninlil.Web.Tests, hostless like SettingsClusterSyncRoundTripTests):
    • ReadBackfillAsync_ForASectionWithAStateRow_SendsEveryCataloguedKeyTheFileHolds
    • ReadBackfillAsync_ForASectionWithoutAStateRow_SendsNothing
    • ReadBackfillAsync_ForAnEncryptedSecret_SendsThePlaintextUnderThePlainKey
    • ReadBackfillAsync_ForASecretThisKeyRingCannotOpen_LeavesTheKeyOut
    • ReadBackfillAsync_ForAValuePinnedByAnEnvironmentVariable_SendsTheFileValue
    • ReadBackfillAsync_ForReverseProxy_IncludesTheProxyProtocolKeys
    • RecordAndPublishAsync_ForASectionMissingFromTheCatalog_Throws
    • RecordAndPublishAsync_ForAKeyMissingFromTheCatalog_Throws
    • Patch_OfEveryField_OnEachSyncedSettingsController_RecordsOnlyCataloguedKeys (Theory over the five controllers)
    • Backfill_OfASection_ProducesThePeerFileLiveSyncProduces
  • Non-goals: sending, triggering, and #192 itself. #192 adds its own catalogue entry; its recorder call fails until it does.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Web.Tests.
Part of epic #59. - **Kind:** feature - **Area:** dns - **Priority:** medium - **Milestone:** Post-release fixes - **Agent:** coder - **Depends on:** #331 - **Decisions:** Q-CL-4 (#260) ### Why A settings envelope carries only the keys a write patched, and nothing lists a section's synced keys. A backfill must send every key, and #192's RA prefixes must not be forgotten. ### What changes `ClusterSyncedSettingsCatalog`, `SettingsClusterConfigSyncSource` (reads the runtime file and decrypts with this node's key ring), and `RuntimeConfigurationFileReader`. The recorder refuses a section or key that is not in the catalogue. See the work package detail below (59-3. ### Acceptance - [ ] The ten tests listed in design 59-3 pass in `src/dotnet/tests/Ninlil.Web.Tests`. - [ ] Every item in [Before you finish](https://git.lantea.one/lantea-one/ninlil/src/branch/main/AGENTS.md#before-you-finish) that applies is done. ### Source `ClusterConfigSyncSettingsRecorder.cs:61-108`, `SettingsClusterConfigSyncApplier.cs:46-152`, `ConfigurationSecretSettings.cs:66-179`, `ConfigurationSecretMigrationService.cs:146`, README `:4200-4202`, #192. ### Work package detail - **Goal:** the five settings sections (and any later one, such as the RA prefixes from #192) can be backfilled with every key. - **Files** (`Ninlil.Web/ClusterSync/`): - `ClusterSyncedSettingsCatalog.cs` (new, static): `IReadOnlyList<ClusterSyncedSettingsSection> Sections`, each with `SectionName` and `IReadOnlyList<(string SectionPath, string Key)> Keys`, filled from the keys the six callers write: - Event broker: `Transport`, plus every `RabbitMq` and `ActiveMq` field `AddBrokerFields` writes. - Rate limiting: the 14 fields at `RateLimitingSettingsController.cs:105-306`. - DNS Cookies: `Enable`, `Require`, `SecretRotationInterval`. - Reverse proxy: `Enable`, `KnownProxies`, `KnownNetworks`, `SharedSecretHeaderName`, `SharedSecret`, plus `ProxyProtocol` `Enable`, `KnownProxies`, `KnownNetworks`. - Rewrites: `Enable`, `TimeToLiveSeconds`. - `SettingsClusterConfigSyncSource.cs` (new, `IClusterConfigSyncSource`, stage 2): for each catalogue section that has a state row, read the runtime file (`RuntimeConfigurationOptions.ConfigurationFilePath`) and add each catalogued key present as a `SettingsSyncEntry`. For a `ConfigurationSecretSettings` plain key, use a non-empty plain value from the file, or else `Unprotect` the encrypted sibling. On a `CryptographicException`, leave the key out and log a Warning. Stamp the envelope with the state row's time and origin. - Extract the section walk at `Startup/ConfigurationSecretMigrationService.cs:146` into a shared `Configuration/RuntimeConfigurationFileReader.cs`. - `ClusterConfigSyncSettingsRecorder.RecordAndPublishAsync` throws `InvalidOperationException` for a section or key that is not in the catalogue. - Register the source in `Program.cs` next to the settings applier (`:542-548`). - **Constraints:** never read `IConfiguration` for values (an environment variable pins a value only on its own node). Update the summaries: recorder `:13-35`, settings applier. - **Acceptance (fail first, `src/dotnet/tests/Ninlil.Web.Tests`, hostless like `SettingsClusterSyncRoundTripTests`):** - `ReadBackfillAsync_ForASectionWithAStateRow_SendsEveryCataloguedKeyTheFileHolds` - `ReadBackfillAsync_ForASectionWithoutAStateRow_SendsNothing` - `ReadBackfillAsync_ForAnEncryptedSecret_SendsThePlaintextUnderThePlainKey` - `ReadBackfillAsync_ForASecretThisKeyRingCannotOpen_LeavesTheKeyOut` - `ReadBackfillAsync_ForAValuePinnedByAnEnvironmentVariable_SendsTheFileValue` - `ReadBackfillAsync_ForReverseProxy_IncludesTheProxyProtocolKeys` - `RecordAndPublishAsync_ForASectionMissingFromTheCatalog_Throws` - `RecordAndPublishAsync_ForAKeyMissingFromTheCatalog_Throws` - `Patch_OfEveryField_OnEachSyncedSettingsController_RecordsOnlyCataloguedKeys` (Theory over the five controllers) - `Backfill_OfASection_ProducesThePeerFileLiveSyncProduces` - **Non-goals:** sending, triggering, and #192 itself. #192 adds its own catalogue entry; its recorder call fails until it does. - **Gate:** `dotnet test src/dotnet/tests/Ninlil.Web.Tests`.
Author
Owner

Done on feature/59-cluster-join-backfill (fa731b9d, a7901b17, 44789ae5); verified (Web.Tests 2313, ClusterSync 64, Cluster 40; live settings wire pinned and unchanged). Fix round: case-sensitive file reads restored, catalogue check before the file write, cleared secrets sent as null like live sync. Closes when the epic merges into develop.

Done on `feature/59-cluster-join-backfill` (fa731b9d, a7901b17, 44789ae5); verified (Web.Tests 2313, ClusterSync 64, Cluster 40; live settings wire pinned and unchanged). Fix round: case-sensitive file reads restored, catalogue check before the file write, cleared secrets sent as null like live sync. Closes when the epic merges into develop.
Sign in to join this conversation.
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#332
No description provided.