DHCP leases refer to their scope by id, so renaming a scope keeps its leases #279

Merged
claude merged 6 commits from feature/58-lease-scope-id into develop 2026-11-05 03:50:37 -05:00
Owner

A DHCP lease now refers to its scope by id (LeaseEntity.ScopeId), not by name. Renaming a scope therefore keeps its leases: the engine renews them and their DNS records stay registered.

  • Schema:
    • Each relational provider gets an AddDhcpLeaseScopeId migration that backfills ScopeId from ScopeName.
    • The new unique indexes are (ScopeId, ClientIdentifier) and (ScopeId, IpAddress).
    • MongoDB gets a DhcpLeaseScopeIdBackfill step in MongoSchemaSteps.Known.
  • Orphans: a lease whose scope name matches no scope belongs to a deleted scope. The upgrade deletes it, in both the relational and the MongoDB backfill.
  • ScopeName stays, as a display copy only. The REST lease model, the lease list ordering and the name of a deleted scope still read it. Nothing looks up a lease or scope by it any more.
  • Backups: a backup taken before this change relinks its leases by scope name on restore and drops the leases of deleted scopes (BackupLegacyFixups.LinkLeasesToScopes). This runs before anything is wiped.
  • REST: the shape is unchanged. One description line changed, so the snapshot and client are regenerated in their own commit.
  • README and CHANGELOG: both are updated.

Tests:

  • Red tests for a renewal after a rename and for DNS registration after a rename.
  • Migration tests on SQLite, PostgreSQL, MySQL and SQL Server, plus a MongoDB backfill test.
  • Unit tests for the backup fixup.
  • Ninlil.Dns.Data.Integration.Tests (Docker, all engines) passes 499 tests. The whole Ninlil.Web.Tests project passes 2038.
  • The verifier passed the branch after one round of fixes.

Closes #58

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

A DHCP lease now refers to its scope by id (`LeaseEntity.ScopeId`), not by name. Renaming a scope therefore keeps its leases: the engine renews them and their DNS records stay registered. - **Schema:** - Each relational provider gets an `AddDhcpLeaseScopeId` migration that backfills `ScopeId` from `ScopeName`. - The new unique indexes are `(ScopeId, ClientIdentifier)` and `(ScopeId, IpAddress)`. - MongoDB gets a `DhcpLeaseScopeIdBackfill` step in `MongoSchemaSteps.Known`. - **Orphans:** a lease whose scope name matches no scope belongs to a deleted scope. The upgrade deletes it, in both the relational and the MongoDB backfill. - **`ScopeName` stays, as a display copy only.** The REST lease model, the lease list ordering and the name of a deleted scope still read it. Nothing looks up a lease or scope by it any more. - **Backups:** a backup taken before this change relinks its leases by scope name on restore and drops the leases of deleted scopes (`BackupLegacyFixups.LinkLeasesToScopes`). This runs before anything is wiped. - **REST:** the shape is unchanged. One description line changed, so the snapshot and client are regenerated in their own commit. - **README and CHANGELOG:** both are updated. Tests: - Red tests for a renewal after a rename and for DNS registration after a rename. - Migration tests on SQLite, PostgreSQL, MySQL and SQL Server, plus a MongoDB backfill test. - Unit tests for the backup fixup. - `Ninlil.Dns.Data.Integration.Tests` (Docker, all engines) passes 499 tests. The whole `Ninlil.Web.Tests` project passes 2038. - The verifier passed the branch after one round of fixes. Closes #58 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #58

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The OpenAPI snapshot and Angular API client carry the DHCP scope and lease descriptions that name the scope id
All checks were successful
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Successful in -1m29s
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Successful in -1m24s
Build / Build Binary (macos-arm64) (pull_request) Successful in 6m29s
Build / Build Binary (linux-arm64) (pull_request) Successful in 6m36s
Build / Build Binary (linux-amd64) (pull_request) Successful in 6m39s
Build / Build Binary (macos-amd64) (pull_request) Successful in 6m38s
Build / Build Binary (windows-amd64) (pull_request) Successful in 16m48s
Build / Smoke Test the Windows Binary (pull_request) Successful in 37s
Build / Build and Push Image (pull_request) Successful in -1m35s
Build / Build Arch Linux Packages (pull_request) Successful in -1m25s
Build / Build and Test Deb and RPM Packages (pull_request) Successful in 1s
Build / Publish Release (pull_request) Successful in 5s
Build / Pipeline (pull_request) Successful in 0s
Build / Test .NET (push) Successful in 32m21s
Build / Stage Draft Release (push) Successful in 1s
Build / Pack and Push NuGet Packages (common) (push) Successful in 35s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -1m2s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in 1m52s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -56s
Build / Build Binary (macos-amd64) (push) Successful in 1m10s
Build / Build Binary (linux-amd64) (push) Successful in 1m10s
Build / Build Binary (linux-arm64) (push) Successful in 8m6s
Build / Build Binary (macos-arm64) (push) Successful in 6m49s
Build / Build Binary (windows-amd64) (push) Successful in 8m4s
Build / Smoke Test the Windows Binary (push) Successful in 19s
Build / Build Arch Linux Packages (push) Successful in -2m24s
Build / Build and Push Image (push) Successful in 21s
Build / Build and Test Deb and RPM Packages (push) Successful in -37s
Build / Pipeline (push) Successful in 0s
Build / Publish Release (push) Successful in 4s
14cd115b63
Refs #58

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 5b1cd53858 into develop 2026-11-05 03:50:37 -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!279
No description provided.