Host release: accept only bookkeeping on import; stop declaring console #104

Merged
john merged 1 commit from fix/host-import-bookkeeping into main 2026-11-24 11:55:50 +00:00
Owner

The first live corn_host_release run (plan job jmwumksxrya6drge) refused its own plan with container identity would change. Nothing was applied, and CT 125 was untouched.

Cause:

  1. During an import the provider's before is its pre-read state, so vm_id is null. The identity guard compared that null to 125.
  2. The plan also carried a console update. CT 125's console already equals the provider default, but container.tf declared it explicitly. The import backfill therefore became a console change, and bpg/proxmox v0.122.0 reboots the container for any console change. Approving it would have restarted Corn.

Fix:

  • container.tf: drop the console block. The provider default (enabled, tty, 2) is what CT 125 has.
  • policy.py: on import, only provider bookkeeping may differ (vm_id, purge_on_destroy, delete_unreferenced_disks_on_destroy, migrate, timeouts). None of these reaches the Proxmox API. Anything else is refused as a real change. The approval text now says "no API change, no restart".
  • Tests cover the real import shape, and refuse console or memory changes on import.

Checked against a mock PVE API with the pinned provider: the import plan is approvable, the apply issues no write requests, and the re-plan is "no changes".

The first live `corn_host_release` run (plan job `jmwumksxrya6drge`) refused its own plan with **container identity would change**. Nothing was applied, and CT 125 was untouched. Cause: 1. During an import the provider's `before` is its pre-read state, so `vm_id` is null. The identity guard compared that null to 125. 2. The plan also carried a `console` update. CT 125's console already equals the provider default, but `container.tf` declared it explicitly. The import backfill therefore became a console change, and bpg/proxmox v0.122.0 **reboots the container** for any console change. Approving it would have restarted Corn. Fix: - `container.tf`: drop the `console` block. The provider default (enabled, tty, 2) is what CT 125 has. - `policy.py`: on import, only provider bookkeeping may differ (`vm_id`, `purge_on_destroy`, `delete_unreferenced_disks_on_destroy`, `migrate`, timeouts). None of these reaches the Proxmox API. Anything else is refused as a real change. The approval text now says "no API change, no restart". - Tests cover the real import shape, and refuse console or memory changes on import. Checked against a mock PVE API with the pinned provider: the import plan is approvable, the apply issues **no write requests**, and the re-plan is "no changes".
Host release: accept only bookkeeping on import, and stop declaring console
All checks were successful
Corn CI / release-check-1 (pull_request) Successful in 3s
Corn CI / release-check (pull_request) Successful in 0s
Corn CI / host (pull_request) Successful in 19s
Security / scan (pull_request) Successful in 22s
Security / security (pull_request) Successful in 0s
Corn CI / test (pull_request) Successful in 3m58s
Corn CI / release (pull_request) Has been skipped
Review / change impact (pull_request_target) Successful in 4m25s
e82d06634c
The first live corn_host plan failed with 'container identity would change'.
During an import the provider's before snapshot is its pre-read state, so
vm_id is still null. The plan also wanted a console update. CT 125's
console equals the provider default, but declaring it explicitly turned
the import backfill into a console change, and bpg/proxmox v0.122.0 reboots
the container for any console change.

- container.tf: no console block (the provider default matches CT 125).
- policy.py: on import, only provider bookkeeping may differ (vm_id,
  purge_on_destroy, delete_unreferenced_disks_on_destroy, migrate,
  timeouts). None of these reaches the Proxmox API. Any other attribute
  is refused. The approval text says no API change, no restart.
- Tests cover the real import shape and refuse console or memory on import.

Checked against a mock Proxmox API with provider v0.122.0: import plan
approvable, apply sends no write requests, re-plan is 'no changes'.
john merged commit a099d62714 into main 2026-11-24 11:55:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
john/corn!104
No description provided.