Remove obsolete automatic legacy DHCP/DNS database migration #25

Closed
opened 2026-10-21 13:53:37 +02:00 by Alex · 0 comments
Owner

Objective

Remove the obsolete automatic legacy DHCP/DNS database conversion. The user explicitly stated that this migration is unnecessary and requested its removal.

The scope is the legacy conversion introduced with the dnsmasq-to-Kea/Knot transition, including the automatic rewriting of existing desired and committed configuration during database opening. Current native Kea/Knot functionality and data structures must remain usable.

Observed problem

During #17 validation (PR #24), starting the current agent on RZ-VM automatically upgraded both existing databases from schema 13 to 15 before checking mandatory native DHCP/DNS binaries. Startup then failed because Kea was absent. Restoring the original executable restored API availability but did not undo the database changes. Automatic private schema-13 backups exist; no database rollback or native package upgrade has been authorized or performed.

A read-only comparison of 66 tables per database found only expected migration changes: additional migration/native bookkeeping, DHCP/DNS version metadata, an absent DNS configuration rewritten as explicitly disabled, and the corresponding committed-state rewrite. Authentication, credentials, sessions, keys, preferences and unrelated configuration matched their backups. There were no DHCP pools or static leases to convert on this device.

Relevant code

  • internal/storage/migrate.go: invokes the DHCP/DNS-specific preparation and conversion while opening the store.
  • internal/storage/dhcp_dns_migration.go: prepareDHCPDNSMigration and migrateDHCPDNS, migration backups, desired-state conversion, DNS default seeding and committed-state rewriting.
  • internal/storage/dhcp_dns_history.go: related legacy/history conversion paths.
  • internal/storage/schema/014_* and 015_*: native bookkeeping and legacy activation-state transformations.
  • pkg/models: MigrateDHCPDNSJSON and its startup/import/restore callers.
  • internal/api/server.go and internal/api/dhcp_dns_recovery.go: database construction currently precedes native runtime prerequisite checks.

Requested change

  • Remove the obsolete automatic legacy DHCP/DNS data conversion and its unnecessary call sites/helpers.
  • Separate current-schema initialization and native runtime requirements from legacy migration behavior. Preserve the tables and bookkeeping genuinely required by current Kea/Knot operations.
  • Define old-format database/import/restore handling explicitly. Unsupported legacy input must be rejected clearly before mutation instead of being silently rewritten.
  • Opening an already-current database must preserve desired configuration, committed rollback state, identities, credentials and historical data.
  • Missing runtime prerequisites must be detected before any destructive or configuration-changing startup operation.
  • Account explicitly for devices already touched by the old migration; a code removal must not be presented as an operational rollback of those devices.

Acceptance

  • Regression: a schema-13 fixture containing legacy/absent DHCP/DNS values is not automatically converted or partially mutated during startup; unsupported input fails without changing either database.
  • Current native databases and fresh installations still initialize and start correctly. Existing Kea/Knot IDs, service holds and current configuration remain valid.
  • Test desired and committed state, empty/disabled configurations, import/restore and missing-binary failures. Compare state before/after rather than checking source text alone.
  • Update affected tests and aligned EN/DE documentation within the agreed scope.
  • Use a dedicated branch/worktree, appropriate checks and independent static review. Merge requires separate user approval.

Relationship to current work

This is a separate task from external notifications (#17 / PR #24). RZ-VM notification runtime validation remains blocked by its older native runtime and the migration aftermath. No package installation, database-file replacement, factory reset or acceptance waiver is authorized merely by creating this issue.

## Objective Remove the obsolete automatic legacy DHCP/DNS database conversion. The user explicitly stated that this migration is unnecessary and requested its removal. The scope is the legacy conversion introduced with the dnsmasq-to-Kea/Knot transition, including the automatic rewriting of existing desired and committed configuration during database opening. Current native Kea/Knot functionality and data structures must remain usable. ## Observed problem During #17 validation (PR #24), starting the current agent on RZ-VM automatically upgraded both existing databases from schema 13 to 15 before checking mandatory native DHCP/DNS binaries. Startup then failed because Kea was absent. Restoring the original executable restored API availability but did not undo the database changes. Automatic private schema-13 backups exist; no database rollback or native package upgrade has been authorized or performed. A read-only comparison of 66 tables per database found only expected migration changes: additional migration/native bookkeeping, DHCP/DNS version metadata, an absent DNS configuration rewritten as explicitly disabled, and the corresponding committed-state rewrite. Authentication, credentials, sessions, keys, preferences and unrelated configuration matched their backups. There were no DHCP pools or static leases to convert on this device. ## Relevant code - `internal/storage/migrate.go`: invokes the DHCP/DNS-specific preparation and conversion while opening the store. - `internal/storage/dhcp_dns_migration.go`: `prepareDHCPDNSMigration` and `migrateDHCPDNS`, migration backups, desired-state conversion, DNS default seeding and committed-state rewriting. - `internal/storage/dhcp_dns_history.go`: related legacy/history conversion paths. - `internal/storage/schema/014_*` and `015_*`: native bookkeeping and legacy activation-state transformations. - `pkg/models`: `MigrateDHCPDNSJSON` and its startup/import/restore callers. - `internal/api/server.go` and `internal/api/dhcp_dns_recovery.go`: database construction currently precedes native runtime prerequisite checks. ## Requested change - Remove the obsolete automatic legacy DHCP/DNS data conversion and its unnecessary call sites/helpers. - Separate current-schema initialization and native runtime requirements from legacy migration behavior. Preserve the tables and bookkeeping genuinely required by current Kea/Knot operations. - Define old-format database/import/restore handling explicitly. Unsupported legacy input must be rejected clearly before mutation instead of being silently rewritten. - Opening an already-current database must preserve desired configuration, committed rollback state, identities, credentials and historical data. - Missing runtime prerequisites must be detected before any destructive or configuration-changing startup operation. - Account explicitly for devices already touched by the old migration; a code removal must not be presented as an operational rollback of those devices. ## Acceptance - Regression: a schema-13 fixture containing legacy/absent DHCP/DNS values is not automatically converted or partially mutated during startup; unsupported input fails without changing either database. - Current native databases and fresh installations still initialize and start correctly. Existing Kea/Knot IDs, service holds and current configuration remain valid. - Test desired and committed state, empty/disabled configurations, import/restore and missing-binary failures. Compare state before/after rather than checking source text alone. - Update affected tests and aligned EN/DE documentation within the agreed scope. - Use a dedicated branch/worktree, appropriate checks and independent static review. Merge requires separate user approval. ## Relationship to current work This is a separate task from external notifications (#17 / PR #24). RZ-VM notification runtime validation remains blocked by its older native runtime and the migration aftermath. No package installation, database-file replacement, factory reset or acceptance waiver is authorized merely by creating this issue.
Alex closed this issue 2026-10-21 19:15:04 +02:00
Sign in to join this conversation.
No labels
No milestone
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
Alex/kaido-core#25
No description provided.