fix(registry): check the ref a package is built from, not HEAD - #106
Merged
Conversation
`getHeadCommit` always asked for HEAD, so once a definition pinned a `ref` the skip-if-unchanged check compared the built branch's stored commit against the default branch's tip. For lucia that is fc016ca8 (v3) versus c3c9f7ed (main) — never equal, so it would clone, rebuild and republish every night for a package frozen since 2024. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R
|
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.
Follow-up to #105, which added
refto unversioned git sources and pinned lucia to itsv3branch.The bug
getHeadCommit(url)always rangit ls-remote <url> HEAD— the default branch. Both skip-if-unchanged checks inpublish-allcalled it without the ref, so a package built from a branch had its storedsource_commitcompared against a completely unrelated commit.For lucia, measured against the real remote:
Those can never be equal, so the skip never fires: lucia would be cloned, rebuilt and republished on every nightly run, forever, for a package whose docs have not changed since 2024. Not a failure — just permanent wasted work and an unnecessary republish of identical content each night.
The fix
getHeadCommit(url, ref?)resolves the ref it is given, and both call sites passdef.source.ref. Behaviour for definitions without arefis unchanged.Verified against the real remote: the two calls now return different commits, and the one used for the check matches what
buildUnversionedrecords.No changeset —
@neuledge/registryisprivate: true.How this was found
#105 merged without the adversarial review pass I'd planned, because the review agent died on a session limit and the nightly registry job had already failed five nights running. I judged the trade worth it and said so at the time. This is the defect that slipped through — found while confirming the lucia fix actually worked, not by the review that never ran.
Worth noting it is the quiet kind: everything goes green, nothing alerts, the registry just does redundant work indefinitely.
Not covered
getHeadCommithas no unit test — it shells out togit ls-remote, andpackages/registryhas no test harness forbuild.tsor any network-touching code. Adding one means either a network-dependent test or mockingexecSync, neither of which fits the existing test setup. Verified empirically against the live remote instead.Generated by Claude Code