Skip to content

chore(nix): bump flake vendorHash to match go.sum - #450

Closed
ZacxDev wants to merge 1 commit into
mainfrom
automation/bump-flake-vendorhash
Closed

ZacxDev wants to merge 1 commit into
mainfrom
automation/bump-flake-vendorhash

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Automated by the bump-flake-vendorhash workflow.

The Nix flake's vendorHash is a fixed-output hash derived from
go.sum. It drifted from the current go.mod/go.sum (a dep was
added or bumped), which makes the flake CI build fail and silently
breaks nix run github:civitai/cli. This PR recomputes the correct
hash via the lib.fakeHash dance (write a fake hash → nix build →
parse the real got: sha256-… → write it back) and updates
flake.nix.

Validated in-job before opening this PR: nix build .#default
succeeds with the new hash and ./result/bin/civitai version runs.

CI note: this PR is opened with the scoped fine-grained token
(secrets.BUMP_SCAFFOLD_PINS_TOKEN, Contents + Pull requests RW on
this repo only), not the default GITHUB_TOKEN — so the repo's
flake check re-runs the build on it as an independent confirmation.

ZacxDev added a commit that referenced this pull request Aug 17, 2026
…nix out-links (#467)

The `bump-flake-vendorhash` bot committed a build artifact into its own PR.
#450 changed two things: the legitimate `vendorHash` bump, and a NEW `result`
symlink pointing at `/nix/store/kkfnywjq…-civitai-4e35eaa-dirty`. All 13 CI
checks were green on it — nothing in this repo detects the artifact.

Mechanism, in `.github/workflows/bump-flake-vendorhash.yml`:

  - the two validate steps run `nix build .#default` and
    `./result/bin/civitai version`, and a SUCCESSFUL `nix build` drops a
    `result` out-link symlink into the invocation cwd (the repo root);
  - `result` is not in `.gitignore`;
  - the `open PR if vendorHash changed` step uses
    peter-evans/create-pull-request without `add-paths`, and that action runs
    `git add -A` in that case (verified in the action's own
    `create-or-update-branch.ts` at the pinned SHA c5a7806) — so it stages
    every change in the tree, untracked files included.

The ordering is why this hid: `detect changes` runs BEFORE the validate steps,
so its `git status --porcelain` gate never sees `result` and the
changed=true/false decision is unaffected. The symlink exists only in the
window between validation and the PR step.

Two independent guards:

1. `add-paths: flake.nix` on the create-pull-request step — the authoritative
   fix. It stages exactly the file the workflow is allowed to change, so no
   future artifact can ride along regardless of what a later step leaves in the
   workspace. Audited against every step that writes to the working tree: the
   recompute step's two `sed -i`s and its `git checkout --` restore touch
   flake.nix and nothing else, and its nix log goes to `$RUNNER_TEMP`.
   flake.nix is the complete write set.

2. `/result` + `/result-*` in `.gitignore` — defence in depth, covering nix's
   numbered/named out-link variants. Anchored to the repo root so a legitimately
   named file deeper in the tree is unaffected.

Also applies the vendorHash bump itself (#450's legitimate half), independently
re-derived here rather than copied: with `vendorHash` set to the workflow's own
fake, `nix build .#default` reported
`got: sha256-l0RyxhS7+tdL9FngitiUhrciQbZfyDmTp5tP3Kd6NGQ=`, matching #450
exactly. `go.mod`/`go.sum` are byte-identical between #450's head and `main`.
With the real hash written back, `nix build .#default` succeeds and
`./result/bin/civitai version` runs.

The two sibling drift-bots that share this token and this action —
`bump-scaffold-pins` and `revendor-canonical-schema` — were audited for the
same defect and do NOT have it, so they keep `git add -A` and gain only a
comment recording the audit and what would change that. Neither writes anything
into the workspace except the file it means to commit: `bump-pins` writes only
under its `--dir` (default `internal/scaffold`), the re-vendor script `cp`s to
one path and downloads via `mktemp`, `go test` writes nothing, and the scaffold
build validation deliberately runs in `$RUNNER_TEMP`. Measured, not just read:
`git status --porcelain` was clean of artifacts after the full test suite and
after a `civitai app init --dir "$RUNNER_TEMP/…"`.

Supersedes #450, which should not be merged as-is.
@ZacxDev

ZacxDev commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #467, now on main as 075bf06.

That PR carries this one's entire payload — the identical vendorHash
(sha256-l0Ryxh…), independently re-derived by building rather than copied —
plus the fix for the defect this PR exposed.

What this PR revealed: alongside the hash bump it also committed
result -> /nix/store/kkfnywjq…-civitai-4e35eaa-dirty, a nix out-link left by
the job's own validate steps. All 13 checks were green on it; nothing in CI
detects a stray artifact. Root cause was peter-evans/create-pull-request
staging the whole tree when add-paths is absent — confirmed in the action's
source at the SHA this repo pins — with the validate steps running before the
PR step, and result not gitignored.

#467 pins add-paths: flake.nix (audited as the complete set of paths this job
writes), adds /result and /result-* to .gitignore, and documents why the
two sibling drift-bots deliberately do not get the same filter.

Closing rather than fixing in place: automation/bump-flake-vendorhash is a
bot-owned branch recreated on each run with delete-branch: true, so there is
nothing here to preserve. The next run will recompute the same hash, find no
drift, and open nothing.

@ZacxDev ZacxDev closed this Aug 17, 2026
@ZacxDev
ZacxDev deleted the automation/bump-flake-vendorhash branch August 17, 2026 23:18
ZacxDev added a commit that referenced this pull request Aug 18, 2026
…fix rounds broke things at the rate implementations did (#478)

Replaces a doc that still said "Nothing is in flight, main @ 01d6692" while six
PRs, three filed issues and a release had landed on top of it.

Records the arc: #458 drop-messaging, #460 antipattern consolidation, #461
root-scoped allow-list, #467 the vendorHash bot's nix out-link, #468 depth-aware
exclusion, #470 the credential warning. #464/#465/#466 closed, #450 superseded,
#435 left open on Row B alone (bloat and VCS plumbing, not credentials).

The part worth carrying forward is not the feature list. Every audit round after
the first found a defect the previous round had certified clean, and each was
CREATED by the fix for the previous finding — a re-approved golden contradicting
the PR's own test, an 830x quadratic scan, a threshold tolerating a 1024x change,
and a hostname-substring hole silencing real credentials. That is the argument
for resetting the verification gate on every fix instead of trusting it.

Also records three instrument traps that each returned a confident wrong answer
in one session despite being documented rules: mutating the first of two
identically-shaped functions, a -run filter that excluded the killing test, and
`go build | head && echo OK` reporting success on a compile failure. The cure
that held every time was a build gate before any verdict, no -run filter, and
counted output rather than exit codes.

And the standing gate on any future detector change: 244 project dirs / 3,917
packaged files / 1 firing = 0.41%, re-measured every time — a URL pattern once
took it to 5.33% on a single starter-template README line.
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