Skip to content

fix: pin logos-libp2p-module's libp2p input to a SHA (deleted upstream branch) - #94

Merged
dlipicar merged 2 commits into
masterfrom
fix/libp2p-deleted-branch-pin
Jul 17, 2026
Merged

fix: pin logos-libp2p-module's libp2p input to a SHA (deleted upstream branch)#94
dlipicar merged 2 commits into
masterfrom
fix/libp2p-deleted-branch-pin

Conversation

@dlipicar

Copy link
Copy Markdown
Contributor

Problem

The Nightly Bump fails at Update flake.lock:

error: unable to download 'https://api.github.com/repos/vacp2p/nim-libp2p/commits/feat/cbind/xpr-decode': HTTP error 422

logos-libp2p-module pins its libp2p input to the upstream branch github:vacp2p/nim-libp2p/feat/cbind/xpr-decode, which has been deleted upstream. The nightly step runs nix flake lock --update-input logos-libp2p-module, which re-resolves that branch ref → 422 → the step dies and the candidate is never staged.

The last-locked commit 7c73484c still exists but was never merged to master (diverged, reachable only by SHA), so there's no living ref to track — it must be pinned by SHA.

Fix

Override logos-libp2p-module's libp2p input at the workspace level to that exact SHA (7c73484cc0c57a5f649dd3d277cef1c7c4de28f0) — the commit the lock already resolved to, so it's behavior-preserving. No change to the logos-libp2p-module repo.

Three changes:

  1. scripts/ws — new get_manual_url_overrides helper (mirrors get_manual_follows), wired into the cmd_sync_graph flake.nix writer. This is the durable part: the nightly runs ws sync-graph before the lock update, which regenerates the auto-inputs block — so a hand-edited override would be wiped every run. The override must be emitted by sync-graph.
  2. flake.nix — one line pinning the input to the SHA (matches what sync-graph now emits → idempotent).
  3. flake.lock — re-locked so the libp2p node's original + locked both point at the SHA. nix/dep-graph.nix is untouched (a URL override adds no workspace follows).

Verification

  • nix flake lock --update-input logos-libp2p-module (the exact nightly command) now exits 0 with no 422.
  • ws sync-graph re-emits the override for logos-libp2p-module, so it survives the nightly.

Follow-up

Stopgap until logos-libp2p-module SHA-pins libp2p in its own flake.nix; the override can be dropped once that lands.

🤖 Generated with Claude Code

…m branch)

The nightly bump's "Update flake.lock" step failed:

  error: unable to download
  'https://api.github.com/repos/vacp2p/nim-libp2p/commits/feat/cbind/xpr-decode':
  HTTP error 422

logos-libp2p-module pins its `libp2p` input to the upstream branch
`vacp2p/nim-libp2p/feat/cbind/xpr-decode`, which was deleted. Re-locking
that input (nix flake lock --update-input logos-libp2p-module) re-resolves
the branch ref and 422s, so the candidate is never staged.

Override `libp2p` at the workspace level to the exact SHA the branch last
pointed at (7c73484c — what the lock already resolved to; never merged to
master, reachable only by SHA). Behavior-preserving.

Because the nightly runs `ws sync-graph` BEFORE the lock update — which
regenerates the auto-inputs block of flake.nix — a hand-edited override
would be wiped every run. So the override is emitted by sync-graph itself
via a new `get_manual_url_overrides` helper (mirrors `get_manual_follows`),
and also applied to the committed flake.nix/flake.lock so master is
self-consistent now.

Stopgap until logos-libp2p-module SHA-pins libp2p in its own flake.nix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the workspace’s Nix flake graph generation so the nightly lock update doesn’t fail when a downstream repo pins a now-deleted upstream branch, by overriding that downstream repo’s transitive input to a specific commit SHA.

Changes:

  • Add a scripts/ws hook (get_manual_url_overrides) so ws sync-graph can emit per-repo transitive input URL overrides into the generated flake.nix inputs block.
  • Apply a workspace-level override for logos-libp2p-module’s transitive libp2p input, pinning it to a specific nim-libp2p SHA.
  • Re-lock the workspace so the libp2p node resolves via rev (SHA) rather than an upstream ref.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
scripts/ws Introduces and wires a new sync-graph mechanism to emit transitive input URL overrides per repo.
flake.nix Adds the logos-libp2p-module.inputs.libp2p.url override to pin nim-libp2p by SHA.
flake.lock Updates the locked libp2p node to point to the SHA-pinned nim-libp2p revision.

Comment thread scripts/ws Outdated
Comment on lines +2725 to +2727
local url_overrides
url_overrides=$(get_manual_url_overrides "$input_name")
if [[ -z "$follows_sorted" && -z "$url_overrides" ]]; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8174c91 — the kept overrides are now sorted (printf | sort) before emission, so multiple overrides produce deterministic, idempotent output.

Comment thread scripts/ws Outdated
Comment on lines +2739 to +2742
while IFS=$'\t' read -r u_iname u_url; do
[[ -z "$u_iname" ]] && continue
echo " inputs.${u_iname}.url = \"${u_url}\";" >> "$flake_inputs_tmp"
done <<< "$url_overrides"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8174c91 — each override iname is now filtered against the downstream flake's declared_set (the same guard the follows path uses); a non-declared input is skipped with a warning instead of emitting a stale override.

Address review feedback on get_manual_url_overrides emission:

- Filter each override iname against the downstream flake's declared_set
  (same guard the follows path uses) so a renamed/removed upstream input
  can't leave a stale override that adds a spurious lock node; warn on skip.
- Sort the kept overrides for deterministic, idempotent flake.nix output
  when a repo ever declares more than one override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dlipicar
dlipicar merged commit 952e339 into master Jul 17, 2026
1 check 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.

2 participants