The client registry can store discovered devices and an acknowledged flag, and older builds refuse such a database #144

Open
opened 2026-10-31 12:42:14 -04:00 by claude · 0 comments
Owner
  • Draft: PN-2
  • Priority: high (first step of #143)
  • Agent: storage-coder
  • Depends on: none
  • Decisions: Q-PN-2, Q-PN-3

Why

A discovered device needs its own origin value. The operator also needs a way to say "I have seen this one" without rewriting how the row began. DnsClientOriginEnum says it records who created the row and is not an audit trail (DnsClientOriginEnum.cs:7-11).

What changes

  • src/dotnet/src/Ninlil.Dns.Common/Enum/DnsClientOriginEnum.cs: add Discovered = 2 with [EnumMember(Value = "Discovered")] and a summary that names ClientPresenceFlushService.
  • src/dotnet/src/Ninlil.Dns.Data.Abstractions/Entity/DnsClientEntity.cs: add bool IsAcknowledged (default false; the API sets true on rows it creates).
  • src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Configuration/DnsClientConfiguration.cs: map the column. The origin column is already a string of at most 16 characters (DnsClientConfiguration.cs:26), so Discovered fits.
  • One migration per relational provider, named AddDiscoveredClients, through the AGENTS.md loop plus file-scoped-namespaces.sh. The data conversion sets IsAcknowledged = true on existing rows. The migration also makes an older build refuse a database that may hold a Discovered value (RelationalStartupMigrator).
  • MongoDB: add a step to MongoSchemaSteps.Known (src/dotnet/src/Ninlil.Dns.Data.MongoDb/Maintenance/MongoSchemaSteps.cs:47-53) plus a backfill for IsAcknowledged. An older build would misread the new enum value.
  • DnsClientSearchCriteria (src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/DnsClientSearchCriteria.cs:37): add Origin and IsAcknowledged filters, implemented database-side in the EF and Mongo repositories.

Acceptance

  • This test fails first: a new multi-engine test in src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests saves a Discovered, unacknowledged client and finds it through SearchAsync/CountAsync with Origin = Discovered, on every engine.
  • One migration per provider; the generated files are untouched apart from the data-conversion SQL.
  • Mongo step added. dotnet build Ninlil.slnx -p:NinlilSkipAngularBuild=true reports 0 warnings.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests, dotnet test src/dotnet/tests/Ninlil.Web.Tests. Ninlil.Dns.Common is a shared library, so run the whole solution too.

Source

audit-feature-parity.md §2A #10; DnsClientOriginEnum.cs:7-31.
Owner decision 2026-10-31: "client registry, new origin" (Q-PN-2) and "acknowledged flag" (Q-PN-3).

- **Draft:** PN-2 - **Priority:** high (first step of #143) - **Agent:** storage-coder - **Depends on:** none - **Decisions:** Q-PN-2, Q-PN-3 ### Why A discovered device needs its own origin value. The operator also needs a way to say "I have seen this one" without rewriting how the row began. `DnsClientOriginEnum` says it records who created the row and is not an audit trail (`DnsClientOriginEnum.cs:7-11`). ### What changes - `src/dotnet/src/Ninlil.Dns.Common/Enum/DnsClientOriginEnum.cs`: add `Discovered = 2` with `[EnumMember(Value = "Discovered")]` and a summary that names `ClientPresenceFlushService`. - `src/dotnet/src/Ninlil.Dns.Data.Abstractions/Entity/DnsClientEntity.cs`: add `bool IsAcknowledged` (default `false`; the API sets `true` on rows it creates). - `src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Configuration/DnsClientConfiguration.cs`: map the column. The origin column is already a string of at most 16 characters (`DnsClientConfiguration.cs:26`), so `Discovered` fits. - One migration per relational provider, named `AddDiscoveredClients`, through the AGENTS.md loop plus `file-scoped-namespaces.sh`. The data conversion sets `IsAcknowledged = true` on existing rows. The migration also makes an older build refuse a database that may hold a `Discovered` value (`RelationalStartupMigrator`). - MongoDB: add a step to `MongoSchemaSteps.Known` (`src/dotnet/src/Ninlil.Dns.Data.MongoDb/Maintenance/MongoSchemaSteps.cs:47-53`) plus a backfill for `IsAcknowledged`. An older build would misread the new enum value. - `DnsClientSearchCriteria` (`src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/DnsClientSearchCriteria.cs:37`): add `Origin` and `IsAcknowledged` filters, implemented database-side in the EF and Mongo repositories. ### Acceptance - [ ] This test fails first: a new multi-engine test in `src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` saves a `Discovered`, unacknowledged client and finds it through `SearchAsync`/`CountAsync` with `Origin = Discovered`, on every engine. - [ ] One migration per provider; the generated files are untouched apart from the data-conversion SQL. - [ ] Mongo step added. `dotnet build Ninlil.slnx -p:NinlilSkipAngularBuild=true` reports 0 warnings. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests`, `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. `Ninlil.Dns.Common` is a shared library, so run the whole solution too. ### Source `audit-feature-parity.md` §2A #10; `DnsClientOriginEnum.cs:7-31`. Owner decision 2026-10-31: "client registry, new origin" (Q-PN-2) and "acknowledged flag" (Q-PN-3).
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#144
No description provided.