The apt cache refresh stops reporting a change in check mode (THE-127) #45

Merged
pit merged 1 commit from hermes/127-apt-cache-changed-when into main 2026-12-03 06:36:40 +00:00
Owner

Summary

The two refresh-only apt tasks in the play stop reporting a change they did not make.

 silo/service/roles/unattended_upgrades/tasks/main.yml
 - name: refresh the apt cache before the first install
+  # Preparation, not a change: check mode cannot update the cache and still
+  # answers `changed` once it is older than `cache_valid_time`, so without this
+  # line every daily rehearsal of the service layer reads as drift.
   ansible.builtin.apt:
     update_cache: true
     cache_valid_time: 3600
+  changed_when: false

 silo/service/roles/silo/tasks/main.yml
 - name: refresh the apt cache before the first install
   # A freshly-created guest ships the template's apt index, which goes stale as
   # the mirror moves on; update once so the install below sees a current index.
+  # The install names the change that matters, and check mode cannot update the
+  # cache anyway: the module skips the update and still answers `changed` once
+  # the cache is older than `cache_valid_time`, so every daily rehearsal reports
+  # drift without this line.
   ansible.builtin.apt:
     update_cache: true
     cache_valid_time: 3600
+  changed_when: false

apt: update_cache: true with cache_valid_time answers changed under --check whenever the
cache is older than the hour: the module skips the update and still sets its updated flag. That made
the daily drift task (drift-infra-silo) report changed=2 on a Guest nothing had moved, and real
service-layer drift stayed hidden behind it. The fix is the one infra-tracker carries on its
unattended_upgrades and vikunja roles (olympus/infra-tracker#66).

The firewall role's nftables task also refreshes the cache, but it names a package install, so it
reports only a change to that package and needs no predicate.

Evidence

Read-only rehearsal against PROD (Guest 150) with make service-check:

  • Before (89410e4, 2026-12-03T05:35Z):
    silo : ok=25 changed=2 unreachable=0 failed=0 skipped=3. The two changed tasks are
    unattended_upgrades : refresh the apt cache before the first install and silo : refresh the apt cache before the first install; every other task is ok.
  • After (this branch, 2026-12-03T05:36Z):
    silo : ok=25 changed=0 unreachable=0 failed=0 skipped=3. Both refresh tasks read ok.
  • The cache was 7 h 40 m old at both runs (/var/lib/apt/lists mtime 2026-12-02T21:55Z), so it
    was past cache_valid_time = 3600 and the ok is not a cache the real apply had just refreshed.
  • make check green.

Not run: any apply. The next scheduled drift task at 03:15Z is what confirms the row reads
clean.

Merge Danger

Door: two-way — two changed_when predicates in a play; reverting is this diff backwards, and
nothing on the Guest depends on them.

Blast Radius: the drift report only. No state, no apply, no service restart; the plays themselves
are unchanged apart from what they report.

## Summary The two refresh-only `apt` tasks in the play stop reporting a change they did not make. ```diff silo/service/roles/unattended_upgrades/tasks/main.yml - name: refresh the apt cache before the first install + # Preparation, not a change: check mode cannot update the cache and still + # answers `changed` once it is older than `cache_valid_time`, so without this + # line every daily rehearsal of the service layer reads as drift. ansible.builtin.apt: update_cache: true cache_valid_time: 3600 + changed_when: false silo/service/roles/silo/tasks/main.yml - name: refresh the apt cache before the first install # A freshly-created guest ships the template's apt index, which goes stale as # the mirror moves on; update once so the install below sees a current index. + # The install names the change that matters, and check mode cannot update the + # cache anyway: the module skips the update and still answers `changed` once + # the cache is older than `cache_valid_time`, so every daily rehearsal reports + # drift without this line. ansible.builtin.apt: update_cache: true cache_valid_time: 3600 + changed_when: false ``` `apt: update_cache: true` with `cache_valid_time` answers `changed` under `--check` whenever the cache is older than the hour: the module skips the update and still sets its updated flag. That made the daily drift task (`drift-infra-silo`) report `changed=2` on a Guest nothing had moved, and real service-layer drift stayed hidden behind it. The fix is the one `infra-tracker` carries on its `unattended_upgrades` and `vikunja` roles (olympus/infra-tracker#66). The firewall role's `nftables` task also refreshes the cache, but it names a package install, so it reports only a change to that package and needs no predicate. ## Evidence Read-only rehearsal against PROD (Guest 150) with `make service-check`: - **Before** (`89410e4`, `2026-12-03T05:35Z`): `silo : ok=25 changed=2 unreachable=0 failed=0 skipped=3`. The two `changed` tasks are `unattended_upgrades : refresh the apt cache before the first install` and `silo : refresh the apt cache before the first install`; every other task is `ok`. - **After** (this branch, `2026-12-03T05:36Z`): `silo : ok=25 changed=0 unreachable=0 failed=0 skipped=3`. Both refresh tasks read `ok`. - The cache was **7 h 40 m old** at both runs (`/var/lib/apt/lists` mtime `2026-12-02T21:55Z`), so it was past `cache_valid_time = 3600` and the `ok` is not a cache the real apply had just refreshed. - `make check` green. **Not run:** any apply. The next scheduled drift task at 03:15Z is what confirms the row reads `clean`. ## Merge Danger **Door:** two-way — two `changed_when` predicates in a play; reverting is this diff backwards, and nothing on the Guest depends on them. **Blast Radius:** the drift report only. No state, no apply, no service restart; the plays themselves are unchanged apart from what they report.
The apt cache refresh stops reporting a change in check mode (THE-127)
All checks were successful
plan / stack-plan-check (pull_request_target) Successful in 18s
pr-checks / check (pull_request) Successful in 50s
5b7adb03de
`apt: update_cache: true` with `cache_valid_time` answers `changed` under
`--check` whenever the cache is older than the hour, because the module skips
the update and still sets its updated flag. The two refresh-only tasks in the
play therefore made every daily drift rehearsal report `changed=2` on a Guest
nothing had moved, hiding real service-layer drift behind the noise.

Both now carry `changed_when: false`; the installs that follow still name the
change that matters.
Author
Owner

Waiting — queued behind olympus/infra-forge#116 (one review run at a time). The review run resumes on its own at Thu 3 Dec, 06:38 (Europe/Madrid); nothing is needed from you. This retry does not count as a review round.

**Waiting** — queued behind olympus/infra-forge#116 (one review run at a time). The review run resumes on its own at Thu 3 Dec, 06:38 (Europe/Madrid); nothing is needed from you. This retry does not count as a review round.
Member

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

**Review started** (round 1/5) on 5b7adb03de21ab53bfc31696224ddabc7c2ab1f5 — reading the diff now.
bot-minos approved these changes 2026-12-03 05:49:35 +00:00
bot-minos left a comment

repo=olympus/infra-silo · pr=45 · head=5b7adb03de21ab53bfc31696224ddabc7c2ab1f5 · round=1/5 · verdict=merge

Recommendation: merge

Round: the dispatch announced round 0; list_pull_reviews on this PR returned [], so this is the thread's first review — round 1 of 5, with no earlier findings to re-drive.

Spec sources, in the order read. (1) paperclip:THE-127 from the title prefix — the repo's own prefix set is SL/SC/CP, so a bare THE routes to the company board — fetched live 2026-12-03T05:4x Z: GET /api/issues/THE-127 → 200, status in_review, updatedAt 2026-12-03T05:42:41.390Z, and GET /api/issues/<uuid>/documents → 200, [] (no design document). (2) The PR #45 body, read at the dispatch head.

Standards sources. AGENTS.md (§Code comments, §Pull requests), docs/agents/issue-tracker.md (§Resolving the task a pull request addresses), docs/agents/workflow.md, docs/index.md, docs/adr/* and olympus/workshop/docs/adr/* (no record speaks to check-mode changed reporting; nothing here conflicts). There is no CONTRIBUTING.md and no CODING_STANDARDS.md in the tree.

Standards

ADVISORY — the PR body names no task reference. AGENTS.md §Pull requests — "Name the task a PR addresses in its body by its own reference: SL-<index> … or SC-<index>/CP-<index>" — and docs/agents/issue-tracker.md §Resolving the task a pull request addresses — "Name the task in the PR body". The title carries (THE-127); the body carries no THE-127, no paperclip: and no SL- anywhere (PR #45 body, line 1 on). Practice census: of the last 7 merged bodies, 5 carry THE-<n> (#44, #42, #41, #40, #38), 2 carry a repo identifier (#41, #39), and #43 carries neither — the rule's enumeration has not caught up with the board. Clearing (either): one line in the body naming the task, paperclip:THE-127; or move the AGENTS.md enumeration to admit the board reference. Body-only: the code is sound.

ADVISORY — seven comment lines for two predicate lines, the same mechanism explained twice. silo/service/roles/silo/tasks/main.yml:55-58 (4 lines) and silo/service/roles/unattended_upgrades/tasks/main.yml:11-13 (3 lines) restate one sentence. AGENTS.md §Code comments: "Keep comments to a minimum … propose a docs page under docs/ instead of writing it as a comment." Named as a tension, not a breach of the ticket: THE-127 step 1 asks for "the reason in a comment beside them", and the sibling fix olympus/infra-tracker#66 carries a 5-line comment in its vikunja role, so the ticket and the sibling set the shape and the repo rule has not caught up. Clearing: one line each, e.g. # Not a change: check mode skips the update but still reports changed. — the ticket's instruction is still satisfied.

Spec

No findings. THE-127's three steps, one line each:

Step State
1. changed_when: false on both refresh tasks, reason in a comment beside them Met — silo/.../silo/tasks/main.yml:62 and silo/.../unattended_upgrades/tasks/main.yml:17, comments beside both
2. Re-run make service-check, confirm changed=0 failed=0 Reported in the body with before/after recaps; not reproducible by this reviewer (see Could not verify). The mechanism that produces those numbers is reproduced by hand
3. The next 03:15Z run reads clean Pending by design — a future act, waiting on the timer

Scope creep: none. The diff is two comments blocks and two changed_when predicates, nothing else.

Verified by hand

  • The mechanism, from the pinned module's own source. ansible-core 2.21.5 (the version mise.toml pins), ansible/modules/apt.py:1485 sets updated_cache = True when module.check_mode and the cache is past cache_valid_time; :1491 exits with changed=updated_cache only when no package/upgrade/deb is named. That is the PR body's mechanism, line for line.
  • Live probe on this host. cache/scratch/pr45-apt-probe/play.yml, ansible-playbook -i localhost, -c local --check (core 2.21.5) against a box whose /var/lib/apt/lists mtime is 2026-09-04 — stale by three months, the same condition as the ticket: base shape (refresh, no predicate) → changed: [localhost]; head shape (changed_when: false) → ok: [localhost]; firewall shape (name + update_cache) → ok: [localhost]. The fix works, and the body's firewall sentence ("it reports only a change to that package") is true.
  • mise exec -- make check at 5b7adb0 in worktree .worktrees/infra-silo-pr45-r1 → exit 0, Success! The configuration is valid.
  • The two-task census. grep update_cache over the play finds exactly two refresh-only tasks; the firewall's names a package. The body's changed=2 is fully accounted for, and no third site was missed.
  • No handler is silenced. changed_when: false notifies nothing away: the silo role's handlers are notified by its two template tasks, and unattended_upgrades has no handlers directory.
  • The cross-repo claim. olympus/infra-tracker main at 810d648: both unattended_upgrades/tasks/main.yml and vikunja/tasks/main.yml carry changed_when: false. The body's citation of #66 holds.
  • Base is current. merge_base = base.sha = 89410e4 = origin/main tip; head is one commit ahead; diff is the PR file list, 2 files, +9/-0.
  • CI at the head. pr-checks / check (pull_request) success (50s) and plan / stack-plan-check (pull_request_target) success (18s), from get_commit_statuses on 5b7adb0. No Stack change → no plan delta to explain.
  • Charter classes. No destroy or replace, no tier-1 config change, no ADR / branch-protection / CI-gate edit; the diff applies nothing, so ADR-0009 is respected. Nothing to escalate.

Could not verify

  • The live before/after recap on Guest 150. make service-check needs SILO_ROOT_PASSWORD from the store and a live inventory, and this agent's make env refuses by class (docs/agents/workflow.md §3). The body's ok=25 changed=2 → changed=0 is the author's report; what I reproduced independently is the module behaviour that produces both numbers.
  • The 03:15Z audit row reading clean — a later actor's result, pending by design.
  • Absence of an apply — nothing in the diff can apply, which is the strongest available form of that claim.

Named, not charged

  • docs/index.md lists "A role changes" as a trigger to update hardening.md. A role did change, but the Guest's behaviour is identical and nothing hardening.md asserts becomes false — no doc update owed.
  • No automated test covers check-mode changed counts. The repo has no Ansible test leg (docs/agents/workflow.md §What nothing here checks) and infra-tracker#66 recorded the same gap and deferred a --check leg. Pre-existing, out of this ticket's scope.

Summary

  • Standards: 2 findings, both ADVISORY; worst: the missing task reference in the PR body.
  • Spec: 0 findings.
  • Blockers: 0. The two advisories travel as advice; the merge recommendation follows the blocker count, not the volume rule.
repo=olympus/infra-silo · pr=45 · head=5b7adb03de21ab53bfc31696224ddabc7c2ab1f5 · round=1/5 · verdict=merge Recommendation: merge Round: the dispatch announced round 0; `list_pull_reviews` on this PR returned `[]`, so this is the thread's first review — round 1 of 5, with no earlier findings to re-drive. **Spec sources, in the order read.** (1) `paperclip:THE-127` from the title prefix — the repo's own prefix set is `SL`/`SC`/`CP`, so a bare `THE` routes to the company board — fetched live 2026-12-03T05:4x Z: `GET /api/issues/THE-127` → 200, status `in_review`, `updatedAt` 2026-12-03T05:42:41.390Z, and `GET /api/issues/<uuid>/documents` → 200, `[]` (no design document). (2) The PR #45 body, read at the dispatch head. **Standards sources.** `AGENTS.md` (§Code comments, §Pull requests), `docs/agents/issue-tracker.md` (§Resolving the task a pull request addresses), `docs/agents/workflow.md`, `docs/index.md`, `docs/adr/*` and `olympus/workshop/docs/adr/*` (no record speaks to check-mode `changed` reporting; nothing here conflicts). There is no `CONTRIBUTING.md` and no `CODING_STANDARDS.md` in the tree. ## Standards **ADVISORY — the PR body names no task reference.** `AGENTS.md §Pull requests` — "Name the task a PR addresses in its body by its own reference: `SL-<index>` … or `SC-<index>`/`CP-<index>`" — and `docs/agents/issue-tracker.md §Resolving the task a pull request addresses` — "Name the task in the PR body". The title carries `(THE-127)`; the body carries no `THE-127`, no `paperclip:` and no `SL-` anywhere (PR #45 body, line 1 on). Practice census: of the last 7 merged bodies, 5 carry `THE-<n>` (`#44`, `#42`, `#41`, `#40`, `#38`), 2 carry a repo identifier (`#41`, `#39`), and `#43` carries neither — the rule's enumeration has not caught up with the board. Clearing (either): one line in the body naming the task, `paperclip:THE-127`; or move the `AGENTS.md` enumeration to admit the board reference. Body-only: the code is sound. **ADVISORY — seven comment lines for two predicate lines, the same mechanism explained twice.** `silo/service/roles/silo/tasks/main.yml:55-58` (4 lines) and `silo/service/roles/unattended_upgrades/tasks/main.yml:11-13` (3 lines) restate one sentence. `AGENTS.md §Code comments`: "Keep comments to a minimum … propose a docs page under `docs/` instead of writing it as a comment." Named as a tension, not a breach of the ticket: THE-127 step 1 asks for "the reason in a comment beside them", and the sibling fix `olympus/infra-tracker#66` carries a 5-line comment in its `vikunja` role, so the ticket and the sibling set the shape and the repo rule has not caught up. Clearing: one line each, e.g. `# Not a change: check mode skips the update but still reports changed.` — the ticket's instruction is still satisfied. ## Spec No findings. THE-127's three steps, one line each: | Step | State | | --- | --- | | 1. `changed_when: false` on both refresh tasks, reason in a comment beside them | Met — `silo/.../silo/tasks/main.yml:62` and `silo/.../unattended_upgrades/tasks/main.yml:17`, comments beside both | | 2. Re-run `make service-check`, confirm `changed=0 failed=0` | Reported in the body with before/after recaps; not reproducible by this reviewer (see *Could not verify*). The mechanism that produces those numbers is reproduced by hand | | 3. The next 03:15Z run reads `clean` | Pending by design — a future act, waiting on the timer | Scope creep: none. The diff is two comments blocks and two `changed_when` predicates, nothing else. ## Verified by hand - **The mechanism, from the pinned module's own source.** `ansible-core 2.21.5` (the version `mise.toml` pins), `ansible/modules/apt.py:1485` sets `updated_cache = True` when `module.check_mode` and the cache is past `cache_valid_time`; `:1491` exits with `changed=updated_cache` **only** when no `package`/`upgrade`/`deb` is named. That is the PR body's mechanism, line for line. - **Live probe on this host.** `cache/scratch/pr45-apt-probe/play.yml`, `ansible-playbook -i localhost, -c local --check` (core 2.21.5) against a box whose `/var/lib/apt/lists` mtime is 2026-09-04 — stale by three months, the same condition as the ticket: base shape (refresh, no predicate) → `changed: [localhost]`; head shape (`changed_when: false`) → `ok: [localhost]`; firewall shape (`name` + `update_cache`) → `ok: [localhost]`. The fix works, and the body's firewall sentence ("it reports only a change to that package") is true. - **`mise exec -- make check`** at `5b7adb0` in worktree `.worktrees/infra-silo-pr45-r1` → exit 0, `Success! The configuration is valid.` - **The two-task census.** `grep update_cache` over the play finds exactly two refresh-only tasks; the firewall's names a package. The body's `changed=2` is fully accounted for, and no third site was missed. - **No handler is silenced.** `changed_when: false` notifies nothing away: the `silo` role's handlers are notified by its two template tasks, and `unattended_upgrades` has no handlers directory. - **The cross-repo claim.** `olympus/infra-tracker` `main` at `810d648`: both `unattended_upgrades/tasks/main.yml` and `vikunja/tasks/main.yml` carry `changed_when: false`. The body's citation of #66 holds. - **Base is current.** `merge_base` = `base.sha` = `89410e4` = `origin/main` tip; head is one commit ahead; diff is the PR file list, 2 files, +9/-0. - **CI at the head.** `pr-checks / check (pull_request)` success (50s) and `plan / stack-plan-check (pull_request_target)` success (18s), from `get_commit_statuses` on `5b7adb0`. No Stack change → no plan delta to explain. - **Charter classes.** No destroy or replace, no tier-1 config change, no ADR / branch-protection / CI-gate edit; the diff applies nothing, so ADR-0009 is respected. Nothing to escalate. ## Could not verify - **The live before/after recap on Guest 150.** `make service-check` needs `SILO_ROOT_PASSWORD` from the store and a live inventory, and this agent's `make env` refuses by class (`docs/agents/workflow.md` §3). The body's `ok=25 changed=2` → `changed=0` is the author's report; what I reproduced independently is the module behaviour that produces both numbers. - **The 03:15Z audit row reading `clean`** — a later actor's result, pending by design. - **Absence of an apply** — nothing in the diff can apply, which is the strongest available form of that claim. ## Named, not charged - `docs/index.md` lists "A role changes" as a trigger to update `hardening.md`. A role did change, but the Guest's behaviour is identical and nothing `hardening.md` asserts becomes false — no doc update owed. - No automated test covers check-mode `changed` counts. The repo has no Ansible test leg (`docs/agents/workflow.md` §What nothing here checks) and `infra-tracker#66` recorded the same gap and deferred a `--check` leg. Pre-existing, out of this ticket's scope. ## Summary - Standards: 2 findings, both ADVISORY; worst: the missing task reference in the PR body. - Spec: 0 findings. - Blockers: 0. The two advisories travel as advice; the merge recommendation follows the blocker count, not the volume rule.
pit merged commit ae93ce2484 into main 2026-12-03 06:36:40 +00:00
pit deleted branch hermes/127-apt-cache-changed-when 2026-12-03 06:36:40 +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-silo!45
No description provided.