feat(ci): auto-regenerate downstream packages.lock.json on Dependabot NuGet PRs (#203)#230
Merged
Conversation
added 6 commits
July 25, 2026 18:44
… action, tidy workflow (#203)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Dependabot bumps a NuGet package in one project and regenerates only that project's
packages.lock.json. Every downstream project in the reference chain (Domain ← Application ← Infrastructure ← Api ← tests) still pins the old transitive graph, so CI'sdotnet restore --locked-modefails with NU1004 (upstream limitation: dependabot-core#5461). This has recurred repeatedly — it broke #192/#194/#195/#196 at once on 2026-07-24, andmainHEADc104d88is itself a manual fix of the same class.This adds a workflow that heals the downstream locks automatically so the PR goes green with no manual
restore --force-evaluate+ commit.Closes #203 · Epic #15.
How
New
.github/workflows/dependabot-lockfix.yml, triggeredon: workflow_runoff CI (types: [completed]) — so it runs frommain's trusted definition, never PR-author-controlled code.computejob (permissions: {}, no credentials,persist-credentials: false): checks out the immutablehead_sha, runsdotnet restore Cluckwork.sln --force-evaluateagainst a pinned--configfile(nuget.org-only), uploads the 7 regenerated locks. Runs the untrusted MSBuild restore but has no token to steal and no write access.commitjob (permissions: contents: write): runs zero project code — mints a short-lived GitHub App token, validates the artifact against a trusted 7-path allowlist, classifies the diff with.github/scripts/lockfix.mjs(run from the trusted default-branch checkout), and on a lock-only diff commits + non-force pushes (compare-and-swap). The App-token push re-triggers CI (aGITHUB_TOKENpush would not), which goes green.Security model + the reasoning that shaped it:
docs/superpowers/specs/2026-07-25-dependabot-lockfix-design.md.Key invariants: provenance gate (
event==pull_request, bothactorandtriggering_actor==dependabot[bot],run_attempt==1,dependabot/nuget/prefix, numeric repo-id match, noconclusion==success);head_shacheckout; non-force CAS push;create-github-app-tokenSHA-pinned; classifier fail-closed with an exact 7-path allowlist + NUL-safe parse.Create a GitHub App (Repository → Contents: Read and write), install it on this repo, and add repo Actions secrets
LOCKFIX_APP_IDandLOCKFIX_APP_PRIVATE_KEY. Until both exist, the token-mint step fails closed (no push) — nothing else breaks.Notes
workflow_runalways runs the default-branch copy, so this does nothing until it lands onmain. The first real smoke test is the next Dependabot NuGet PR after merge.dependabot/nuget/*-named branch yields a non-dependabot[bot]actor.login(the copy-cat-branch guard).Verification
.github/scripts/lockfix.mjsclassifier: 9/9node:testself-tests, wired into CI as a gate step.actionlintclean on the new workflow andci.yml.FluentValidationacross 5 locks, a singledotnet restore Cluckwork.sln --force-evaluatere-syncs all of them and dirties only lock files.