A node that joins a cluster receives every synced setting and entity at once, and a peer that missed a change catches up #337

Merged
claude merged 18 commits from feature/59-cluster-join-backfill into develop 2026-11-06 01:41:38 -05:00
Owner

Epic #59: a node that joins a cluster receives every synced setting and entity at once, and a peer that missed a change catches up at its next successful heartbeat. Owner decisions Q-CL-1..5 on #260: inviter → joiner push; data the joiner holds merges by newest-write-wins and the rename rule; any missed delivery heals; secrets travel only inside the pinned-TLS signed channel; log lines only.

  • #330 Storage. A ClusterPeerConfigBackfill table (migrations for SQLite, PostgreSQL, MySQL and SQL Server, plus a MongoDB repository and unique index) records which peer is owed a backfill. It is separate from the peer row, because the heartbeat rewrites that row every round. IRepository.ListIdsAsync gives id snapshots. Removing a peer removes its request, and the table is excluded from backups.
  • #331 Entity sources. Every synced entity type builds its envelopes in one source that live sync and the backfill share. Live sync's wire output is pinned by golden tests and unchanged.
  • #332 Settings. A catalogue of every cluster-synced settings key. The backfill reads settings from the runtime file, so a value an environment variable pins stays on its node. Secrets go as plaintext only inside the channel, never as ciphertext. An uncatalogued key is refused before the file is written.
  • #333 Runner. When a join completes, the inviter records the request in the same save as the peer. After the next heartbeat that reaches the joiner, it sends every item in stage order, at most 4 in flight. A failed or interrupted pass runs again; removing and updating the request are atomic on every engine. A request whose peer row is gone (a MongoDB restore) is dropped. The runner stops and awaits its passes at shutdown. A hostless two-node test shows B ends up with A's settings, entities, a secret B can open, and A's tombstones; it fails with the send stubbed out.
  • #334 Catch-up. A failed live delivery, or a change made while a peer is Unreachable, marks the peer owed. Misses coalesce in memory, and the mark can never outlive its row. Passes that keep failing back off: heartbeat × 2^(n-1), capped at 1 hour.
  • #335 Docs. README cluster section (copy table, join and cleanup steps, log lines, limits, security) and a CHANGELOG entry.
  • Also merges develop (#42 key ring) and moves the MVC JSON setup into MvcJsonSerialization so tests can use it.

No REST API change.

Verified: a verifier pass per package with fix rounds, and a final whole-epic verifier. Its findings are fixed in d187867d and f4c795bf. Build has 0 warnings and csharpier is clean. The whole solution was run with Docker; the only failure was the known #314 timing flake, which passes alone. After the last fixes: Cluster 74, ClusterSync 65, Backup 65, Identity 77, Web 2347 (without the Docker-only tests), backfill integration tests on every engine 54, and the markdown link check is clean.

Closes #330
Closes #331
Closes #332
Closes #333
Closes #334
Closes #335
Refs #59

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Epic #59: a node that joins a cluster receives every synced setting and entity at once, and a peer that missed a change catches up at its next successful heartbeat. Owner decisions Q-CL-1..5 on #260: inviter → joiner push; data the joiner holds merges by newest-write-wins and the rename rule; any missed delivery heals; secrets travel only inside the pinned-TLS signed channel; log lines only. - **#330 Storage.** A `ClusterPeerConfigBackfill` table (migrations for SQLite, PostgreSQL, MySQL and SQL Server, plus a MongoDB repository and unique index) records which peer is owed a backfill. It is separate from the peer row, because the heartbeat rewrites that row every round. `IRepository.ListIdsAsync` gives id snapshots. Removing a peer removes its request, and the table is excluded from backups. - **#331 Entity sources.** Every synced entity type builds its envelopes in one source that live sync and the backfill share. Live sync's wire output is pinned by golden tests and unchanged. - **#332 Settings.** A catalogue of every cluster-synced settings key. The backfill reads settings from the runtime file, so a value an environment variable pins stays on its node. Secrets go as plaintext only inside the channel, never as ciphertext. An uncatalogued key is refused before the file is written. - **#333 Runner.** When a join completes, the inviter records the request in the same save as the peer. After the next heartbeat that reaches the joiner, it sends every item in stage order, at most 4 in flight. A failed or interrupted pass runs again; removing and updating the request are atomic on every engine. A request whose peer row is gone (a MongoDB restore) is dropped. The runner stops and awaits its passes at shutdown. A hostless two-node test shows B ends up with A's settings, entities, a secret B can open, and A's tombstones; it fails with the send stubbed out. - **#334 Catch-up.** A failed live delivery, or a change made while a peer is Unreachable, marks the peer owed. Misses coalesce in memory, and the mark can never outlive its row. Passes that keep failing back off: heartbeat × 2^(n-1), capped at 1 hour. - **#335 Docs.** README cluster section (copy table, join and cleanup steps, log lines, limits, security) and a CHANGELOG entry. - Also merges develop (#42 key ring) and moves the MVC JSON setup into `MvcJsonSerialization` so tests can use it. No REST API change. Verified: a verifier pass per package with fix rounds, and a final whole-epic verifier. Its findings are fixed in d187867d and f4c795bf. Build has 0 warnings and csharpier is clean. The whole solution was run with Docker; the only failure was the known #314 timing flake, which passes alone. After the last fixes: Cluster 74, ClusterSync 65, Backup 65, Identity 77, Web 2347 (without the Docker-only tests), backfill integration tests on every engine 54, and the markdown link check is clean. Closes #330 Closes #331 Closes #332 Closes #333 Closes #334 Closes #335 Refs #59 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #330

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #330

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #330

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #330

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #331

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #331

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #332

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #332

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #332

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #333

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #333

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #333

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #333

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #334

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #335
Refs #59

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #59

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #334

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The README describes the backfill's retry wait and the conflict names a join leaves, and no longer tells operators to rename them
Some checks failed
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in 1m56s
Build / Build Binary (linux-arm64) (push) Successful in 34s
Build / Build Binary (linux-amd64) (push) Successful in 40s
Build / Build Binary (macos-arm64) (push) Successful in 40s
Build / Build Binary (macos-amd64) (push) Successful in 40s
Build / Build Binary (windows-amd64) (push) Successful in 3m32s
Build / Build and Push Image (push) Successful in 11s
Build / Smoke Test the Windows Binary (push) Successful in 18s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in 4m26s
Build / Test .NET (pull_request) Successful in 12m19s
Build / Build Arch Linux Packages (push) Successful in 27s
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Stage Draft Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Successful in 2m35s
Build / Publish Release (push) Successful in 4s
Build / Pipeline (push) Successful in 0s
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
f4c795bf35
Refs #335

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 903d681386 into develop 2026-11-06 01:41:38 -05:00
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!337
No description provided.