The tracker Guest refuses replacement, and the Test Stack still gets destroyed (TR-59) #44

Merged
pit merged 2 commits from hermes/TR-59-the-tracker-guest-refuses-replacement-an into main 2026-11-11 11:49:27 +00:00
Member

Implements TR-59

Summary

The replacement guard moves into the module as an input, so the root that owns the Guest decides whether it applies, and the throwaway root is the only one that lifts it.

 modules/guest/container.tf
   resource "proxmox_virtual_environment_container" "vikunja"
     lifecycle {
       ignore_changes = [initialization[0].user_account, pool_id]
+      prevent_destroy = var.prevent_guest_destroy   # default true
     }

 modules/guest/variables.tf
+variable "prevent_guest_destroy"                      # default = true

 test/guest/main.tf
   module "guest" {
+    prevent_guest_destroy = false

vikunja/guest/main.tf is untouched: the two moved blocks stay, and prod's root says nothing about the input, so prod's Guest keeps the guard.

The ticket's other option — declaring PROD's container in its own root — was not taken: it would duplicate the module's resource and the Test Stack would stop proving prod's shape, which docs/reference/test-guest.md rests on.

Evidence

A plan of vikunja/guest that would replace the Guest stops, and the vmid is in it. Offline, on this head: a scratch copy of the prod root (its own main.tf, variables.tf, providers.tf, versions.tf, keys.d, no backend.tf) holding a state with the Guest at 142, planned with -refresh=false and a guest map whose vmid is 143:

      ~ vm_id                                = 142 -> 143 # forces replacement
Plan: 1 to add, 1 to change, 1 to destroy.
╷
│ Error: Resource instance cannot be destroyed
│ Resource instance
│ module.guest.proxmox_virtual_environment_container.vikunja has
│ prevent_destroy set, but the plan calls for it to be destroyed.
rc=1

The Test Stack still creates and destroys its Guest. The same plan with the guard lifted — what test/guest's module call does — proposes the replacement (rc=0), and the teardown's own target, tofu plan -destroy -target=module.guest.proxmox_virtual_environment_container.vikunja, plans 1 to destroy (rc=0). The same destroy plan against the guard on is refused (rc=1, same error).

The new declarations have teeth. make env-test on the naive fix (a literal prevent_destroy = true in the module) prints FAIL modules/guest pins the Guest unless its root lifts the guard and exits rc=2; on this head it prints env-test: every assertion holds.

The floor. mise exec -- make check → rc=0: env-test: every assertion holds., Success! The configuration is valid. ×3, pool.tftest.hcl ... 1 passed, 0 failed., edge.tftest.hcl ... 1 passed, 0 failed.

Not verified here: make test-ci itself — it needs the pre Proxmox token and a real Guest, and this container holds neither. The execute job on this pull request is that leg.

Merge Danger

Door: two-way — the branch adds a lifecycle line and an input; a revert removes the guard again.

Blast Radius: the one module and its two callers

PROD's Guest carries the guard from the next plan onwards, so a change that would replace it now reds the guest job on a push to main instead of proposing the replacement. Lifting the guard for a deliberate replacement is an edit to the module call, which is the Operator's act. A Guest removed on the Node walks past the guard either way.

infra-secrets' docs/proxmox-credentials.md counts three prod Stacks that guard their Guest with prevent_destroy; after this merge the tracker's is a fourth, and that page is infra-secrets' to update.

Implements [TR-59](https://vikunja.thepit.space/tasks/345) ## Summary The replacement guard moves into the module as an input, so the root that owns the Guest decides whether it applies, and the throwaway root is the only one that lifts it. ```diff modules/guest/container.tf resource "proxmox_virtual_environment_container" "vikunja" lifecycle { ignore_changes = [initialization[0].user_account, pool_id] + prevent_destroy = var.prevent_guest_destroy # default true } modules/guest/variables.tf +variable "prevent_guest_destroy" # default = true test/guest/main.tf module "guest" { + prevent_guest_destroy = false ``` `vikunja/guest/main.tf` is untouched: the two `moved` blocks stay, and prod's root says nothing about the input, so prod's Guest keeps the guard. The ticket's other option — declaring PROD's container in its own root — was not taken: it would duplicate the module's resource and the Test Stack would stop proving prod's shape, which `docs/reference/test-guest.md` rests on. ## Evidence **A plan of `vikunja/guest` that would replace the Guest stops, and the vmid is in it.** Offline, on this head: a scratch copy of the prod root (its own `main.tf`, `variables.tf`, `providers.tf`, `versions.tf`, `keys.d`, no `backend.tf`) holding a state with the Guest at 142, planned with `-refresh=false` and a guest map whose vmid is 143: ``` ~ vm_id = 142 -> 143 # forces replacement Plan: 1 to add, 1 to change, 1 to destroy. ╷ │ Error: Resource instance cannot be destroyed │ Resource instance │ module.guest.proxmox_virtual_environment_container.vikunja has │ prevent_destroy set, but the plan calls for it to be destroyed. rc=1 ``` **The Test Stack still creates and destroys its Guest.** The same plan with the guard lifted — what `test/guest`'s module call does — proposes the replacement (`rc=0`), and the teardown's own target, `tofu plan -destroy -target=module.guest.proxmox_virtual_environment_container.vikunja`, plans `1 to destroy` (`rc=0`). The same destroy plan against the guard on is refused (`rc=1`, same error). **The new declarations have teeth.** `make env-test` on the naive fix (a literal `prevent_destroy = true` in the module) prints `FAIL modules/guest pins the Guest unless its root lifts the guard` and exits `rc=2`; on this head it prints `env-test: every assertion holds.` **The floor.** `mise exec -- make check` → `rc=0`: `env-test: every assertion holds.`, `Success! The configuration is valid.` ×3, `pool.tftest.hcl ... 1 passed, 0 failed.`, `edge.tftest.hcl ... 1 passed, 0 failed.` **Not verified here:** `make test-ci` itself — it needs the `pre` Proxmox token and a real Guest, and this container holds neither. The `execute` job on this pull request is that leg. ## Merge Danger **Door:** two-way — the branch adds a `lifecycle` line and an input; a revert removes the guard again. **Blast Radius:** the one module and its two callers PROD's Guest carries the guard from the next plan onwards, so a change that would replace it now reds the `guest` job on a push to main instead of proposing the replacement. Lifting the guard for a deliberate replacement is an edit to the module call, which is the Operator's act. A Guest removed on the Node walks past the guard either way. `infra-secrets`' `docs/proxmox-credentials.md` counts three prod Stacks that guard their Guest with `prevent_destroy`; after this merge the tracker's is a fourth, and that page is `infra-secrets`' to update.
`modules/guest` gains `prevent_guest_destroy`, on by default, and puts it on the
container's `lifecycle` as `prevent_destroy`. A plan of `vikunja/guest` that
would destroy or replace the Guest now stops with `Resource instance cannot be
destroyed`, with the vmid it would take away in the diff above the refusal.

It is an input rather than a literal because both roots call the module: a
literal would pin the Test Guest too, and `make test-ci` would be unable to
destroy what it created. `test/guest` is the one root that turns it off, and
`env-test` carries the three declarations that keep the two halves in place.
ticket-dispatch: document the Guest's replacement guard and its one switch (TR-59)
All checks were successful
checks / static (pull_request) Successful in 11s
checks / edge (pull_request) Has been skipped
checks / guest (pull_request) Has been skipped
checks / execute (pull_request) Successful in 2m44s
6e5fa5455b
`docs/reference/guest.md` gains the section the plan now rests on: the guard,
the refusal it produces, the vmid in the diff the `guest` job prints, and why
the switch is an input rather than a literal. `docs/reference/test-guest.md`
says why this root is the one that lifts it.
Member

Review started (round 1/5) on 6e5fa5455b — reading the diff now.

**Review started** (round 1/5) on 6e5fa5455bd8bf80339054720e072168278b6abc — reading the diff now.
bot-minos approved these changes 2026-11-10 22:38:28 +00:00
bot-minos left a comment

olympus/infra-tracker #44 · head 6e5fa54 · round 1/5 · the thread's first review (no earlier review object) · axes: standards, spec

Recommendation: merge

Verdict

No blocker. The change does what TR-59's three acceptance criteria ask, and I reproduced each of them by hand — the refusal on a scratch prod-shaped root, the lifted guard letting the same plan and the same targeted destroy through, and the floor. Two advisories follow; both are advice, neither turns the verdict.

Spec — TR-59, "The tracker Guest refuses replacement, and the Test Guest still gets destroyed"

Spec source: the body links TR-59 (Vikunja task 345, project 3, Infra Tracker), fetched live this round. Its contract:

Ticket's acceptance criterion Stands Evidence produced this round
A plan of vikunja/guest that would replace the Guest stops with the replacement named, and the plan check reports 142 met guard on, vmid 142→143: diff prints ~ vm_id = 142 -> 143 # forces replacement, Plan: 1 to add, 1 to change, 1 to destroy., then Error: Resource instance cannot be destroyed naming module.guest.proxmox_virtual_environment_container.vikunja, rc=1
make test-ci still creates and destroys its Test Guest met CI run 35 on this head: execute success in 2m44s; its log carries guest answering: 10.12.0.248 and test guest destroyed
mise exec -- make check exits 0 met ran at head: env-test: every assertion holds., three Success! The configuration is valid., pool.tftest.hcl … 1 passed, edge.tftest.hcl … 1 passed, rc=0

Both bullets of "What to build" are satisfied. The module gained the input with the guard as its default (modules/guest/variables.tf:55-59, wired at modules/guest/container.tf:93); test/guest sets it false by name (test/guest/main.tf:33); vikunja/guest/main.tf is untouched — its module call (:3-10) passes no such input, so the default holds, and both moved blocks (:15-23) stand.

  • Requirements missing or partial: none.
  • Behaviour in the diff that was not asked for: none. The six files are the module, its two callers' contract, the floor's assertions, and the two reference pages that describe them.

BLOCKER: none · ADVISORY: none.

Standards

Rules read at the head, not from the standing clone: AGENTS.md (mise exec -- make; no production apply by an agent; the PR body's ## Summary / ## Evidence / ## Merge Danger), docs/adr/index.md and 0001–0005, and the org records at olympus/workshop main — 0009 (PROD deploys through a merge) and 0011 (a deploy never destroys or replaces). This change is the implementation of 0011 for this Stack, and the body carries the three required sections. No documented rule is broken.

Neither advisory below rests on a written repo rule: no convention covers how tight a text assertion must be, and no convention covers the second page's enumeration. They are general practice, and they are advice.

ADVISORY — scripts/tests/run.sh:235-240: the new assertions pass on a commented-out guard. The greps are unanchored, so # prevent_destroy = var.prevent_guest_destroy satisfies the first one. Driven in a full copy of the head tree (git archive HEAD): with modules/guest/container.tf:93 commented out, and separately with test/guest/main.tf:33 commented out, scripts/tests/run.sh prints env-test: every assertion holds. and exits 0 — the guard it names is gone and the floor is green. Deleting either line instead does red it (FAIL modules/guest pins the Guest unless its root lifts the guard, rc=1), so it is a precision gap, not a vacuous test. Smallest fix: anchor both pass_if patterns to a live line — grep -qE '^[[:space:]]*prevent_destroy *= *var\.prevent_guest_destroy' and grep -qE '^[[:space:]]*prevent_guest_destroy *= *false'.

ADVISORY — docs/reference/test-guest.md:40: the enumeration is now one short. "Everything else is prod's shape … except the address and the pool" predates this change; the Test root now differs from prod in a third way, which the same page introduces at :99-104. Read at :40 alone it is stale. Smallest fix: "except the address, the pool and the replacement guard".

BLOCKER: none · ADVISORY: 2.

Named, not charged

  • docs/reference/guest.md:62-63 says "The guest job on a push to main is that plan, and a change that would take the Guest away reds it." True as written, but the conflict is then visible only after the merge, while org ADR-0011 puts it on the pull request. That gap predates this change — the Guest plan has been push-only since ADR-0005 — and 0011's own "Update when" names it. Not this change's to close, and not charged.
  • infra-secrets docs/proxmox-credentials.md says "three of them also guard the container with prevent_destroy — silo/guest, semaphore/guest and bao/guest"; after this merge it is four. The claim checks out against that page at main today, and the body discloses it as infra-secrets' follow-up. Not charged here.
  • test/guest/pool.tftest.hcl proves the pool claim through the module with a mock provider, while the guard is pinned by text greps. That is the repo's stated pattern for "the declarations" (scripts/tests/run.sh:15-17), so it is named, not charged.

Verified

  1. Head. refs/pull/44/head resolved to 6e5fa5455bd8bf80339054720e072168278b6abc, equal to the dispatch, re-checked with git ls-remote immediately before this review was posted.
  2. The floor. mise exec -- make check at head, rc=0 — the log carries every new assertion, tofu fmt -check, all three validates, and both plan-only suites.
  3. The guard refuses a replacement, red/green. Scratch root with the prod guest map (vmid 142, pool prod), the head's modules/guest copied byte-identical (diff -r rc=0), and a state holding the Guest at 142. Planning -refresh=false -var vmid=143:
    • guard on → the diff with ~ vm_id = 142 -> 143 # forces replacement, Plan: 1 to add, 1 to change, 1 to destroy., then Error: Resource instance cannot be destroyed naming the resource, rc=1;
    • prevent_guest_destroy = false → the same replacement proposed (-/+ … must be replaced), rc=0.
  4. The teardown's own command. tofu plan -destroy -target=module.guest.proxmox_virtual_environment_container.vikunja — the command container/ci.sh:96-97 runs: guard on → Plan: 0 to add, 0 to change, 1 to destroy. then the same refusal, rc=1; guard off → the same plan, rc=0.
  5. CI on this head. Run 35: static success (11s), execute success (2m44s), edge/guest skipped (both if: github.event_name == 'push'). The execute log reads template import: burns/synology:…, Plan: 3 to add, 1 to change, 0 to destroy, Apply complete! Resources: 3 added, 1 changed, 0 destroyed, guest answering: 10.12.0.248, test guest destroyed — the leg the body said it could not run, green.
  6. The new assertions, mutated. Control copy green; guard line commented → still green (the advisory); guard line deleted → red. Same for the test root's line.
  7. The tree. git status --porcelain clean in the review worktree; all probes ran from cache/scratch/.

Could not verify

  • PROD's real state. The plan against the live Guest needs the guest Stack's state pair and the plan token, which this host does not hold; the guest job on the push to main is that leg. My plan ran on a scratch prod-shaped root over a state a mocked apply left behind, which fixes the shape and the vmid but not the live object.
  • The guest job's own red. It is skipped on a pull request by design (checks.yaml:140-142), so "a change that would replace the Guest reds it" rests on the job's wiring (:160-161) plus the refusal I drove above, not on a live run at this head.
<!-- minos review-loop: repo=olympus/infra-tracker pr=44 head=6e5fa5455bd8bf80339054720e072168278b6abc round=1/5 axes=standards,spec --> **olympus/infra-tracker #44** · head `6e5fa54` · round **1/5** · the thread's first review (no earlier review object) · axes: standards, spec Recommendation: merge ## Verdict No blocker. The change does what TR-59's three acceptance criteria ask, and I reproduced each of them by hand — the refusal on a scratch prod-shaped root, the lifted guard letting the same plan and the same targeted destroy through, and the floor. Two advisories follow; both are advice, neither turns the verdict. ## Spec — TR-59, "The tracker Guest refuses replacement, and the Test Guest still gets destroyed" Spec source: the body links [TR-59](https://vikunja.thepit.space/tasks/345) (Vikunja task 345, project 3, `Infra Tracker`), fetched live this round. Its contract: | Ticket's acceptance criterion | Stands | Evidence produced this round | | --- | --- | --- | | A plan of `vikunja/guest` that would replace the Guest stops with the replacement named, and the plan check reports 142 | **met** | guard on, vmid 142→143: diff prints `~ vm_id = 142 -> 143 # forces replacement`, `Plan: 1 to add, 1 to change, 1 to destroy.`, then `Error: Resource instance cannot be destroyed` naming `module.guest.proxmox_virtual_environment_container.vikunja`, rc=1 | | `make test-ci` still creates and destroys its Test Guest | **met** | CI run 35 on this head: `execute` **success in 2m44s**; its log carries `guest answering: 10.12.0.248` and `test guest destroyed` | | `mise exec -- make check` exits 0 | **met** | ran at head: `env-test: every assertion holds.`, three `Success! The configuration is valid.`, `pool.tftest.hcl … 1 passed`, `edge.tftest.hcl … 1 passed`, rc=0 | Both bullets of "What to build" are satisfied. The module gained the input with the guard as its default (`modules/guest/variables.tf:55-59`, wired at `modules/guest/container.tf:93`); `test/guest` sets it false by name (`test/guest/main.tf:33`); `vikunja/guest/main.tf` is untouched — its module call (`:3-10`) passes no such input, so the default holds, and both `moved` blocks (`:15-23`) stand. - Requirements missing or partial: **none**. - Behaviour in the diff that was not asked for: **none**. The six files are the module, its two callers' contract, the floor's assertions, and the two reference pages that describe them. **BLOCKER: none · ADVISORY: none.** ## Standards Rules read at the head, not from the standing clone: `AGENTS.md` (`mise exec -- make`; no production apply by an agent; the PR body's `## Summary` / `## Evidence` / `## Merge Danger`), `docs/adr/index.md` and 0001–0005, and the org records at `olympus/workshop` `main` — 0009 (PROD deploys through a merge) and 0011 (*a deploy never destroys or replaces*). This change is the implementation of 0011 for this Stack, and the body carries the three required sections. No documented rule is broken. Neither advisory below rests on a written repo rule: no convention covers how tight a text assertion must be, and no convention covers the second page's enumeration. They are general practice, and they are advice. **ADVISORY — `scripts/tests/run.sh:235-240`: the new assertions pass on a commented-out guard.** The greps are unanchored, so ` # prevent_destroy = var.prevent_guest_destroy` satisfies the first one. Driven in a full copy of the head tree (`git archive HEAD`): with `modules/guest/container.tf:93` commented out, and separately with `test/guest/main.tf:33` commented out, `scripts/tests/run.sh` prints `env-test: every assertion holds.` and exits 0 — the guard it names is gone and the floor is green. Deleting either line instead does red it (`FAIL modules/guest pins the Guest unless its root lifts the guard`, rc=1), so it is a precision gap, not a vacuous test. Smallest fix: anchor both `pass_if` patterns to a live line — `grep -qE '^[[:space:]]*prevent_destroy *= *var\.prevent_guest_destroy'` and `grep -qE '^[[:space:]]*prevent_guest_destroy *= *false'`. **ADVISORY — `docs/reference/test-guest.md:40`: the enumeration is now one short.** "Everything else is prod's shape … except the address and the pool" predates this change; the Test root now differs from prod in a third way, which the same page introduces at `:99-104`. Read at `:40` alone it is stale. Smallest fix: "except the address, the pool and the replacement guard". **BLOCKER: none · ADVISORY: 2.** ## Named, not charged - `docs/reference/guest.md:62-63` says "The `guest` job on a push to main is that plan, and a change that would take the Guest away reds it." True as written, but the conflict is then visible only *after* the merge, while org ADR-0011 puts it on the pull request. That gap predates this change — the Guest plan has been push-only since ADR-0005 — and 0011's own "Update when" names it. Not this change's to close, and not charged. - `infra-secrets` `docs/proxmox-credentials.md` says "three of them also guard the container with `prevent_destroy` — `silo/guest`, `semaphore/guest` and `bao/guest`"; after this merge it is four. The claim checks out against that page at `main` today, and the body discloses it as infra-secrets' follow-up. Not charged here. - `test/guest/pool.tftest.hcl` proves the pool claim through the module with a mock provider, while the guard is pinned by text greps. That is the repo's stated pattern for "the declarations" (`scripts/tests/run.sh:15-17`), so it is named, not charged. ## Verified 1. **Head.** `refs/pull/44/head` resolved to `6e5fa5455bd8bf80339054720e072168278b6abc`, equal to the dispatch, re-checked with `git ls-remote` immediately before this review was posted. 2. **The floor.** `mise exec -- make check` at head, rc=0 — the log carries every new assertion, `tofu fmt -check`, all three `validate`s, and both plan-only suites. 3. **The guard refuses a replacement, red/green.** Scratch root with the prod guest map (vmid 142, pool `prod`), the head's `modules/guest` copied byte-identical (`diff -r` rc=0), and a state holding the Guest at 142. Planning `-refresh=false -var vmid=143`: - guard on → the diff with `~ vm_id = 142 -> 143 # forces replacement`, `Plan: 1 to add, 1 to change, 1 to destroy.`, then `Error: Resource instance cannot be destroyed` naming the resource, rc=1; - `prevent_guest_destroy = false` → the same replacement proposed (`-/+ … must be replaced`), rc=0. 4. **The teardown's own command.** `tofu plan -destroy -target=module.guest.proxmox_virtual_environment_container.vikunja` — the command `container/ci.sh:96-97` runs: guard on → `Plan: 0 to add, 0 to change, 1 to destroy.` then the same refusal, rc=1; guard off → the same plan, rc=0. 5. **CI on this head.** Run 35: `static` success (11s), `execute` success (2m44s), `edge`/`guest` skipped (both `if: github.event_name == 'push'`). The `execute` log reads `template import: burns/synology:…`, `Plan: 3 to add, 1 to change, 0 to destroy`, `Apply complete! Resources: 3 added, 1 changed, 0 destroyed`, `guest answering: 10.12.0.248`, `test guest destroyed` — the leg the body said it could not run, green. 6. **The new assertions, mutated.** Control copy green; guard line commented → still green (the advisory); guard line deleted → red. Same for the test root's line. 7. **The tree.** `git status --porcelain` clean in the review worktree; all probes ran from `cache/scratch/`. ## Could not verify - **PROD's real state.** The plan against the live Guest needs the guest Stack's state pair and the `plan` token, which this host does not hold; the `guest` job on the push to main is that leg. My plan ran on a scratch prod-shaped root over a state a mocked apply left behind, which fixes the shape and the vmid but not the live object. - **The `guest` job's own red.** It is `skipped` on a pull request by design (`checks.yaml:140-142`), so "a change that would replace the Guest reds it" rests on the job's wiring (`:160-161`) plus the refusal I drove above, not on a live run at this head.
pit merged commit 32df41711b into main 2026-11-11 11:49:27 +00:00
pit deleted branch hermes/TR-59-the-tracker-guest-refuses-replacement-an 2026-11-11 11:49:27 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
olympus/infra-tracker!44
No description provided.