Fix reproducibility of Cloudflare CLI release metadata #355

Merged
nimmo merged 6 commits from fix/cf-release-reproducibility into main 2026-10-17 11:43:06 +01:00
Owner

Vega and Lyra cannot update when npm's cf/latest moves: the accepted lock expects beta.17 metadata but the mutable URL returns another release. Lock the accepted beta.17 metadata at its versioned URL, preserving its NAR hash and dependency source.

Scheduled release updates resolve the dist-tag, validate required metadata and calculate the file's NAR hash with nix hash path before atomically replacing only that lock node. A top-level flake assertion rejects mutable release locks for all outputs, including manual/emergency host builds. CI path filters cover resolver and test changes.

Validation at cdcf28d9b6edb02edacc210bf7a2f024032e51fe:

  • Full nix flake check, ShellCheck, formatting and current-head CI tests pass. Vega/Lyra derivations evaluate; full host builds and live activation have not been performed.
  • Hermetic regressions cover malformed metadata, fetch/hash failures, distinct flat/NAR hashes, repeated resolution and preservation of unrelated lock data. Standalone runs explicitly report skipped controller integration.
  • The flake-pinned nixos-auto-update revision a32a0ba5a1563e10dcc41debfd31424a2020f89c contains src/nixos-update-common.sh; its nixos_update_input_group/LAST_INPUT_CHANGED contract was verified and executed in the regression with the two-input group. The source file and packaged share/nixos-auto-update/nixos-update-common.sh are byte-identical. The controller issues separate four-argument per-input commands.
  • A disposable resolver-written beta.18 metadata lock is accepted by real Nix input evaluation; beta.17's NAR hash matches the accepted lock. A local HTTP fixture confirms mutable URLs are re-fetched.
  • Negative evaluation with an actual latest lock rejects both Vega/Lyra toplevel targets and the updater policy with the guard diagnostic; restoring the versioned lock succeeds.

Current-head review #129 has no demonstrated defect. Its external-contract uncertainty is resolved by the pinned-source/package comparison and executed group regression above; the optional negative-test suggestion is covered by the actual negative evaluation evidence. Remaining comments are assessed in the discussion, with no actionable findings retained.

Closes #354

Vega and Lyra cannot update when npm's `cf/latest` moves: the accepted lock expects beta.17 metadata but the mutable URL returns another release. Lock the accepted beta.17 metadata at its versioned URL, preserving its NAR hash and dependency source. Scheduled release updates resolve the dist-tag, validate required metadata and calculate the file's NAR hash with `nix hash path` before atomically replacing only that lock node. A top-level flake assertion rejects mutable release locks for all outputs, including manual/emergency host builds. CI path filters cover resolver and test changes. Validation at `cdcf28d9b6edb02edacc210bf7a2f024032e51fe`: - Full `nix flake check`, ShellCheck, formatting and current-head CI tests pass. Vega/Lyra derivations evaluate; full host builds and live activation have not been performed. - Hermetic regressions cover malformed metadata, fetch/hash failures, distinct flat/NAR hashes, repeated resolution and preservation of unrelated lock data. Standalone runs explicitly report skipped controller integration. - The flake-pinned nixos-auto-update revision `a32a0ba5a1563e10dcc41debfd31424a2020f89c` contains `src/nixos-update-common.sh`; its `nixos_update_input_group`/`LAST_INPUT_CHANGED` contract was verified and executed in the regression with the two-input group. The source file and packaged `share/nixos-auto-update/nixos-update-common.sh` are byte-identical. The controller issues separate four-argument per-input commands. - A disposable resolver-written beta.18 metadata lock is accepted by real Nix input evaluation; beta.17's NAR hash matches the accepted lock. A local HTTP fixture confirms mutable URLs are re-fetched. - Negative evaluation with an actual `latest` lock rejects both Vega/Lyra toplevel targets and the updater policy with the guard diagnostic; restoring the versioned lock succeeds. Current-head review #129 has no demonstrated defect. Its external-contract uncertainty is resolved by the pinned-source/package comparison and executed group regression above; the optional negative-test suggestion is covered by the actual negative evaluation evidence. Remaining comments are assessed in the discussion, with no actionable findings retained. Closes #354
Fix reproducibility of Cloudflare CLI release metadata
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m32s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 20m47s
4bf106254e
Lock beta.17 metadata at its versioned npm URL and resolve future scheduled releases before candidate validation. Preserve group rollback and cover resolver failures with an isolated flake check.

Refs #354
clankbot left a comment

Automated code review

Reviewed commit: 4bf106254efb1901cd4bf9c1c4d8e3ece5a141d4

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

The supplied change pins the cloudflare-cli-release lock node to a versioned npm metadata URL (cf/1.0.0-beta.17) while leaving the declared input and the lock's original at the mutable dist-tag, adds a resolver that rewrites only that node, routes the shared controller's per-input update through the existing as_user adapter, adds a hermetic nix flake check regression for the resolver, and documents the manual path. I traced the resolver (scripts/update-cloudflare-cli-release.sh), the adapter (scripts/attic-cache-build.sh:763-774), the new regression fixtures, the lock node (flake.lock:73-84), the group policy (lib/auto-update-policy.nix:18-30), the consumer (modules/profiles/cloudflare-cli/default.nix, which reads release.version, release.dist.tarball, release.dist.integrity), and the other nix flake update call sites in the checkout. The resolver's rewrite is node-local and atomic (temp file + mv), its version regex rejects path-traversal values, and the regression test asserts preservation of original, unrelated nodes, repeat resolution, and failure atomicity; I found no defect in the supplied code that breaks evaluation, the group policy, or the rollback contract. The remaining items are guard-rail and coverage gaps: the adapter matches one exact argument form, the 'never lock latest' invariant is comment-only, and the new files are outside the workflow's trigger paths.

Blocking findings

None.

Important findings

None.

Suggestions

  • Adapter intercepts only the exact four-argument form; other update paths still write a mutable latest lock entry (scripts/attic-cache-build.sh:767; medium confidence)
    The guard is [ "$#" -eq 4 ] && [ "$1" = nix ] && [ "$2" = flake ] && [ "$3" = update ] && [ "$4" = cloudflare-cli-release ], so any nix flake update invocation with a flake-ref, flags, or no input name falls through to "$@". scripts/nixos-pin-lifecycle.py:475 runs command([args.nix_bin, "flake", "update", metadata["brokenRevision"]["input"]], cwd=workspace, ...) directly in a standalone clone (created by clone_workspace, never through as_user), and README.md:205-206 documents plain nix flake update as a manual path that 'resets the release URL to mutable latest'. flake.nix:25 still declares url = "file+https://registry.npmjs.org/cf/latest", so such an invocation rewrites the lock node to the dist-tag.
    Impact: A latest entry in locked.url is accepted by nix flake check and by the group policy, so a bypassing path can publish a non-reproducible release input that later fails with a hash mismatch on another host - the failure mode this PR exists to prevent. The protection is procedural, per-call-site, not structural.
    Suggested fix: Make the resolver the single writer for this input rather than a call-site shim: route any update of cloudflare-cli-release (including nixos-pin-lifecycle.py's clone-local update) through scripts/update-cloudflare-cli-release.sh, or add a deterministic guard that rejects a cloudflare-cli-release lock whose locked.url ends in /latest so a mutable entry fails closed instead of being published.

  • 'Never deploy a latest URL' is a comment only; nothing inspects the resulting lock for a versioned URL (flake.nix:23; medium confidence)
    flake.nix:23 states 'Never deploy a latest URL.' while flake.nix:25 declares url = "file+https://registry.npmjs.org/cf/latest" and flake.lock:82 keeps "original": {... "url": "https://registry.npmjs.org/cf/latest"}. The added check at flake.nix:210-225 runs tests/cloudflare-cli-release-regressions.sh, which asserts only resolver behaviour against fixtures (baseline.json's locked.url is cf/old, not cf/latest); no assertion is made over the repository's actual flake.lock.
    Impact: A lock with "url": "https://registry.npmjs.org/cf/latest" passes nix flake check and the group validation, so the invariant stated in the new comment can be silently violated by any path that bypasses the adapter, deferring the breakage to build/activation time on Vega/Lyra.
    Suggested fix: Enforce the invariant instead of documenting it: assert over the checked-in lock (e.g. in the new check, or a small checks.*/lib assertion) that the cloudflare-cli-release node's locked.url matches a versioned form and that original.url remains the dist-tag.

  • New resolver and its regression test are outside the attic-cache workflow's trigger paths (flake.nix:210; medium confidence)
    The new check depends on ./scripts/update-cloudflare-cli-release.sh and ./tests/cloudflare-cli-release-regressions.sh. .forgejo/workflows/attic-cache.yml lists, for both push and pull_request paths, .forgejo/workflows/*.yml, **/*.nix, flake.lock, scripts/attic-cache-build.sh, scripts/auto-update-*.sh, scripts/nixos-update-remediation.py, scripts/nixos_update_remediation/**, scripts/nixos-pin-lifecycle.py, remediation/**, tests/nixos-update-remediation-*, tests/nixos-pin-lifecycle-*, tests/fixtures/nixos-update-remediation/**, scripts/nova-remediation-benchmark.py, benchmarks/nova-remediation/**, tests/nova-remediation-benchmark.sh - none of which match scripts/update-cloudflare-cli-release.sh or tests/cloudflare-cli-release-regressions.sh (the scripts/auto-update-*.sh glob does not match either).
    Impact: A later edit touching only the resolver or its fixtures would not start the attic-cache job, so nix flake check (which runs the new check) and the shellcheck -S warning scripts/*.sh tests/*.sh lint step would not run for that edit; a resolver regression could remain unvalidated until an unrelated path triggers the workflow.
    Suggested fix: Extend the workflow's path filters to cover scripts/update-cloudflare-cli-release.sh and tests/cloudflare-cli-release-regressions.sh, matching the pattern already used for the other updater regression tests.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the pinned nixos-auto-update controller invoke this input as exactly nix flake update cloudflare-cli-release with no additional arguments? nixos-update-common.sh (sourced at scripts/attic-cache-build.sh:781) is not in the checkout, so the adapter's four-argument match is unverified against the real invocation; if the controller passes a flake ref, --no-lockfile, or updates all inputs at once, the adapter never fires.
  • Does the controller parse the invoked command's stdout to decide whether an input changed? The adapter replaces nix flake update's output with the resolver's single line Locked cf release metadata: <version>, which would change any output-based change detection.
  • Can cloudflare-cli-release ever appear as metadata["brokenRevision"]["input"] in scripts/nixos-pin-lifecycle.py, given that path runs nix flake update <input> in a clone that bypasses as_user?

Review limitations

  • The nixos-auto-update package (git+ssh://git.nimmog.uk:2222/nimmo/nixos-auto-update, flake.nix:83) and its share/nixos-auto-update/nixos-update-common.sh are not in the checkout, so the controller's per-input update invocation, candidate snapshotting, and rollback handling are inferred from the adapter comment and the new test rather than read.
  • Nothing was executed: nix flake check, the new checks.x86_64-linux.cloudflare-cli-release, the ShellCheck/treefmt gates, and the resolver's real registry fetch were not run; the claim that the accepted narHash sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo= is unchanged by switching latest to cf/1.0.0-beta.17 is taken from the diff, not verified.
  • Live npm registry state was not queried, so the current cf/latest version and the continued availability of the cf/<version> metadata form are unverified.
  • No host builds, live activation, Attic cache state, CI results, or pull-request discussion were inspected; only the supplied diff and the checked-out files were used.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 1
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `4bf106254efb1901cd4bf9c1c4d8e3ece5a141d4` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment The supplied change pins the `cloudflare-cli-release` lock node to a versioned npm metadata URL (`cf/1.0.0-beta.17`) while leaving the declared input and the lock's `original` at the mutable dist-tag, adds a resolver that rewrites only that node, routes the shared controller's per-input update through the existing `as_user` adapter, adds a hermetic `nix flake check` regression for the resolver, and documents the manual path. I traced the resolver (scripts/update-cloudflare-cli-release.sh), the adapter (scripts/attic-cache-build.sh:763-774), the new regression fixtures, the lock node (flake.lock:73-84), the group policy (lib/auto-update-policy.nix:18-30), the consumer (modules/profiles/cloudflare-cli/default.nix, which reads `release.version`, `release.dist.tarball`, `release.dist.integrity`), and the other `nix flake update` call sites in the checkout. The resolver's rewrite is node-local and atomic (temp file + `mv`), its version regex rejects path-traversal values, and the regression test asserts preservation of `original`, unrelated nodes, repeat resolution, and failure atomicity; I found no defect in the supplied code that breaks evaluation, the group policy, or the rollback contract. The remaining items are guard-rail and coverage gaps: the adapter matches one exact argument form, the 'never lock latest' invariant is comment-only, and the new files are outside the workflow's trigger paths. ### Blocking findings None. ### Important findings None. ### Suggestions - **Adapter intercepts only the exact four-argument form; other update paths still write a mutable `latest` lock entry** (scripts/attic-cache-build.sh:767; medium confidence) The guard is `[ "$#" -eq 4 ] && [ "$1" = nix ] && [ "$2" = flake ] && [ "$3" = update ] && [ "$4" = cloudflare-cli-release ]`, so any `nix flake update` invocation with a flake-ref, flags, or no input name falls through to `"$@"`. `scripts/nixos-pin-lifecycle.py:475` runs `command([args.nix_bin, "flake", "update", metadata["brokenRevision"]["input"]], cwd=workspace, ...)` directly in a standalone clone (created by `clone_workspace`, never through `as_user`), and README.md:205-206 documents plain `nix flake update` as a manual path that 'resets the release URL to mutable `latest`'. flake.nix:25 still declares `url = "file+https://registry.npmjs.org/cf/latest"`, so such an invocation rewrites the lock node to the dist-tag. Impact: A `latest` entry in `locked.url` is accepted by `nix flake check` and by the group policy, so a bypassing path can publish a non-reproducible release input that later fails with a hash mismatch on another host - the failure mode this PR exists to prevent. The protection is procedural, per-call-site, not structural. Suggested fix: Make the resolver the single writer for this input rather than a call-site shim: route any update of `cloudflare-cli-release` (including `nixos-pin-lifecycle.py`'s clone-local update) through `scripts/update-cloudflare-cli-release.sh`, or add a deterministic guard that rejects a `cloudflare-cli-release` lock whose `locked.url` ends in `/latest` so a mutable entry fails closed instead of being published. - **'Never deploy a latest URL' is a comment only; nothing inspects the resulting lock for a versioned URL** (flake.nix:23; medium confidence) flake.nix:23 states 'Never deploy a latest URL.' while flake.nix:25 declares `url = "file+https://registry.npmjs.org/cf/latest"` and flake.lock:82 keeps `"original": {... "url": "https://registry.npmjs.org/cf/latest"}`. The added check at flake.nix:210-225 runs `tests/cloudflare-cli-release-regressions.sh`, which asserts only resolver behaviour against fixtures (`baseline.json`'s `locked.url` is `cf/old`, not `cf/latest`); no assertion is made over the repository's actual `flake.lock`. Impact: A lock with `"url": "https://registry.npmjs.org/cf/latest"` passes `nix flake check` and the group validation, so the invariant stated in the new comment can be silently violated by any path that bypasses the adapter, deferring the breakage to build/activation time on Vega/Lyra. Suggested fix: Enforce the invariant instead of documenting it: assert over the checked-in lock (e.g. in the new check, or a small `checks.*`/`lib` assertion) that the `cloudflare-cli-release` node's `locked.url` matches a versioned form and that `original.url` remains the dist-tag. - **New resolver and its regression test are outside the attic-cache workflow's trigger paths** (flake.nix:210; medium confidence) The new check depends on `./scripts/update-cloudflare-cli-release.sh` and `./tests/cloudflare-cli-release-regressions.sh`. `.forgejo/workflows/attic-cache.yml` lists, for both `push` and `pull_request` paths, `.forgejo/workflows/*.yml`, `**/*.nix`, `flake.lock`, `scripts/attic-cache-build.sh`, `scripts/auto-update-*.sh`, `scripts/nixos-update-remediation.py`, `scripts/nixos_update_remediation/**`, `scripts/nixos-pin-lifecycle.py`, `remediation/**`, `tests/nixos-update-remediation-*`, `tests/nixos-pin-lifecycle-*`, `tests/fixtures/nixos-update-remediation/**`, `scripts/nova-remediation-benchmark.py`, `benchmarks/nova-remediation/**`, `tests/nova-remediation-benchmark.sh` - none of which match `scripts/update-cloudflare-cli-release.sh` or `tests/cloudflare-cli-release-regressions.sh` (the `scripts/auto-update-*.sh` glob does not match either). Impact: A later edit touching only the resolver or its fixtures would not start the attic-cache job, so `nix flake check` (which runs the new check) and the `shellcheck -S warning scripts/*.sh tests/*.sh` lint step would not run for that edit; a resolver regression could remain unvalidated until an unrelated path triggers the workflow. Suggested fix: Extend the workflow's path filters to cover `scripts/update-cloudflare-cli-release.sh` and `tests/cloudflare-cli-release-regressions.sh`, matching the pattern already used for the other updater regression tests. ### Tests and validation - No configured deterministic checks. ### Questions - Does the pinned `nixos-auto-update` controller invoke this input as exactly `nix flake update cloudflare-cli-release` with no additional arguments? `nixos-update-common.sh` (sourced at scripts/attic-cache-build.sh:781) is not in the checkout, so the adapter's four-argument match is unverified against the real invocation; if the controller passes a flake ref, `--no-lockfile`, or updates all inputs at once, the adapter never fires. - Does the controller parse the invoked command's stdout to decide whether an input changed? The adapter replaces `nix flake update`'s output with the resolver's single line `Locked cf release metadata: <version>`, which would change any output-based change detection. - Can `cloudflare-cli-release` ever appear as `metadata["brokenRevision"]["input"]` in `scripts/nixos-pin-lifecycle.py`, given that path runs `nix flake update <input>` in a clone that bypasses `as_user`? ### Review limitations - The `nixos-auto-update` package (`git+ssh://git.nimmog.uk:2222/nimmo/nixos-auto-update`, flake.nix:83) and its `share/nixos-auto-update/nixos-update-common.sh` are not in the checkout, so the controller's per-input update invocation, candidate snapshotting, and rollback handling are inferred from the adapter comment and the new test rather than read. - Nothing was executed: `nix flake check`, the new `checks.x86_64-linux.cloudflare-cli-release`, the ShellCheck/treefmt gates, and the resolver's real registry fetch were not run; the claim that the accepted narHash `sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo=` is unchanged by switching `latest` to `cf/1.0.0-beta.17` is taken from the diff, not verified. - Live npm registry state was not queried, so the current `cf/latest` version and the continued availability of the `cf/<version>` metadata form are unverified. - No host builds, live activation, Attic cache state, CI results, or pull-request discussion were inspected; only the supplied diff and the checked-out files were used. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 1 - Previous automated review: none found - Findings: 3 </details>
Author
Owner

Assessed every advisory suggestion in review #124 against the current code and pinned controller.

Implemented:

  • The release regression flake check now inspects the actual checked-in lock, requires a versioned cf/<semver> locked URL, and preserves the original npm dist-tag. This addresses the overlapping first/second suggestions: update paths that bypass the adapter fail validation rather than publishing a mutable lock.
  • Both push and pull-request workflow path filters now include the resolver and its regression test, so future script-only edits trigger checks.

Controller evidence: inspected the pinned nixos-auto-update nixos-update-common.sh. Its nixos_update_input_group invokes exactly as_user nix flake update "$input" with four arguments, and uses cmp -s against a saved lock to detect changes; stdout is not parsed. The clone-local pin-lifecycle update does bypass this adapter, but it runs flake checks before declaring recovery/publication, so the new lock guard protects that validation path as well.

Validation before this fix push: full nix flake check passes; release-resolution regressions and ShellCheck pass; Actionlint passes for the changed workflow; git whitespace checks pass. In a disposable clone, rewriting the actual locked URL to npm latest makes evaluation of the release check fail with the explicit versioned-URL diagnostic. The accepted beta.17 lock passes. Existing upstream stdenv deprecation warnings are unrelated.

No host activation or merge was performed. The standalone package extraction remains separate and unpublished. Pushing these review fixes next to request a fresh current-head review.

Assessed every advisory suggestion in review #124 against the current code and pinned controller. Implemented: - The release regression flake check now inspects the actual checked-in lock, requires a versioned `cf/<semver>` locked URL, and preserves the `original` npm dist-tag. This addresses the overlapping first/second suggestions: update paths that bypass the adapter fail validation rather than publishing a mutable lock. - Both push and pull-request workflow path filters now include the resolver and its regression test, so future script-only edits trigger checks. Controller evidence: inspected the pinned nixos-auto-update `nixos-update-common.sh`. Its `nixos_update_input_group` invokes exactly `as_user nix flake update "$input"` with four arguments, and uses `cmp -s` against a saved lock to detect changes; stdout is not parsed. The clone-local pin-lifecycle update does bypass this adapter, but it runs flake checks before declaring recovery/publication, so the new lock guard protects that validation path as well. Validation before this fix push: full `nix flake check` passes; release-resolution regressions and ShellCheck pass; Actionlint passes for the changed workflow; git whitespace checks pass. In a disposable clone, rewriting the actual locked URL to npm `latest` makes evaluation of the release check fail with the explicit versioned-URL diagnostic. The accepted beta.17 lock passes. Existing upstream stdenv deprecation warnings are unrelated. No host activation or merge was performed. The standalone package extraction remains separate and unpublished. Pushing these review fixes next to request a fresh current-head review.
Enforce versioned cf metadata locks and CI coverage
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m28s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 16m10s
bf1248e67c
Reject mutable release metadata URLs during flake checks, and trigger CI for resolver-only and regression-only edits. Address the current-head advisory review on MR #355.
clankbot left a comment

Automated code review

Reviewed commit: bf1248e67cb7d285fba3b77f5664f920d82b9812

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

The change makes the cloudflare-cli-release input reproducible: flake.lock re-points the accepted lock node from the mutable cf/latest URL to the versioned cf/1.0.0-beta.17 URL (same narHash, original.url left at the discovery URL), scripts/update-cloudflare-cli-release.sh re-discovers the npm dist-tag via nix store prefetch-file and rewrites only that lock node, the shared controller's as_user wrapper in scripts/attic-cache-build.sh routes nix flake update cloudflare-cli-release through that resolver, and checks.x86_64-linux.cloudflare-cli-release asserts the locked URL is versioned plus runs an isolated, stubbed regression script. I verified the checked-out consumers: modules/profiles/cloudflare-cli/default.nix:6 parses the locked JSON and :75-76 consumes release.dist.tarball and release.dist.integrity, and lib/auto-update-policy.nix:18-21 keeps the release/source pair in one group. The lock edit and the new flake assertion (flake.nix:216-222) match the accepted lock shape in the checked-out flake.lock:73-83. The one defect I can demonstrate from supplied material is a validation gap in the resolver's acceptance predicate; the adapter's arity guard against the external controller's invocation form is not verifiable here (the controller is the pinned nixos-auto-update input, sourced at scripts/attic-cache-build.sh:780) and is therefore reported as a question, not a finding. The initial review's third finding (jq vs Nix lock serialization) is not supported: the checked-out flake.lock uses 2-space indentation and "key": value spacing, which jq's default writer reproduces while preserving key order, so the churn premise is unfounded.

Blocking findings

None.

Important findings

None.

Suggestions

  • Resolver accepts a release document without dist.tarball, which the package build requires (scripts/update-cloudflare-cli-release.sh:17; medium confidence)
    The acceptance predicate is .name == "cf" and .version == $version and (.dist.integrity | type == "string") (scripts/update-cloudflare-cli-release.sh:16-18); dist.tarball is never checked. The checked-out consumer requires it: modules/profiles/cloudflare-cli/default.nix:6 parses the locked document, and :75-76 uses url = release.dist.tarball; hash = release.dist.integrity (plus version = release.version at :73). The regression fixture release.json (tests/cloudflare-cli-release-regressions.sh:26) likewise carries only dist.integrity, so the fixture never exercises the field the build actually needs.
    Impact: A registry document that has an integrity string but no tarball URL passes the resolver and is written into flake.lock, then surfaces later as an evaluation/build failure of the cloudflare-cli package rather than as a resolver failure; the controller would classify it as a rejected candidate instead of a failed input update, and the unusable lock is published/attempted once per run.
    Suggested fix: Tighten the acceptance predicate to require both (.dist.tarball | type == "string") and (.dist.integrity | type == "string") (and keep the existing atomicity path so the lock stays untouched), and add a fixture release document carrying dist.tarball so the test covers the field the module consumes.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does nixos_update_run_input_groups (from the pinned external nixos-auto-update package, sourced at scripts/attic-cache-build.sh:780 and not present in this repository) invoke as_user nix flake update <single-input> per input, or one combined nix flake update call for the whole cloudflare-cli group declared in lib/auto-update-policy.nix:18-21? The adapter guard at scripts/attic-cache-build.sh:767-769 matches only the exact four-argument form, so a multi-input or flagged invocation would fall through to plain nix flake update and re-lock the mutable latest URL, which the new assertion at flake.nix:216-222 then rejects.
  • Should the resolver also verify or refresh cloudflare-cli-source, or is the group policy the only intended path? README.md:204-208 now documents running the helper and nix flake update cloudflare-cli-source as two manual steps, which an operator can perform out of order or skip.

Review limitations

  • The pinned external controller is not part of this repository: nixos-update-common.sh, nixos_update_run_input_groups, and the group rollback/publication logic come from the nixos-auto-update flake input (flake.nix:83) and were not supplied, so the adapter's invocation contract and rollback interaction cannot be verified here.
  • No live evaluation, build, or activation evidence was supplied: nix flake check, the Vega/Lyra toplevel evaluations, ShellCheck, and the new regressions are reported as passing in the pull-request text only; I did not execute repository code or run Nix tooling.
  • The resolver's assumptions about nix store prefetch-file --json output fields (.storePath, .hash) are exercised only by the test's stubbed nix fixture (tests/cloudflare-cli-release-regressions.sh:10-19); real npm registry and CLI output was not supplied.
  • Full host builds and live activation were not performed, so the effect of a beta.18 lock on the actual Vega/Lyra closures, including the dependency-manifest skew check in modules/profiles/cloudflare-cli/default.nix, is unverified.
  • The flake.lock entry for cloudflare-cli-release was inspected only in the checked-out head state (flake.lock:73-83); the base-branch lock and the history that produced it were not supplied, so preservation of the accepted narHash is taken from the supplied diff.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 2
  • Previous automated review: none found
  • Findings: 1
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `bf1248e67cb7d285fba3b77f5664f920d82b9812` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment The change makes the `cloudflare-cli-release` input reproducible: `flake.lock` re-points the accepted lock node from the mutable `cf/latest` URL to the versioned `cf/1.0.0-beta.17` URL (same narHash, `original.url` left at the discovery URL), `scripts/update-cloudflare-cli-release.sh` re-discovers the npm dist-tag via `nix store prefetch-file` and rewrites only that lock node, the shared controller's `as_user` wrapper in `scripts/attic-cache-build.sh` routes `nix flake update cloudflare-cli-release` through that resolver, and `checks.x86_64-linux.cloudflare-cli-release` asserts the locked URL is versioned plus runs an isolated, stubbed regression script. I verified the checked-out consumers: `modules/profiles/cloudflare-cli/default.nix:6` parses the locked JSON and `:75-76` consumes `release.dist.tarball` and `release.dist.integrity`, and `lib/auto-update-policy.nix:18-21` keeps the release/source pair in one group. The lock edit and the new flake assertion (`flake.nix:216-222`) match the accepted lock shape in the checked-out `flake.lock:73-83`. The one defect I can demonstrate from supplied material is a validation gap in the resolver's acceptance predicate; the adapter's arity guard against the external controller's invocation form is not verifiable here (the controller is the pinned `nixos-auto-update` input, sourced at `scripts/attic-cache-build.sh:780`) and is therefore reported as a question, not a finding. The initial review's third finding (jq vs Nix lock serialization) is not supported: the checked-out `flake.lock` uses 2-space indentation and `"key": value` spacing, which jq's default writer reproduces while preserving key order, so the churn premise is unfounded. ### Blocking findings None. ### Important findings None. ### Suggestions - **Resolver accepts a release document without `dist.tarball`, which the package build requires** (scripts/update-cloudflare-cli-release.sh:17; medium confidence) The acceptance predicate is `.name == "cf" and .version == $version and (.dist.integrity | type == "string")` (scripts/update-cloudflare-cli-release.sh:16-18); `dist.tarball` is never checked. The checked-out consumer requires it: modules/profiles/cloudflare-cli/default.nix:6 parses the locked document, and :75-76 uses `url = release.dist.tarball; hash = release.dist.integrity` (plus `version = release.version` at :73). The regression fixture release.json (tests/cloudflare-cli-release-regressions.sh:26) likewise carries only `dist.integrity`, so the fixture never exercises the field the build actually needs. Impact: A registry document that has an integrity string but no tarball URL passes the resolver and is written into flake.lock, then surfaces later as an evaluation/build failure of the cloudflare-cli package rather than as a resolver failure; the controller would classify it as a rejected candidate instead of a failed input update, and the unusable lock is published/attempted once per run. Suggested fix: Tighten the acceptance predicate to require both `(.dist.tarball | type == "string")` and `(.dist.integrity | type == "string")` (and keep the existing atomicity path so the lock stays untouched), and add a fixture release document carrying `dist.tarball` so the test covers the field the module consumes. ### Tests and validation - No configured deterministic checks. ### Questions - Does `nixos_update_run_input_groups` (from the pinned external `nixos-auto-update` package, sourced at scripts/attic-cache-build.sh:780 and not present in this repository) invoke `as_user nix flake update <single-input>` per input, or one combined `nix flake update` call for the whole `cloudflare-cli` group declared in lib/auto-update-policy.nix:18-21? The adapter guard at scripts/attic-cache-build.sh:767-769 matches only the exact four-argument form, so a multi-input or flagged invocation would fall through to plain `nix flake update` and re-lock the mutable `latest` URL, which the new assertion at flake.nix:216-222 then rejects. - Should the resolver also verify or refresh `cloudflare-cli-source`, or is the group policy the only intended path? README.md:204-208 now documents running the helper and `nix flake update cloudflare-cli-source` as two manual steps, which an operator can perform out of order or skip. ### Review limitations - The pinned external controller is not part of this repository: `nixos-update-common.sh`, `nixos_update_run_input_groups`, and the group rollback/publication logic come from the `nixos-auto-update` flake input (flake.nix:83) and were not supplied, so the adapter's invocation contract and rollback interaction cannot be verified here. - No live evaluation, build, or activation evidence was supplied: `nix flake check`, the Vega/Lyra toplevel evaluations, ShellCheck, and the new regressions are reported as passing in the pull-request text only; I did not execute repository code or run Nix tooling. - The resolver's assumptions about `nix store prefetch-file --json` output fields (`.storePath`, `.hash`) are exercised only by the test's stubbed `nix` fixture (tests/cloudflare-cli-release-regressions.sh:10-19); real npm registry and CLI output was not supplied. - Full host builds and live activation were not performed, so the effect of a beta.18 lock on the actual Vega/Lyra closures, including the dependency-manifest skew check in modules/profiles/cloudflare-cli/default.nix, is unverified. - The `flake.lock` entry for `cloudflare-cli-release` was inspected only in the checked-out head state (flake.lock:73-83); the base-branch lock and the history that produced it were not supplied, so preservation of the accepted narHash is taken from the supplied diff. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 2 - Previous automated review: none found - Findings: 1 </details>
Author
Owner

Review #125's tarball validation suggestion is valid and is addressed before this next push. The resolver now requires non-empty string values for both dist.tarball and dist.integrity. The successful fixture carries the tarball URL consumed by the package, and rejection cases cover a missing tarball, empty tarball, empty integrity, and mismatched version while asserting the existing lock remains byte-for-byte unchanged.

Validation: full nix flake check passes, the expanded release regressions pass, ShellCheck and formatting/whitespace checks pass. A disposable real-registry resolution still succeeds and selects the versioned beta.18 metadata URL; the accepted repository lock remains beta.17.

The controller questions are covered by the evidence in the previous comment: the pinned controller updates single inputs through the exact four-argument adapter and compares lock contents, not stdout. The helper intentionally resolves only its own input; the shared release/source group owns pair updates and rollback, with package dependency-manifest validation rejecting incompatible pairs. The documented manual path performs both steps. No additional source update belongs inside this single-input adapter.

No merge or activation was performed. The standalone package has since been published separately, under explicit user authorization, at https://forge.nimmog.uk/nimmo/cloudflare-cli.nix; its consumer integration remains separate. Pushing these validated review fixes next for a fresh current-head review.

Review #125's tarball validation suggestion is valid and is addressed before this next push. The resolver now requires non-empty string values for both `dist.tarball` and `dist.integrity`. The successful fixture carries the tarball URL consumed by the package, and rejection cases cover a missing tarball, empty tarball, empty integrity, and mismatched version while asserting the existing lock remains byte-for-byte unchanged. Validation: full `nix flake check` passes, the expanded release regressions pass, ShellCheck and formatting/whitespace checks pass. A disposable real-registry resolution still succeeds and selects the versioned beta.18 metadata URL; the accepted repository lock remains beta.17. The controller questions are covered by the evidence in the previous comment: the pinned controller updates single inputs through the exact four-argument adapter and compares lock contents, not stdout. The helper intentionally resolves only its own input; the shared release/source group owns pair updates and rollback, with package dependency-manifest validation rejecting incompatible pairs. The documented manual path performs both steps. No additional source update belongs inside this single-input adapter. No merge or activation was performed. The standalone package has since been published separately, under explicit user authorization, at https://forge.nimmog.uk/nimmo/cloudflare-cli.nix; its consumer integration remains separate. Pushing these validated review fixes next for a fresh current-head review.
Validate cf tarball metadata before changing the lock
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m28s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 23m16s
f3e0263595
Require non-empty tarball and integrity strings. Exercise complete release metadata and verify malformed documents preserve the existing lock. Address advisory review #125 on MR #355.
clankbot left a comment

Automated code review

Reviewed commit: f3e0263595d57968e07112d6672acd1f2aa18ef3

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The supplied changes are internally consistent: the resolver in scripts/update-cloudflare-cli-release.sh rewrites only the cloudflare-cli-release node's locked object (preserving original.url, which matches the committed flake.lock at line 79), the version regexes in the resolver and in the new flake.nix assertion agree, and the committed lock (https://registry.npmjs.org/cf/1.0.0-beta.17) satisfies the assertion. I traced the controller path: scripts/attic-cache-build.sh defines as_user at line 763 before sourcing the packaged nixos-update-common.sh, and that sourced file does not redefine as_user (its own definition lives in nixos-auto-update.sh, which the repository controller does not source), so the adapter is effective; the group runner calls as_user nix flake update "$input" (four arguments), which the adapter matches, and its non-zero status feeds the existing before_lock restore, so a failed resolution leaves flake.lock untouched - which is what the new regression suite asserts. The remaining gap is that the versioned-URL invariant is enforced only by the new flake.nix assertion, and the resolver is installed only in this repository's controller.

Blocking findings

None.

Important findings

  • The new versioned-URL gate can be triggered by a lock produced outside the repository's controller, and CI cannot self-heal it (flake.nix:218; medium confidence)
    The resolver is installed by overriding as_user only in scripts/attic-cache-build.sh (lines 763-773). The pinned nixos-auto-update package supplies its own as_user (runuser -u "$USER" -- env PATH="$PATH" "$@", src/nixos-auto-update.sh:86) and its full-update path calls nixos_update_run_input_groups (src/nixos-auto-update.sh:777), which reaches as_user nix flake update "$input" (src/nixos-update-common.sh:216) with no adapter; that path is documented in the same package as reachable: 'retained for manual/emergency use only ... when CI is unavailable and a flake.lock update must be produced locally' (src/nixos-auto-update.sh:755-761). Validation on that path is nixos_update_validate_candidate → build_hosts (src/nixos-update-common.sh:295-313); no nix flake check is run there, so the new assertion at flake.nix:210-222 does not guard it. In .forgejo/workflows/attic-cache.yml the test job runs nix flake check and the build job that performs the update is needs: test, so a latest URL reaching main fails the gate before any update path runs.
    Impact: A manual/emergency full update on a host can publish a mutable latest cf release URL to main; the next scheduled CI run then fails at the test job and never reaches the update path, blocking the Attic build and the pull-only fleet until someone runs scripts/update-cloudflare-cli-release.sh by hand. The new regression suite does not cover that path.
    Suggested fix: Make the gate self-healing or close the gap: run bash scripts/update-cloudflare-cli-release.sh in the CI test job before nix flake check, or expose the resolver as a hook the shared group runner honours so the package's own full-update path resolves dist-tags too, or have that path refuse to publish a non-versioned release URL.

Suggestions

  • New regression script is committed non-executable, unlike the repo's directly-executed tests (tests/cloudflare-cli-release-regressions.sh:1; medium confidence)
    The diff records new file mode 100644 for tests/cloudflare-cli-release-regressions.sh, and it is invoked only as bash tests/cloudflare-cli-release-regressions.sh (flake.nix:232). The repository's existing convention is direct execution: .forgejo/workflows/attic-cache.yml runs ./tests/nixos-update-remediation-regressions.sh and ./tests/nixos-pin-lifecycle-regressions.sh.
    Impact: An operator following the surrounding documentation cannot run ./tests/cloudflare-cli-release-regressions.sh; the suite is reachable only through nix flake check. This is a consistency/usability gap, not an evaluation failure.
    Suggested fix: Commit the script as mode 0755 to match the other tests/*.sh, or state in README that this suite runs only via nix flake check.

Tests and validation

  • No configured deterministic checks.

Questions

  • Should the CI test job invoke scripts/update-cloudflare-cli-release.sh before nix flake check so that a mutable latest release URL reaching main is repaired automatically, given that the build job is gated on needs: test?
  • Is the pinned package's manual/emergency full-update path expected to remain able to publish a non-versioned cf release URL, or is it out of scope because every host is pull-only in normal operation?
  • Should the resolver also assert that .dist.tarball and .dist.integrity correspond to the resolved version string, rather than only that they are non-empty (scripts/update-cloudflare-cli-release.sh:18-20)?

Review limitations

  • I did not run nix flake check, shellcheck, treefmt/shfmt, or any regression suite; the evaluation and formatting claims were not reproduced. In particular I did not verify that the new shell files are shfmt-clean under treefmt.nix, nor that the source <(sed -n ...) extraction idiom in the new test behaves as intended under the environment's sed (the same idiom already appears in tests/nixos-update-remediation-regressions.sh:121).
  • The nixos-auto-update controller code I inspected came from Nix store paths present in this checkout (including a *-source copy); I could not confirm which copy corresponds to the flake-locked revision, so line numbers in that package may differ.
  • No live registry resolution was performed: I cannot confirm the preserved narHash matches the content served at https://registry.npmjs.org/cf/1.0.0-beta.17, nor that jq's whole-file rewrite of flake.lock is byte-identical to Nix's lock writer (I only checked the committed file for non-ASCII characters and empty containers, of which there are none).
  • I have no access to the pull-request discussion, issue #354, or prior advisory reviews beyond the text supplied here.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 3
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `f3e0263595d57968e07112d6672acd1f2aa18ef3` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The supplied changes are internally consistent: the resolver in scripts/update-cloudflare-cli-release.sh rewrites only the cloudflare-cli-release node's `locked` object (preserving `original.url`, which matches the committed flake.lock at line 79), the version regexes in the resolver and in the new flake.nix assertion agree, and the committed lock (https://registry.npmjs.org/cf/1.0.0-beta.17) satisfies the assertion. I traced the controller path: scripts/attic-cache-build.sh defines `as_user` at line 763 before sourcing the packaged nixos-update-common.sh, and that sourced file does not redefine `as_user` (its own definition lives in nixos-auto-update.sh, which the repository controller does not source), so the adapter is effective; the group runner calls `as_user nix flake update "$input"` (four arguments), which the adapter matches, and its non-zero status feeds the existing `before_lock` restore, so a failed resolution leaves flake.lock untouched - which is what the new regression suite asserts. The remaining gap is that the versioned-URL invariant is enforced only by the new flake.nix assertion, and the resolver is installed only in this repository's controller. ### Blocking findings None. ### Important findings - **The new versioned-URL gate can be triggered by a lock produced outside the repository's controller, and CI cannot self-heal it** (flake.nix:218; medium confidence) The resolver is installed by overriding `as_user` only in scripts/attic-cache-build.sh (lines 763-773). The pinned nixos-auto-update package supplies its own `as_user` (`runuser -u "$USER" -- env PATH="$PATH" "$@"`, src/nixos-auto-update.sh:86) and its full-update path calls `nixos_update_run_input_groups` (src/nixos-auto-update.sh:777), which reaches `as_user nix flake update "$input"` (src/nixos-update-common.sh:216) with no adapter; that path is documented in the same package as reachable: 'retained for manual/emergency use only ... when CI is unavailable and a flake.lock update must be produced locally' (src/nixos-auto-update.sh:755-761). Validation on that path is `nixos_update_validate_candidate` → `build_hosts` (src/nixos-update-common.sh:295-313); no `nix flake check` is run there, so the new assertion at flake.nix:210-222 does not guard it. In .forgejo/workflows/attic-cache.yml the `test` job runs `nix flake check` and the `build` job that performs the update is `needs: test`, so a `latest` URL reaching main fails the gate before any update path runs. Impact: A manual/emergency full update on a host can publish a mutable `latest` cf release URL to main; the next scheduled CI run then fails at the `test` job and never reaches the update path, blocking the Attic build and the pull-only fleet until someone runs scripts/update-cloudflare-cli-release.sh by hand. The new regression suite does not cover that path. Suggested fix: Make the gate self-healing or close the gap: run `bash scripts/update-cloudflare-cli-release.sh` in the CI `test` job before `nix flake check`, or expose the resolver as a hook the shared group runner honours so the package's own full-update path resolves dist-tags too, or have that path refuse to publish a non-versioned release URL. ### Suggestions - **New regression script is committed non-executable, unlike the repo's directly-executed tests** (tests/cloudflare-cli-release-regressions.sh:1; medium confidence) The diff records `new file mode 100644` for tests/cloudflare-cli-release-regressions.sh, and it is invoked only as `bash tests/cloudflare-cli-release-regressions.sh` (flake.nix:232). The repository's existing convention is direct execution: .forgejo/workflows/attic-cache.yml runs `./tests/nixos-update-remediation-regressions.sh` and `./tests/nixos-pin-lifecycle-regressions.sh`. Impact: An operator following the surrounding documentation cannot run `./tests/cloudflare-cli-release-regressions.sh`; the suite is reachable only through `nix flake check`. This is a consistency/usability gap, not an evaluation failure. Suggested fix: Commit the script as mode 0755 to match the other tests/*.sh, or state in README that this suite runs only via `nix flake check`. ### Tests and validation - No configured deterministic checks. ### Questions - Should the CI `test` job invoke scripts/update-cloudflare-cli-release.sh before `nix flake check` so that a mutable `latest` release URL reaching main is repaired automatically, given that the `build` job is gated on `needs: test`? - Is the pinned package's manual/emergency full-update path expected to remain able to publish a non-versioned cf release URL, or is it out of scope because every host is pull-only in normal operation? - Should the resolver also assert that `.dist.tarball` and `.dist.integrity` correspond to the resolved version string, rather than only that they are non-empty (scripts/update-cloudflare-cli-release.sh:18-20)? ### Review limitations - I did not run `nix flake check`, shellcheck, treefmt/shfmt, or any regression suite; the evaluation and formatting claims were not reproduced. In particular I did not verify that the new shell files are shfmt-clean under treefmt.nix, nor that the `source <(sed -n ...)` extraction idiom in the new test behaves as intended under the environment's sed (the same idiom already appears in tests/nixos-update-remediation-regressions.sh:121). - The nixos-auto-update controller code I inspected came from Nix store paths present in this checkout (including a `*-source` copy); I could not confirm which copy corresponds to the flake-locked revision, so line numbers in that package may differ. - No live registry resolution was performed: I cannot confirm the preserved narHash matches the content served at https://registry.npmjs.org/cf/1.0.0-beta.17, nor that jq's whole-file rewrite of flake.lock is byte-identical to Nix's lock writer (I only checked the committed file for non-ASCII characters and empty containers, of which there are none). - I have no access to the pull-request discussion, issue #354, or prior advisory reviews beyond the text supplied here. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 3 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Review #126's manual/emergency path finding is valid. Verified the exact flake-locked nixos-auto-update source: src/nixos-auto-update.sh retains that path and src/nixos-update-common.sh:nixos_update_validate_candidate calls host builds without flake checks.

Implemented a fail-closed fix: moved the versioned release-lock assertion from the individual check to the top level of outputs. All output evaluation, including host build targets and lib.autoUpdatePolicy, now rejects a mutable metadata URL. The manual updater therefore cannot validate/publish that candidate. CI tests do not silently refresh the release/source pair. README explains the broader guard. Also addressed the executable-mode suggestion: both resolver and regression script are now mode 0755, and direct regression execution passes.

Validation before push: full nix flake check passes; ShellCheck and direct release regressions pass; formatting and whitespace checks pass. A disposable clone with the actual locked URL changed to latest rejects evaluation of both Vega and Lyra toplevel derivation paths and the updater policy with the explicit guard diagnostic. Restoring the accepted versioned lock permits policy evaluation again.

The tarball/integrity pair comes from the version-specific registry document after exact .version matching; the package's fixed-output fetch verifies the fetched tarball against that integrity. No further metadata inference is needed for this repair. No merge or host activation was performed. Pushing these reviewed fixes next for a fresh current-head review.

Review #126's manual/emergency path finding is valid. Verified the exact flake-locked nixos-auto-update source: `src/nixos-auto-update.sh` retains that path and `src/nixos-update-common.sh:nixos_update_validate_candidate` calls host builds without flake checks. Implemented a fail-closed fix: moved the versioned release-lock assertion from the individual check to the top level of `outputs`. All output evaluation, including host build targets and `lib.autoUpdatePolicy`, now rejects a mutable metadata URL. The manual updater therefore cannot validate/publish that candidate. CI tests do not silently refresh the release/source pair. README explains the broader guard. Also addressed the executable-mode suggestion: both resolver and regression script are now mode 0755, and direct regression execution passes. Validation before push: full `nix flake check` passes; ShellCheck and direct release regressions pass; formatting and whitespace checks pass. A disposable clone with the actual locked URL changed to `latest` rejects evaluation of both Vega and Lyra toplevel derivation paths and the updater policy with the explicit guard diagnostic. Restoring the accepted versioned lock permits policy evaluation again. The tarball/integrity pair comes from the version-specific registry document after exact `.version` matching; the package's fixed-output fetch verifies the fetched tarball against that integrity. No further metadata inference is needed for this repair. No merge or host activation was performed. Pushing these reviewed fixes next for a fresh current-head review.
Reject mutable cf locks for every flake output
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m30s
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 24m43s
7c123740b9
Protect manual/emergency updater host builds as well as flake checks, and make the resolver and its regression script directly executable. Address review #126 on MR #355.
clankbot left a comment

Automated code review

Reviewed commit: 7c123740b903675f9c1c0df5cdd23863908a91d7

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The change makes the cloudflare-cli-release input reproducible: flake.lock pins beta.17 metadata at its versioned npm URL, scripts/update-cloudflare-cli-release.sh re-resolves the current published version and rewrites only that lock node, scripts/attic-cache-build.sh routes the controller's per-input update through that resolver inside as_user, and a top-level assertMsg in flake.nix rejects any lock whose release URL is not versioned (plus an original.url that is not the discovery URL). I verified the assert against the committed lock: flake.lock:73-81 records original.url as https://registry.npmjs.org/cf/latest (no file+ prefix) and locked.url as https://registry.npmjs.org/cf/1.0.0-beta.17, which the assert's fully-anchored regex accepts, so the committed state evaluates. The regression script is not vacuous: its first positive case would fail if the adapter did not route (the stub nix rejects any argv other than store prefetch-file --json), and it checks idempotency, preservation of original and unrelated nodes, and several malformed-metadata cases leaving the lock unchanged. CI runs both nix flake check (which evaluates the assert and the new checks.x86_64-linux.cloudflare-cli-release) and shellcheck -S warning scripts/*.sh tests/*.sh, and the widened path filters cover both new scripts. I found no defect that is demonstrably wrong in the supplied code; the two residual risks are couplings to code that is not in the checkout (the pinned nixos-auto-update controller's nix flake update argument form, reached via nixos_update_run_input_groups at scripts/attic-cache-build.sh:961, and the JSON contract of nix store prefetch-file).

Blocking findings

None.

Important findings

  • Adapter routes only one exact argv shape; any other form silently falls through to plain nix flake update, which the new assert then rejects (scripts/attic-cache-build.sh:767; medium confidence)
    The routing guard is [ "$#" -eq 4 ] && [ "$1" = nix ] && [ "$2" = flake ] && [ "$3" = update ] && [ "$4" = cloudflare-cli-release ] with else "$@" (scripts/attic-cache-build.sh:767-772). as_user is defined only here and is never called in this file; it is consumed by the externally sourced controller (. "$auto_update_package/share/nixos-auto-update/nixos-update-common.sh", then nixos_update_run_input_groups at line 961), and that package is not in the checkout (it is the pinned git input nixos-auto-update, flake.lock:488). lib/auto-update-policy.nix:18-22 declares one group cloudflare-cli with two inputs, cloudflare-cli-release and cloudflare-cli-source, so the controller is expected to issue more than one update request per group. The only invocation form exercised by the new test is the 4-argument one (tests/cloudflare-cli-release-regressions.sh:39).
    Impact: If the controller ever issues the release update with additional flags, or with both group inputs in a single invocation (5 arguments), the guard falls through to plain nix flake update, which locks the mutable latest URL; the new flake.nix assert then fails for every host build, so the cloudflare-cli group can never be accepted and each scheduled run reports a held group instead of a routing error. The condition is not provable from the supplied files, but the silent fall-through is unconditional in the changed code: nothing here fails loudly when cloudflare-cli-release is requested and not routed.
    Suggested fix: Match on the input name anywhere in a nix flake update argument list rather than on the exact argument count, or add a guard that fails loudly when cloudflare-cli-release appears in the requested inputs but was not routed, converting the fall-through into a reported failure. Add a regression case for the group form the pinned controller actually emits.

Suggestions

  • The narHash written by the resolver is taken from an unverified field of nix store prefetch-file --json, and no supplied evidence shows a resolver-produced lock being accepted by Nix (scripts/update-cloudflare-cli-release.sh:21; medium confidence)
    hash=$(jq -er '.hash | select(type == "string")' <<<"$release") is written as narHash (scripts/update-cloudflare-cli-release.sh:21,26-28). The only supplied exercise of that command is the stub in tests/cloudflare-cli-release-regressions.sh:12-19, which fabricates exactly the fields the resolver reads ({storePath: ..., hash: "sha256-test"}), so the test cannot detect a field-name or hash-representation mismatch. The committed flake.lock diff changes only locked.url and keeps the previous narHash (sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo=), so no supplied evidence shows a lock actually produced by this resolver being accepted by Nix.
    Impact: A field-name or hash-representation mismatch would either abort the resolver (jq -e, so the scheduled cf update never resolves and the group is always held) or write a lock that the next evaluation rejects, which the new assert turns into a hard failure for all host builds. Both are fleet-affecting and would only be caught by a real evaluation, which the hermetic regression deliberately cannot perform.
    Suggested fix: Extend the real-registry proof so the lock written by the resolver is fed back into Nix (e.g. evaluate the cloudflare-cli-release input or run nix flake check after the helper has written the candidate), or derive the hash from Nix's own resolution rather than from a hand-picked JSON field.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the pinned nixos-auto-update controller (nixos-update-common.sh, not in this checkout) invoke as_user nix flake update <input> with exactly four arguments per input, for every input in the cloudflare-cli group? The adapter's behaviour depends on that shape.
  • What are the actual output fields of nix store prefetch-file --json in the pinned Nix version, and is its hash the value Nix records as narHash for a file+https input? The supplied fixture cannot answer this.
  • Does nix store prefetch-file re-fetch https://registry.npmjs.org/cf/latest, or return an existing store path for that mutable URL? If it serves a cached store path, the version discovery in scripts/update-cloudflare-cli-release.sh:7-8 would be stale rather than current.
  • Was the committed beta.17 lock produced by running scripts/update-cloudflare-cli-release.sh and then accepted by nix flake check, or was flake.lock edited by hand? The diff keeps the previous narHash while changing only the URL, so its acceptance depends on the latest and versioned registry documents being byte-identical.

Review limitations

  • I executed nothing: nix flake check, ShellCheck, the resolver, and the regression script were not run; all validation claims come from reading the supplied diff and the checked-out files.
  • The pinned nixos-auto-update package (nixos-update-common.sh, nixos_update_run_input_groups, candidate snapshot/rollback and publication policy) is not in the checkout, so the controller's actual nix flake update invocation form and its interaction with the adapter could not be inspected.
  • No network access: the npm registry behaviour of https://registry.npmjs.org/cf/<version> and the current latest dist-tag could not be verified, nor the JSON schema or hash output of nix store prefetch-file.
  • No host builds, just test, or live activation were performed; the assert's effect on host builds is inferred from its placement in the flake body, not observed.
  • I did not evaluate unchanged code beyond the callers and definitions needed to assess the changed lines (e.g. modules/profiles/cloudflare-cli/default.nix reads inputs.cloudflare-cli-release as JSON), and I make no claim about behaviour outside the supplied files.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 4
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `7c123740b903675f9c1c0df5cdd23863908a91d7` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The change makes the `cloudflare-cli-release` input reproducible: `flake.lock` pins beta.17 metadata at its versioned npm URL, `scripts/update-cloudflare-cli-release.sh` re-resolves the current published version and rewrites only that lock node, `scripts/attic-cache-build.sh` routes the controller's per-input update through that resolver inside `as_user`, and a top-level `assertMsg` in `flake.nix` rejects any lock whose release URL is not versioned (plus an `original.url` that is not the discovery URL). I verified the assert against the committed lock: `flake.lock:73-81` records `original.url` as `https://registry.npmjs.org/cf/latest` (no `file+` prefix) and `locked.url` as `https://registry.npmjs.org/cf/1.0.0-beta.17`, which the assert's fully-anchored regex accepts, so the committed state evaluates. The regression script is not vacuous: its first positive case would fail if the adapter did not route (the stub `nix` rejects any argv other than `store prefetch-file --json`), and it checks idempotency, preservation of `original` and unrelated nodes, and several malformed-metadata cases leaving the lock unchanged. CI runs both `nix flake check` (which evaluates the assert and the new `checks.x86_64-linux.cloudflare-cli-release`) and `shellcheck -S warning scripts/*.sh tests/*.sh`, and the widened path filters cover both new scripts. I found no defect that is demonstrably wrong in the supplied code; the two residual risks are couplings to code that is not in the checkout (the pinned `nixos-auto-update` controller's `nix flake update` argument form, reached via `nixos_update_run_input_groups` at `scripts/attic-cache-build.sh:961`, and the JSON contract of `nix store prefetch-file`). ### Blocking findings None. ### Important findings - **Adapter routes only one exact argv shape; any other form silently falls through to plain `nix flake update`, which the new assert then rejects** (scripts/attic-cache-build.sh:767; medium confidence) The routing guard is `[ "$#" -eq 4 ] && [ "$1" = nix ] && [ "$2" = flake ] && [ "$3" = update ] && [ "$4" = cloudflare-cli-release ]` with `else "$@"` (scripts/attic-cache-build.sh:767-772). `as_user` is defined only here and is never called in this file; it is consumed by the externally sourced controller (`. "$auto_update_package/share/nixos-auto-update/nixos-update-common.sh"`, then `nixos_update_run_input_groups` at line 961), and that package is not in the checkout (it is the pinned git input `nixos-auto-update`, flake.lock:488). `lib/auto-update-policy.nix:18-22` declares one group `cloudflare-cli` with two inputs, `cloudflare-cli-release` and `cloudflare-cli-source`, so the controller is expected to issue more than one update request per group. The only invocation form exercised by the new test is the 4-argument one (tests/cloudflare-cli-release-regressions.sh:39). Impact: If the controller ever issues the release update with additional flags, or with both group inputs in a single invocation (5 arguments), the guard falls through to plain `nix flake update`, which locks the mutable `latest` URL; the new `flake.nix` assert then fails for every host build, so the `cloudflare-cli` group can never be accepted and each scheduled run reports a held group instead of a routing error. The condition is not provable from the supplied files, but the silent fall-through is unconditional in the changed code: nothing here fails loudly when `cloudflare-cli-release` is requested and not routed. Suggested fix: Match on the input name anywhere in a `nix flake update` argument list rather than on the exact argument count, or add a guard that fails loudly when `cloudflare-cli-release` appears in the requested inputs but was not routed, converting the fall-through into a reported failure. Add a regression case for the group form the pinned controller actually emits. ### Suggestions - **The `narHash` written by the resolver is taken from an unverified field of `nix store prefetch-file --json`, and no supplied evidence shows a resolver-produced lock being accepted by Nix** (scripts/update-cloudflare-cli-release.sh:21; medium confidence) `hash=$(jq -er '.hash | select(type == "string")' <<<"$release")` is written as `narHash` (scripts/update-cloudflare-cli-release.sh:21,26-28). The only supplied exercise of that command is the stub in tests/cloudflare-cli-release-regressions.sh:12-19, which fabricates exactly the fields the resolver reads (`{storePath: ..., hash: "sha256-test"}`), so the test cannot detect a field-name or hash-representation mismatch. The committed `flake.lock` diff changes only `locked.url` and keeps the previous `narHash` (`sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo=`), so no supplied evidence shows a lock actually produced by this resolver being accepted by Nix. Impact: A field-name or hash-representation mismatch would either abort the resolver (`jq -e`, so the scheduled cf update never resolves and the group is always held) or write a lock that the next evaluation rejects, which the new assert turns into a hard failure for all host builds. Both are fleet-affecting and would only be caught by a real evaluation, which the hermetic regression deliberately cannot perform. Suggested fix: Extend the real-registry proof so the lock written by the resolver is fed back into Nix (e.g. evaluate the `cloudflare-cli-release` input or run `nix flake check` after the helper has written the candidate), or derive the hash from Nix's own resolution rather than from a hand-picked JSON field. ### Tests and validation - No configured deterministic checks. ### Questions - Does the pinned `nixos-auto-update` controller (`nixos-update-common.sh`, not in this checkout) invoke `as_user nix flake update <input>` with exactly four arguments per input, for every input in the `cloudflare-cli` group? The adapter's behaviour depends on that shape. - What are the actual output fields of `nix store prefetch-file --json` in the pinned Nix version, and is its `hash` the value Nix records as `narHash` for a `file+https` input? The supplied fixture cannot answer this. - Does `nix store prefetch-file` re-fetch `https://registry.npmjs.org/cf/latest`, or return an existing store path for that mutable URL? If it serves a cached store path, the version discovery in scripts/update-cloudflare-cli-release.sh:7-8 would be stale rather than current. - Was the committed beta.17 lock produced by running `scripts/update-cloudflare-cli-release.sh` and then accepted by `nix flake check`, or was `flake.lock` edited by hand? The diff keeps the previous `narHash` while changing only the URL, so its acceptance depends on the `latest` and versioned registry documents being byte-identical. ### Review limitations - I executed nothing: `nix flake check`, ShellCheck, the resolver, and the regression script were not run; all validation claims come from reading the supplied diff and the checked-out files. - The pinned `nixos-auto-update` package (`nixos-update-common.sh`, `nixos_update_run_input_groups`, candidate snapshot/rollback and publication policy) is not in the checkout, so the controller's actual `nix flake update` invocation form and its interaction with the adapter could not be inspected. - No network access: the npm registry behaviour of `https://registry.npmjs.org/cf/<version>` and the current `latest` dist-tag could not be verified, nor the JSON schema or hash output of `nix store prefetch-file`. - No host builds, `just test`, or live activation were performed; the assert's effect on host builds is inferred from its placement in the flake body, not observed. - I did not evaluate unchanged code beyond the callers and definitions needed to assess the changed lines (e.g. `modules/profiles/cloudflare-cli/default.nix` reads `inputs.cloudflare-cli-release` as JSON), and I make no claim about behaviour outside the supplied files. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 4 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Review #127's real-Nix proof suggestion exposed a genuine resolver bug. nix store prefetch-file --json returns a flat content .hash, while a file flake input needs the NAR hash of that file. Reproduced rejection of a resolver-written beta.18 lock by Nix. Fixed the helper to compute nix hash path from the fetched store file. The regression deliberately returns distinct flat and NAR hashes and verifies the NAR value is written, plus failure atomicity if hashing fails.

Real verification after the fix: ran the helper in a disposable clone, then evaluated (builtins.getFlake ...).inputs.cloudflare-cli-release.outPath; Nix accepts the resolver-produced beta.18 lock and its metadata reads as beta.18. For beta.17, nix hash path reproduces the existing accepted NAR hash exactly. The committed beta.17 recovery lock remains unchanged. A separate loopback HTTP test changed the body at one URL between two real prefetch calls: both requests were received and each call returned the new content, confirming mutable discovery is re-fetched.

The exact-argv finding is hypothetical for the pinned controller, not a defect in the current integration. Added stronger committed evidence rather than broadening command parsing: the flake regression now sources the actual flake-pinned src/nixos-update-common.sh and executes its two-input nixos_update_input_group. The fixture permits only the expected per-input source command; release resolution must route through the adapter. This verifies the actual group contract and will fail if a future controller revision changes it. The top-level lock guard remains fail-closed for other paths.

Validation before push: full nix flake check passes (including the actual-controller group test), direct regressions and ShellCheck pass, formatting/whitespace checks pass, real resolver-written lock is accepted by Nix, and mutable-URL re-fetch behavior is confirmed. No host activation or merge. Pushing the validated correction next for a fresh current-head review.

Review #127's real-Nix proof suggestion exposed a genuine resolver bug. `nix store prefetch-file --json` returns a flat content `.hash`, while a `file` flake input needs the NAR hash of that file. Reproduced rejection of a resolver-written beta.18 lock by Nix. Fixed the helper to compute `nix hash path` from the fetched store file. The regression deliberately returns distinct flat and NAR hashes and verifies the NAR value is written, plus failure atomicity if hashing fails. Real verification after the fix: ran the helper in a disposable clone, then evaluated `(builtins.getFlake ...).inputs.cloudflare-cli-release.outPath`; Nix accepts the resolver-produced beta.18 lock and its metadata reads as beta.18. For beta.17, `nix hash path` reproduces the existing accepted NAR hash exactly. The committed beta.17 recovery lock remains unchanged. A separate loopback HTTP test changed the body at one URL between two real prefetch calls: both requests were received and each call returned the new content, confirming mutable discovery is re-fetched. The exact-argv finding is hypothetical for the pinned controller, not a defect in the current integration. Added stronger committed evidence rather than broadening command parsing: the flake regression now sources the actual flake-pinned `src/nixos-update-common.sh` and executes its two-input `nixos_update_input_group`. The fixture permits only the expected per-input source command; release resolution must route through the adapter. This verifies the actual group contract and will fail if a future controller revision changes it. The top-level lock guard remains fail-closed for other paths. Validation before push: full `nix flake check` passes (including the actual-controller group test), direct regressions and ShellCheck pass, formatting/whitespace checks pass, real resolver-written lock is accepted by Nix, and mutable-URL re-fetch behavior is confirmed. No host activation or merge. Pushing the validated correction next for a fresh current-head review.
Compute file-input NAR hashes for cf release locks
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m28s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 21m1s
1d25ff23ee
Use nix hash path on fetched metadata instead of the flat prefetch content hash. Distinguish those hashes in regressions and exercise the actual pinned updater group contract. Address review #127 on MR #355.
Author
Owner

The 30-minute review-follow-up window for current head 1d25ff23eeb8e9b9e948721607bd698b7d7b4423 has expired without a current-head review. The automated review action failed before publishing a verdict. Deterministic CI tests pass for this head, and prior feedback has been assessed and addressed with evidence above; older reviews remain stale.

Polling has stopped under the repository workflow. MR remains open and is not being declared merge-ready. No merge or deployment was performed.

The 30-minute review-follow-up window for current head `1d25ff23eeb8e9b9e948721607bd698b7d7b4423` has expired without a current-head review. The automated review action failed before publishing a verdict. Deterministic CI tests pass for this head, and prior feedback has been assessed and addressed with evidence above; older reviews remain stale. Polling has stopped under the repository workflow. MR remains open and is not being declared merge-ready. No merge or deployment was performed.
clankbot left a comment

Automated code review

Reviewed commit: 1d25ff23eeb8e9b9e948721607bd698b7d7b4423

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The change pins the cf release input to a versioned npm metadata URL, adds a resolver that re-reads the dist-tag before rewriting flake.lock, and adds a top-level flake assertion so host builds (not only nix flake check) reject a mutable latest URL. I verified the assertion against the checked-out state: flake.lock:78 locks https://registry.npmjs.org/cf/1.0.0-beta.17 (which the regex at flake.nix:191 accepts) and flake.lock:82 keeps original.url = https://registry.npmjs.org/cf/latest, matching the second clause at flake.nix:194; the resolver writes the same shape (scripts/update-cloudflare-cli-release.sh jq assignment of locked = {narHash,type,url}) and its version regex matches the Nix regex. lib/auto-update-policy.nix:18-22 confirms cloudflare-cli-release is updated as its own input inside the cloudflare-cli group, which is the form the new as_user adapter at scripts/attic-cache-build.sh:767-769 intercepts (and SCRIPT_DIR is defined at line 5). Two items remain worth attention in the new test file: the function-extraction idiom at line 47 and the fact that the controller-group half of the regression is skipped outside the flake check. I could not execute anything, so no test or check outcome is verified.

Blocking findings

None.

Important findings

  • The sourced as_user extraction relies on sed -n suppressing default output, which GNU sed does not do (tests/cloudflare-cli-release-regressions.sh:47; medium confidence)
    Line 47 is source <(sed -n '/^as_user() { (/ , /^); }/p' "$repo/scripts/attic-cache-build.sh"). In GNU sed, -n is --line-number (default output is suppressed only by -s/--silent), so a -n ... p script emits the whole file with numeric prefixes and emits the range twice; the first emitted line would be 1\t#!/usr/bin/env bash, which bash attempts to run as the command 1. The script runs under set -euo pipefail (line 2), so a failure there would abort before line 48 (as_user nix flake update cloudflare-cli-release) and before the final echo 'cf release lock regressions OK' at line 92, and flake.nix:235 runs this script inside checks.x86_64-linux.cloudflare-cli-release, which the workflow runs at .forgejo/workflows/attic-cache.yml (nix flake check). The target function itself is present and matchable at scripts/attic-cache-build.sh:763 (as_user() { () through 774 (); }), so the addresses are correct; only the -n flag is in question. I could not run sed or bash to confirm the outcome.
    Impact: If the flag behaves as GNU sed documents, none of the adapter-routing, repeat-resolution, failure-atomicity or unrelated-node-preservation assertions actually execute, and the new flake check (hence the CI gate) fails instead of passing. The flake.lock and flake.nix changes themselves are unaffected.
    Suggested fix: Extract the function without relying on -n, e.g. source <(awk '/^as_user\\(\\) \\{ \\(/,/^\\); \\}/') or sed -n '...!d' with -n removed, which is also the range-extraction idiom already used elsewhere in this repository (tests/nixos-update-remediation-regressions.sh:25-27 uses awk '/start/{show=1} /end/{exit} show'). Then run nix flake check and the standalone script to confirm the assertions execute.

Suggestions

  • The controller-group contract test is silently skipped when the regression script is run standalone (tests/cloudflare-cli-release-regressions.sh:82; medium confidence)
    if [[ -n ${CF_UPDATE_COMMON:-} ]]; then guards the block (lines 82-91) that sources the pinned controller library and calls nixos_update_input_group 'cloudflare-cli-release cloudflare-cli-source', then asserts [[ $LAST_INPUT_CHANGED == true ]] (line 89) and [[ -f "$work/source-updated" ]] (line 90). CF_UPDATE_COMMON is defined only as a derivation attribute at flake.nix:228, so a direct ./tests/cloudflare-cli-release-regressions.sh run — the invocation style used for the other regression scripts in this repository — prints cf release lock regressions OK at line 92 without exercising the group path at all.
    Impact: The group/adapter integration is only proven under nix flake check; a targeted local run reports success without that coverage, so a local green result can disagree with the CI gate.
    Suggested fix: Either fail with a message pointing at nix flake check when CF_UPDATE_COMMON is unset, or print which sections were skipped, so a standalone pass is not mistaken for full coverage.

Tests and validation

  • No configured deterministic checks.

Questions

  • Can the maintainer confirm that source <(sed -n '/^as_user() { (/ , /^); }/p' ...) yields a valid function definition in this environment? The same -n ... p idiom appears at tests/nixos-update-remediation-regressions.sh:121 (unchanged code); if that test is green in CI, the idiom works and my reading of -n is wrong, but I had no execution tool to settle it.
  • Is ${nixos-auto-update}/src/nixos-update-common.sh (flake.nix:228) a path that exists in the pinned flake's source tree? scripts/attic-cache-build.sh:779 sources the same library from $auto_update_package/share/nixos-auto-update/nixos-update-common.sh; the pinned flake is not vendored here, so I could not confirm either path, and the check would exercise a different copy than the runtime uses.
  • Does the pinned nixos-auto-update controller invoke the release update through the repository's as_user wrapper as exactly nix flake update cloudflare-cli-release (four arguments), and treat the helper's non-zero exit as an input failure rather than an infrastructure failure? The adapter at scripts/attic-cache-build.sh:767 matches only that exact arity and word sequence.
  • Was the preserved narHash sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo= in flake.lock:76 re-fetched against https://registry.npmjs.org/cf/1.0.0-beta.17, or reused from the previous latest lock entry? The resolver recomputes it with nix hash path, so a stale value would be caught only by a real evaluation.

Review limitations

  • No execution or editing tools were available: I did not run nix flake check, ShellCheck, the regression scripts, sed, or any host build, so every pass/fail outcome is unverified.
  • The pinned nixos-auto-update flake is not vendored in this checkout, so nixos_update_input_group, nixos_update_run_input_groups, LAST_INPUT_CHANGED, and that package's file layout could not be inspected.
  • No live npm registry fetch was performed, so the beta.17 metadata, tarball, integrity values, and the narHash in flake.lock could not be confirmed.
  • I did not verify the derivation environment at flake.nix:225-237 (only pkgs.jq is added to nativeBuildInputs, while the script invokes bash, cmp, mktemp, chmod, and command -v bash); I could not determine from supplied evidence whether those are guaranteed present.
  • The Vega/Lyra and other toplevel derivations were not evaluated; the effect of the assertion at flake.nix:189-195 was read statically.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 5
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `1d25ff23eeb8e9b9e948721607bd698b7d7b4423` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The change pins the cf release input to a versioned npm metadata URL, adds a resolver that re-reads the dist-tag before rewriting flake.lock, and adds a top-level flake assertion so host builds (not only `nix flake check`) reject a mutable `latest` URL. I verified the assertion against the checked-out state: `flake.lock:78` locks `https://registry.npmjs.org/cf/1.0.0-beta.17` (which the regex at `flake.nix:191` accepts) and `flake.lock:82` keeps `original.url` = `https://registry.npmjs.org/cf/latest`, matching the second clause at `flake.nix:194`; the resolver writes the same shape (`scripts/update-cloudflare-cli-release.sh` jq assignment of `locked = {narHash,type,url}`) and its version regex matches the Nix regex. `lib/auto-update-policy.nix:18-22` confirms `cloudflare-cli-release` is updated as its own input inside the `cloudflare-cli` group, which is the form the new `as_user` adapter at `scripts/attic-cache-build.sh:767-769` intercepts (and `SCRIPT_DIR` is defined at line 5). Two items remain worth attention in the new test file: the function-extraction idiom at line 47 and the fact that the controller-group half of the regression is skipped outside the flake check. I could not execute anything, so no test or check outcome is verified. ### Blocking findings None. ### Important findings - **The sourced `as_user` extraction relies on `sed -n` suppressing default output, which GNU sed does not do** (tests/cloudflare-cli-release-regressions.sh:47; medium confidence) Line 47 is `source <(sed -n '/^as_user() { (/ , /^); }/p' "$repo/scripts/attic-cache-build.sh")`. In GNU sed, `-n` is `--line-number` (default output is suppressed only by `-s`/`--silent`), so a `-n ... p` script emits the whole file with numeric prefixes and emits the range twice; the first emitted line would be ` 1\t#!/usr/bin/env bash`, which bash attempts to run as the command `1`. The script runs under `set -euo pipefail` (line 2), so a failure there would abort before line 48 (`as_user nix flake update cloudflare-cli-release`) and before the final `echo 'cf release lock regressions OK'` at line 92, and `flake.nix:235` runs this script inside `checks.x86_64-linux.cloudflare-cli-release`, which the workflow runs at `.forgejo/workflows/attic-cache.yml` (`nix flake check`). The target function itself is present and matchable at `scripts/attic-cache-build.sh:763` (`as_user() { (`) through `774` (`); }`), so the addresses are correct; only the `-n` flag is in question. I could not run sed or bash to confirm the outcome. Impact: If the flag behaves as GNU sed documents, none of the adapter-routing, repeat-resolution, failure-atomicity or unrelated-node-preservation assertions actually execute, and the new flake check (hence the CI gate) fails instead of passing. The `flake.lock` and `flake.nix` changes themselves are unaffected. Suggested fix: Extract the function without relying on `-n`, e.g. `source <(awk '/^as_user\\(\\) \\{ \\(/,/^\\); \\}/')` or `sed -n '...!d'` with `-n` removed, which is also the range-extraction idiom already used elsewhere in this repository (`tests/nixos-update-remediation-regressions.sh:25-27` uses `awk '/start/{show=1} /end/{exit} show'`). Then run `nix flake check` and the standalone script to confirm the assertions execute. ### Suggestions - **The controller-group contract test is silently skipped when the regression script is run standalone** (tests/cloudflare-cli-release-regressions.sh:82; medium confidence) `if [[ -n ${CF_UPDATE_COMMON:-} ]]; then` guards the block (lines 82-91) that sources the pinned controller library and calls `nixos_update_input_group 'cloudflare-cli-release cloudflare-cli-source'`, then asserts `[[ $LAST_INPUT_CHANGED == true ]]` (line 89) and `[[ -f "$work/source-updated" ]]` (line 90). `CF_UPDATE_COMMON` is defined only as a derivation attribute at `flake.nix:228`, so a direct `./tests/cloudflare-cli-release-regressions.sh` run — the invocation style used for the other regression scripts in this repository — prints `cf release lock regressions OK` at line 92 without exercising the group path at all. Impact: The group/adapter integration is only proven under `nix flake check`; a targeted local run reports success without that coverage, so a local green result can disagree with the CI gate. Suggested fix: Either fail with a message pointing at `nix flake check` when `CF_UPDATE_COMMON` is unset, or print which sections were skipped, so a standalone pass is not mistaken for full coverage. ### Tests and validation - No configured deterministic checks. ### Questions - Can the maintainer confirm that `source <(sed -n '/^as_user() { (/ , /^); }/p' ...)` yields a valid function definition in this environment? The same `-n ... p` idiom appears at `tests/nixos-update-remediation-regressions.sh:121` (unchanged code); if that test is green in CI, the idiom works and my reading of `-n` is wrong, but I had no execution tool to settle it. - Is `${nixos-auto-update}/src/nixos-update-common.sh` (`flake.nix:228`) a path that exists in the pinned flake's source tree? `scripts/attic-cache-build.sh:779` sources the same library from `$auto_update_package/share/nixos-auto-update/nixos-update-common.sh`; the pinned flake is not vendored here, so I could not confirm either path, and the check would exercise a different copy than the runtime uses. - Does the pinned `nixos-auto-update` controller invoke the release update through the repository's `as_user` wrapper as exactly `nix flake update cloudflare-cli-release` (four arguments), and treat the helper's non-zero exit as an input failure rather than an infrastructure failure? The adapter at `scripts/attic-cache-build.sh:767` matches only that exact arity and word sequence. - Was the preserved `narHash` `sha256-VKPk+QKKFM20XjxmK2khSf9mCdYZ38Yvv6Nkfn8mSdo=` in `flake.lock:76` re-fetched against `https://registry.npmjs.org/cf/1.0.0-beta.17`, or reused from the previous `latest` lock entry? The resolver recomputes it with `nix hash path`, so a stale value would be caught only by a real evaluation. ### Review limitations - No execution or editing tools were available: I did not run `nix flake check`, ShellCheck, the regression scripts, `sed`, or any host build, so every pass/fail outcome is unverified. - The pinned `nixos-auto-update` flake is not vendored in this checkout, so `nixos_update_input_group`, `nixos_update_run_input_groups`, `LAST_INPUT_CHANGED`, and that package's file layout could not be inspected. - No live npm registry fetch was performed, so the beta.17 metadata, tarball, integrity values, and the `narHash` in `flake.lock` could not be confirmed. - I did not verify the derivation environment at `flake.nix:225-237` (only `pkgs.jq` is added to `nativeBuildInputs`, while the script invokes `bash`, `cmp`, `mktemp`, `chmod`, and `command -v bash`); I could not determine from supplied evidence whether those are guaranteed present. - The Vega/Lyra and other toplevel derivations were not evaluated; the effect of the assertion at `flake.nix:189-195` was read statically. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 5 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Review #128's important sed finding is incorrect and is dismissed with direct evidence. GNU sed documents -n, --quiet, --silent as suppressing automatic printing of pattern space. It does not add line numbers. printf 'alpha\nbeta\n' | sed -n '2p' prints only beta; extracting the actual as_user range produces a valid Bash function (bash -n succeeds), and the adapter regressions execute and pass. The working extraction idiom is unchanged.

The advisory coverage-reporting point is valid and is addressed: a direct run with CF_UPDATE_COMMON unset explicitly prints that the pinned-controller group section was skipped and gives the full nix build .#checks.x86_64-linux.cloudflare-cli-release command. Runs with the controller supplied print a separate group-regression success message.

Additional evidence: resolved the actual flake-pinned updater source and built its package, then compared src/nixos-update-common.sh with the packaged share/nixos-auto-update/nixos-update-common.sh; they are byte-identical. This closes the source-vs-runtime-copy question. Previously documented controller invocation, beta.17 NAR verification and real resolver-written-lock acceptance remain applicable.

Validation before push: full nix flake check passes; standalone resolver tests pass with an explicit skip notice; controller-enabled tests execute both inputs and pass; ShellCheck, formatting and whitespace checks pass. No merge or activation. Pushing the small advisory improvement next; no code is changed to satisfy the disproven sed claim.

Review #128's important sed finding is incorrect and is dismissed with direct evidence. GNU sed documents `-n, --quiet, --silent` as suppressing automatic printing of pattern space. It does not add line numbers. `printf 'alpha\nbeta\n' | sed -n '2p'` prints only `beta`; extracting the actual `as_user` range produces a valid Bash function (`bash -n` succeeds), and the adapter regressions execute and pass. The working extraction idiom is unchanged. The advisory coverage-reporting point is valid and is addressed: a direct run with CF_UPDATE_COMMON unset explicitly prints that the pinned-controller group section was skipped and gives the full `nix build .#checks.x86_64-linux.cloudflare-cli-release` command. Runs with the controller supplied print a separate group-regression success message. Additional evidence: resolved the actual flake-pinned updater source and built its package, then compared `src/nixos-update-common.sh` with the packaged `share/nixos-auto-update/nixos-update-common.sh`; they are byte-identical. This closes the source-vs-runtime-copy question. Previously documented controller invocation, beta.17 NAR verification and real resolver-written-lock acceptance remain applicable. Validation before push: full `nix flake check` passes; standalone resolver tests pass with an explicit skip notice; controller-enabled tests execute both inputs and pass; ShellCheck, formatting and whitespace checks pass. No merge or activation. Pushing the small advisory improvement next; no code is changed to satisfy the disproven sed claim.
Report skipped cf controller integration coverage
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m30s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 21m12s
cdcf28d9b6
Make standalone regression coverage explicit and point to the full flake check when the pinned controller library is not supplied. Address review #128's advisory suggestion.
clankbot left a comment

Automated code review

Reviewed commit: cdcf28d9b6edb02edacc210bf7a2f024032e51fe

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The supplied change makes the cloudflare-cli-release file input reproducible: flake.lock now locks a versioned npm metadata URL (flake.lock:78, 1.0.0-beta.17) while keeping original.url as the mutable discovery URL (flake.lock:81), scripts/update-cloudflare-cli-release.sh resolves the latest dist-tag, validates the returned metadata, and rewrites only the release node's locked block with a NAR hash (nix hash path), scripts/attic-cache-build.sh:767-772 routes the controller's per-input update command through that helper inside as_user, and flake.nix:188-195 adds a body-level assertion rejecting a non-versioned locked.url for every flake output. I traced the consumers: modules/profiles/cloudflare-cli/default.nix:6 reads the fetched JSON, and lib/auto-update-policy.nix:16-27 keeps the release/source pair in one group, matching the README's manual-refresh sequence (README.md:204-207). The assertion's second clause (release.original.url == "https://registry.npmjs.org/cf/latest") matches the checked-out lock, and the helper's jq rewrite preserves original and unrelated nodes, which the new regression script asserts. I could not demonstrate a defect outright from the supplied material; the retained findings concern the new check's dependence on an external pinned package's internal layout/contract, and one coverage gap.

Blocking findings

None.

Important findings

  • New flake check hard-codes an internal path and function contract of the pinned nixos-auto-update input that is not verifiable in this repository (flake.nix:228; medium confidence)
    flake.nix:228 sets CF_UPDATE_COMMON = "${nixos-auto-update}/src/nixos-update-common.sh", i.e. a path inside the fetched flake input's source tree (flake.nix:83 declares nixos-auto-update.url = "git+ssh://git@git.nimmog.uk:2222/nimmo/nixos-auto-update"). The production controller reaches the same helper through the built package instead: scripts/attic-cache-build.sh:779-780 auto_update_package=$(nix build --no-link --print-out-paths "$REPO_ROOT#nixos-auto-update") then . "$auto_update_package/share/nixos-auto-update/nixos-update-common.sh". tests/cloudflare-cli-release-regressions.sh:83 guards only on [[ -n ${CF_UPDATE_COMMON:-} ]], so the variable is always set inside the derivation and the skip branch (line 94) is unreachable there; a missing file then makes source "$CF_UPDATE_COMMON" (line 87) fail under set -euo pipefail and fails the whole check. Likewise nixos_update_input_group (line 88) and LAST_INPUT_CHANGED (line 89) appear nowhere else in this checkout — only nixos_update_run_input_groups is called (scripts/attic-cache-build.sh:961, 1026) — so the group function's name, its single space-separated argument, and its LAST_INPUT_CHANGED semantics are an unverified external contract.
    Impact: Because nix flake check is the authoritative gate (.forgejo/workflows/attic-cache.yml:144), a mismatch in the pinned package's source layout or group-function signature turns the new check into a hard gate failure that blocks the whole fleet, rather than a locally reported skip; the check's behaviour also changes silently if upstream moves the helper within its source tree.
    Suggested fix: Resolve the helper the same way the controller does (pass the built package path and use share/nixos-auto-update/nixos-update-common.sh), or make the guard test the file (if [[ -n ${CF_UPDATE_COMMON:-} && -f "$CF_UPDATE_COMMON" ]]) so a missing helper reports the skip instead of failing the gate; alternatively state explicitly in the PR that the pinned input's src/ layout and nixos_update_input_group/LAST_INPUT_CHANGED contract were verified against the pinned revision.

Suggestions

  • The new versioned-URL assertion is only exercised positively by the supplied tests (flake.nix:195; high confidence)
    flake.nix:188-195 asserts builtins.match "https://registry[.]npmjs[.]org/cf/[0-9]+[.][0-9]+[.][0-9]+(-[0-9A-Za-z.-]+)?" release.locked.url != null && release.original.url == "https://registry.npmjs.org/cf/latest". The checked-out flake.lock:73-82 satisfies it, so nix flake check passes. tests/cloudflare-cli-release-regressions.sh exercises only the shell helper's failure modes (FAIL_RELEASE, FAIL_HASH, missing/empty dist.tarball, empty dist.integrity, .version = "wrong", path-traversal version) and never feeds a lock containing "url": "https://registry.npmjs.org/cf/latest" back through the Nix assertion; no other supplied test or check covers it.
    Impact: A regression in the assertion itself — e.g. a regex change that stops matching valid versioned URLs, or the original.url clause drifting if the flake input declaration at flake.nix:25 changes — would not be caught by the isolated regressions and would surface only as a failed gate on every host build.
    Suggested fix: If desired, add a negative case that evaluates the flake body against a temporary lock holding "url": "https://registry.npmjs.org/cf/latest" and expects the assertion message, mirroring the existing expect_unchanged_failure pattern. This is a coverage suggestion, not a demonstrated defect.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the pinned nixos-auto-update input (flake.lock:488, rev a32a0ba5a1563e10dcc41debfd31424a2020f89c) contain src/nixos-update-common.sh in its source tree, and does that file define nixos_update_input_group accepting one space-separated input list and set LAST_INPUT_CHANGED? Its source is not present in this checkout.
  • Does the pinned controller invoke per-input updates through as_user as exactly nix flake update <input> (four arguments)? scripts/attic-cache-build.sh:767-772 matches only that exact form and otherwise passes the command through unchanged, so a grouped or flagged form such as nix flake update cloudflare-cli-release cloudflare-cli-source would re-lock the mutable latest URL and then be rejected by flake.nix:188-195 for every flake output.
  • Is tests/cloudflare-cli-release-regressions.sh intended to run only via nix flake check (.forgejo/workflows/attic-cache.yml:144)? justfiles/maintenance.just:452-453 wraps only ./tests/nixos-update-remediation-regressions.sh, and no supplied recipe invokes the new script.

Review limitations

  • No Nix, ShellCheck, network or CI execution was performed; the PR's validation claims (nix flake check passes, host toplevels evaluate, isolated regressions pass, real-registry resolution yields beta.18) are untrusted evidence and were not reproduced.
  • The pinned nixos-auto-update package and its source layout are not present in this checkout, so the helper's path, the group function's name/signature, and LAST_INPUT_CHANGED semantics could not be inspected.
  • npm registry behaviour was not checked: that cf/latest currently serves a newer version than the locked 1.0.0-beta.17, that the versioned metadata URL remains fetchable, and that flake.lock:76's narHash equals nix hash path of the fetched file.
  • Whether nix store prefetch-file --json output fields (storePath, .version, .name, .dist.tarball, .dist.integrity) and nix hash path's sha256-... output format match the helper's assumptions could not be verified without execution.
  • Full host builds, live activation, Attic pushes and the remediation workflow were not run; no claim is made about deployment behaviour on any host.
  • Only the listed changed files plus the cited unchanged consumers (modules/profiles/cloudflare-cli/default.nix, lib/auto-update-policy.nix, scripts/attic-cache-build.sh, .forgejo/workflows/attic-cache.yml, flake.lock, justfiles/maintenance.just) were examined; other unchanged repository code was not audited.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • scripts/attic-cache-build.sh: reviewed — included in a context-limited batch
  • scripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batch
  • tests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 6
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `cdcf28d9b6edb02edacc210bf7a2f024032e51fe` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The supplied change makes the `cloudflare-cli-release` file input reproducible: `flake.lock` now locks a versioned npm metadata URL (`flake.lock:78`, `1.0.0-beta.17`) while keeping `original.url` as the mutable discovery URL (`flake.lock:81`), `scripts/update-cloudflare-cli-release.sh` resolves the `latest` dist-tag, validates the returned metadata, and rewrites only the release node's `locked` block with a NAR hash (`nix hash path`), `scripts/attic-cache-build.sh:767-772` routes the controller's per-input update command through that helper inside `as_user`, and `flake.nix:188-195` adds a body-level assertion rejecting a non-versioned `locked.url` for every flake output. I traced the consumers: `modules/profiles/cloudflare-cli/default.nix:6` reads the fetched JSON, and `lib/auto-update-policy.nix:16-27` keeps the release/source pair in one group, matching the README's manual-refresh sequence (`README.md:204-207`). The assertion's second clause (`release.original.url == "https://registry.npmjs.org/cf/latest"`) matches the checked-out lock, and the helper's jq rewrite preserves `original` and unrelated nodes, which the new regression script asserts. I could not demonstrate a defect outright from the supplied material; the retained findings concern the new check's dependence on an external pinned package's internal layout/contract, and one coverage gap. ### Blocking findings None. ### Important findings - **New flake check hard-codes an internal path and function contract of the pinned nixos-auto-update input that is not verifiable in this repository** (flake.nix:228; medium confidence) flake.nix:228 sets `CF_UPDATE_COMMON = "${nixos-auto-update}/src/nixos-update-common.sh"`, i.e. a path inside the fetched flake input's source tree (flake.nix:83 declares `nixos-auto-update.url = "git+ssh://git@git.nimmog.uk:2222/nimmo/nixos-auto-update"`). The production controller reaches the same helper through the built package instead: scripts/attic-cache-build.sh:779-780 `auto_update_package=$(nix build --no-link --print-out-paths "$REPO_ROOT#nixos-auto-update")` then `. "$auto_update_package/share/nixos-auto-update/nixos-update-common.sh"`. tests/cloudflare-cli-release-regressions.sh:83 guards only on `[[ -n ${CF_UPDATE_COMMON:-} ]]`, so the variable is always set inside the derivation and the skip branch (line 94) is unreachable there; a missing file then makes `source "$CF_UPDATE_COMMON"` (line 87) fail under `set -euo pipefail` and fails the whole check. Likewise `nixos_update_input_group` (line 88) and `LAST_INPUT_CHANGED` (line 89) appear nowhere else in this checkout — only `nixos_update_run_input_groups` is called (scripts/attic-cache-build.sh:961, 1026) — so the group function's name, its single space-separated argument, and its `LAST_INPUT_CHANGED` semantics are an unverified external contract. Impact: Because `nix flake check` is the authoritative gate (.forgejo/workflows/attic-cache.yml:144), a mismatch in the pinned package's source layout or group-function signature turns the new check into a hard gate failure that blocks the whole fleet, rather than a locally reported skip; the check's behaviour also changes silently if upstream moves the helper within its source tree. Suggested fix: Resolve the helper the same way the controller does (pass the built package path and use `share/nixos-auto-update/nixos-update-common.sh`), or make the guard test the file (`if [[ -n ${CF_UPDATE_COMMON:-} && -f "$CF_UPDATE_COMMON" ]]`) so a missing helper reports the skip instead of failing the gate; alternatively state explicitly in the PR that the pinned input's `src/` layout and `nixos_update_input_group`/`LAST_INPUT_CHANGED` contract were verified against the pinned revision. ### Suggestions - **The new versioned-URL assertion is only exercised positively by the supplied tests** (flake.nix:195; high confidence) flake.nix:188-195 asserts `builtins.match "https://registry[.]npmjs[.]org/cf/[0-9]+[.][0-9]+[.][0-9]+(-[0-9A-Za-z.-]+)?" release.locked.url != null && release.original.url == "https://registry.npmjs.org/cf/latest"`. The checked-out flake.lock:73-82 satisfies it, so `nix flake check` passes. tests/cloudflare-cli-release-regressions.sh exercises only the shell helper's failure modes (FAIL_RELEASE, FAIL_HASH, missing/empty `dist.tarball`, empty `dist.integrity`, `.version = "wrong"`, path-traversal version) and never feeds a lock containing `"url": "https://registry.npmjs.org/cf/latest"` back through the Nix assertion; no other supplied test or check covers it. Impact: A regression in the assertion itself — e.g. a regex change that stops matching valid versioned URLs, or the `original.url` clause drifting if the flake input declaration at flake.nix:25 changes — would not be caught by the isolated regressions and would surface only as a failed gate on every host build. Suggested fix: If desired, add a negative case that evaluates the flake body against a temporary lock holding `"url": "https://registry.npmjs.org/cf/latest"` and expects the assertion message, mirroring the existing `expect_unchanged_failure` pattern. This is a coverage suggestion, not a demonstrated defect. ### Tests and validation - No configured deterministic checks. ### Questions - Does the pinned `nixos-auto-update` input (flake.lock:488, rev a32a0ba5a1563e10dcc41debfd31424a2020f89c) contain `src/nixos-update-common.sh` in its source tree, and does that file define `nixos_update_input_group` accepting one space-separated input list and set `LAST_INPUT_CHANGED`? Its source is not present in this checkout. - Does the pinned controller invoke per-input updates through `as_user` as exactly `nix flake update <input>` (four arguments)? scripts/attic-cache-build.sh:767-772 matches only that exact form and otherwise passes the command through unchanged, so a grouped or flagged form such as `nix flake update cloudflare-cli-release cloudflare-cli-source` would re-lock the mutable `latest` URL and then be rejected by flake.nix:188-195 for every flake output. - Is `tests/cloudflare-cli-release-regressions.sh` intended to run only via `nix flake check` (.forgejo/workflows/attic-cache.yml:144)? justfiles/maintenance.just:452-453 wraps only `./tests/nixos-update-remediation-regressions.sh`, and no supplied recipe invokes the new script. ### Review limitations - No Nix, ShellCheck, network or CI execution was performed; the PR's validation claims (`nix flake check` passes, host toplevels evaluate, isolated regressions pass, real-registry resolution yields beta.18) are untrusted evidence and were not reproduced. - The pinned `nixos-auto-update` package and its source layout are not present in this checkout, so the helper's path, the group function's name/signature, and `LAST_INPUT_CHANGED` semantics could not be inspected. - npm registry behaviour was not checked: that `cf/latest` currently serves a newer version than the locked `1.0.0-beta.17`, that the versioned metadata URL remains fetchable, and that flake.lock:76's narHash equals `nix hash path` of the fetched file. - Whether `nix store prefetch-file --json` output fields (`storePath`, `.version`, `.name`, `.dist.tarball`, `.dist.integrity`) and `nix hash path`'s `sha256-...` output format match the helper's assumptions could not be verified without execution. - Full host builds, live activation, Attic pushes and the remediation workflow were not run; no claim is made about deployment behaviour on any host. - Only the listed changed files plus the cited unchanged consumers (`modules/profiles/cloudflare-cli/default.nix`, `lib/auto-update-policy.nix`, `scripts/attic-cache-build.sh`, `.forgejo/workflows/attic-cache.yml`, `flake.lock`, `justfiles/maintenance.just`) were examined; other unchanged repository code was not audited. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `scripts/attic-cache-build.sh`: **reviewed** — included in a context-limited batch - `scripts/update-cloudflare-cli-release.sh`: **reviewed** — included in a context-limited batch - `tests/cloudflare-cli-release-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 6 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Assessed current-head review #129; no further code change is warranted.

The important finding is uncertainty about an external dependency, not an observed mismatch. Confirmed against locked revision a32a0ba5a1563e10dcc41debfd31424a2020f89c: the source path exists, the function and LAST_INPUT_CHANGED contract exist, the committed flake regression executes that actual two-input group, and the source library is byte-identical to the packaged runtime library. This was verified before the current head and is now explicit in the MR description, satisfying the review's own suggested alternative. If a future dependency revision changes this integration contract, failing candidate validation is intentional; silently skipping that integration check would hide a regression.

The optional negative-assertion suggestion is not a current defect. Actual disposable-lock negative tests already rejected mutable latest for both Vega/Lyra host targets and updater policy, then succeeded after restoring the accepted lock; that evidence is now also in the MR description. The assertion has not changed since those tests. No recursive Nix invocation is being added to the hermetic build check solely to relocate already-completed validation.

Current-head CI tests pass. All valid findings from previous reviews are fixed; remaining uncertainty/optional-coverage comments are dismissed for the reasons above. Under the repository's rule for only irrelevant comments remaining, the MR is ready for a merge decision. Stopping review polling. No merge or deployment is authorized or performed.

Assessed current-head review #129; no further code change is warranted. The important finding is uncertainty about an external dependency, not an observed mismatch. Confirmed against locked revision `a32a0ba5a1563e10dcc41debfd31424a2020f89c`: the source path exists, the function and LAST_INPUT_CHANGED contract exist, the committed flake regression executes that actual two-input group, and the source library is byte-identical to the packaged runtime library. This was verified before the current head and is now explicit in the MR description, satisfying the review's own suggested alternative. If a future dependency revision changes this integration contract, failing candidate validation is intentional; silently skipping that integration check would hide a regression. The optional negative-assertion suggestion is not a current defect. Actual disposable-lock negative tests already rejected mutable `latest` for both Vega/Lyra host targets and updater policy, then succeeded after restoring the accepted lock; that evidence is now also in the MR description. The assertion has not changed since those tests. No recursive Nix invocation is being added to the hermetic build check solely to relocate already-completed validation. Current-head CI tests pass. All valid findings from previous reviews are fixed; remaining uncertainty/optional-coverage comments are dismissed for the reasons above. Under the repository's rule for only irrelevant comments remaining, the MR is ready for a merge decision. Stopping review polling. No merge or deployment is authorized or performed.
nimmo merged commit 1082a72edf into main 2026-10-17 11:43:06 +01:00
nimmo deleted branch fix/cf-release-reproducibility 2026-10-17 11:43:06 +01:00
Sign in to join this conversation.
No reviewers
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
nimmo/nixos-config!355
No description provided.