Skip to content

feat(nix-cache-push): add opt-in verify that fails on a missing upload - #3

Merged
dohernandez merged 1 commit into
mainfrom
feat/nix-cache-push-verify
Nov 9, 2026
Merged

dohernandez merged 1 commit into
mainfrom
feat/nix-cache-push-verify

Conversation

@dohernandez

Copy link
Copy Markdown
Member

What

nix-cache-push gets an opt-in input verify (default "false"). With verify: "true":

  • a failed attic client build, path listing, login or upload exits 1 (::error::) instead of warning and exiting 0;
  • after the upload, each pushed path is read back from the cache (<endpoint>/<cache>/<hash>.narinfo, Authorization: Bearer with the push token, which can pull; the token goes to curl through a config on stdin, not argv). Any answer but 200 fails the job and names the path and the HTTP code.

Default behaviour is unchanged: every failure still warns and exits 0, so no current consumer changes. The add-an-action.md rule ("must not fail the job when the cache is unavailable") now names this opt-in as the exception; actions.md documents the input.

Why

The CI push token (NIX_CACHE_PUSH_TOKEN) has been refused with Error: Unauthorized since 1-2 Nov 2026 in genlayer-node (last good run 41236365964, 31 Oct 19:54Z) and genlayer-consensus (last good run 41220838821, 31 Oct 16:40Z). This action turned that into ::warning::attic push failed, so every job stayed green and no build reached the cache for 8 days. Only consensus's release workflow noticed, through its own extra check. [Inference] The token was minted with --validity '90d' (devexp-nix-cache bootstrap step 6) and expired; pulls still authenticate.

Node and consensus each grew an inline check after this action. With verify the check lives here once, and each repo sets one input:

  • genlayer-node#2397 (nix-build.yml, which is also the vX.Y release gate) — already points at this branch to test it;
  • genlayer-consensus#2019 (nix-build.yml and release-tag.yml).

Tests

Step script extracted with yq and run against stub nix/attic and the real cache (a pull token stands in for the push token on the read-back):

Case verify Result
upload refused (Unauthorized) true exit 1, ::error::attic push failed …
upload refused false exit 0, ::warning:: (as before)
upload ok, 3 paths pushed 31 Oct (in cache) true exit 0, verified 3 path(s)
upload "ok", 3 paths of 9 Nov (not in cache) true exit 1, each path HTTP 404
upload ok, paths not in cache false exit 0, no read-back
login fails true / false exit 1 / exit 0 warning
client build fails true exit 1
path listing fails true / false exit 1 / exit 0 with the old ::error:: line, as before
wrong token on read-back true exit 1, each path HTTP 401
  • shellcheck on the step: clean (except SC2164 on the existing cd; the step runs under bash -e).
  • nix flake check (this repo's CI): pass.
  • CI end to end: genlayer-node#2397 runs this branch with verify: "true"; with the expired token it must fail at the push step.

Merging is a release to every consumer at @main; nothing changes for a consumer until it sets verify.

A refused upload was only a warning, so an expired push token left every job green and the cache without its builds. verify: "true" fails the job and reads each pushed path back from the cache; the default stays warn-only.
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e09809c-224d-4c94-b28c-99ed5d93f0dc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dohernandez
dohernandez merged commit 5e4cbe3 into main Nov 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant