Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/bump-flake-vendorhash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,29 @@ jobs:
# the repo's normal CI (the `flake` build check). Shared with the
# other drift-bots (bump-scaffold-pins / revendor-canonical-schema).
token: ${{ secrets.BUMP_SCAFFOLD_PINS_TOKEN }}
# 🔴 STAGE ONLY flake.nix. Without `add-paths` this action stages
# EVERYTHING in the tree, untracked files included — and the two
# validate steps directly above run `nix build`, which drops a
# `result` symlink into the repo root on success. So the bot committed
# a pointer into /nix/store alongside its hash bump: PR #450 shipped
# `result -> /nix/store/kkfnywjq…-civitai-4e35eaa-dirty`, and all 13
# CI checks were green on it — nothing here detects the artifact, so
# the guard has to be that it is never staged.
#
# Note the ordering that hid this: `detect changes` runs BEFORE the
# validate steps, so its `git status --porcelain` is clean of `result`
# and the changed=true/false gate is unaffected. The symlink only
# exists during the window between validation and this step.
#
# This value is the COMPLETE set of paths the job may write, not a
# convenience filter. Audited against every step: 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`. If a future
# step writes another file that BELONGS in the PR, add it here — an
# unlisted path is silently dropped from the commit, and a bot that
# opens an incomplete PR is worse than the artifact this prevents.
# `.gitignore` also carries `/result`, as a second, independent layer.
add-paths: flake.nix
branch: automation/bump-flake-vendorhash
delete-branch: true
commit-message: "chore(nix): bump flake vendorHash to match go.sum"
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/bump-scaffold-pins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,28 @@ jobs:
npm run typecheck
npm run build

# NO `add-paths:` here, deliberately — and that is a decision, not an
# oversight. This action stages `git add -A` when `add-paths` is absent,
# so ANY file a step leaves in the workspace rides into the PR. That is
# exactly how the sibling `bump-flake-vendorhash` committed a `result`
# symlink into /nix/store (#450, green on all 13 checks); it now pins
# `add-paths: flake.nix`.
#
# This job was audited against that failure and does not have it: the only
# step that writes into the repo is the bumper, and `bump-pins` writes
# exclusively under its `--dir` (default `internal/scaffold`) to three
# constant sites. Everything else writes outside the tree — `go test`
# writes nothing, and `validate — scaffold builds` scaffolds and runs npm
# in `$RUNNER_TEMP` on purpose (see that step's comment). Measured, not
# just read: `git status --porcelain` is clean of artifacts after the test
# suite and after a `civitai app init --dir "$RUNNER_TEMP/…"`.
#
# 🔴 If you add a step that builds/installs/generates INTO the workspace,
# add `add-paths` naming the complete set of files this bot may commit —
# `internal/scaffold` is the bumper's provable write root. Note the
# trade-off before reaching for it as a reflex: a path that is written but
# NOT listed is silently dropped from the commit, and a bot that opens an
# incomplete PR is worse than the artifact the filter prevents.
- name: open PR if pins changed
id: pr
if: steps.changed.outputs.changed == 'true'
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/revendor-canonical-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ jobs:
# examples/*.block.manifest.json) runs too, not just internal/validate.
run: go test ./...

# NO `add-paths:` here, deliberately — and that is a decision, not an
# oversight. This action stages `git add -A` when `add-paths` is absent,
# so ANY file a step leaves in the workspace rides into the PR. That is
# exactly how the sibling `bump-flake-vendorhash` committed a `result`
# symlink into /nix/store (#450, green on all 13 checks); it now pins
# `add-paths: flake.nix`.
#
# This job was audited against that failure and does not have it: the only
# step that writes into the repo is the re-vendor script, which `cp`s to a
# single path it computes from its own location
# (`schema/app-block.manifest.schema.json`) and downloads via `mktemp`
# outside the tree; `go test ./...` writes nothing. Measured, not just
# read: `git status --porcelain` is clean of artifacts after the suite.
#
# 🔴 If you add a step that builds/installs/generates INTO the workspace,
# add `add-paths` naming the complete set of files this bot may commit.
# Note the trade-off before reaching for it as a reflex: a path that is
# written but NOT listed is silently dropped from the commit, and a bot
# that opens an incomplete PR is worse than the artifact it prevents.
- name: open PR if schema changed
id: pr
if: steps.changed.outputs.changed == 'true'
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ coverage.html
.DS_Store
.venv/
/.claude/worktrees

# `nix build` drops an out-link symlink into the invocation cwd (the repo root),
# named `result` — or `result-<output>`/`result-<n>` when a build has several
# outputs or several installables are built at once. It is a pointer into
# /nix/store and must never be committed. This is DEFENCE IN DEPTH behind the
# `add-paths:` on the `bump-flake-vendorhash` bot: that bot runs `nix build`
# before opening its PR, and with neither guard the symlink rode along into the
# PR diff (#450 committed `result -> /nix/store/kkfnywjq…-civitai-4e35eaa-dirty`
# and all 13 CI checks stayed green).
/result
/result-*
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Computed from go.sum (this module is not vendored). To recompute
# after a go.mod/go.sum change: set this to `lib.fakeHash`, run
# `nix build`, and copy the `got: sha256-…` value from the error.
vendorHash = "sha256-prgKRC+357KX7vJ9jcIq2+1FUD91a2Gg5Q89R+FTZ+g=";
vendorHash = "sha256-l0RyxhS7+tdL9FngitiUhrciQbZfyDmTp5tP3Kd6NGQ=";

# The module root is `package cli` (a library that embeds the schema);
# the executable lives in ./cmd/civitai (package main). Build only it.
Expand Down
Loading