test(scripts): self-test check-upstream-skills.sh upstream guard#53
Merged
Conversation
Adds scripts/check-upstream-skills.test.sh, completing the script self-test set in the lint-scripts gate (check-readme-index.sh and install.sh are already test-paired). The upstream guard is the highest-blast-radius drift check for this shared library, yet its parsing/control flow was unpinned. The live check-upstream-skills.sh resolves upstream targets over the network, so it can't gate PRs (an outage must never flake a contributor PR) — it runs as the scheduled '🔗 Upstream skill targets' workflow. But its OFFLINE logic can be gated: the test runs the REAL guard against self-contained fixtures with a deterministic offline 'gh' stub (keyed off the fixture repo slug), pinning 6 cases: - healthy index passes (in-house self-pointer row skipped; ## Installing scoping) - fails closed when the parser yields no upstream rows (Skills-table/parser drift) - HTTP 404 upstream target is hard drift (renamed/deleted pointer) - github URL without a /tree/ segment is unparseable - tree URL missing the path segment is malformed - a persistent 5xx is a transient warning, not drift (still exits 0) Mirrors the sibling check-readme-index.test.sh / install.test.sh idiom (real script copied into throwaway fixture trees). Adds a minimal, behaviour-preserving testability seam to the guard: the retry backoff is now an overridable command ($UPSTREAM_RETRY_SLEEP, default 'sleep' — production unchanged) so the test no-ops it and runs in <1s instead of exercising real 2+4+6s backoff. Verified the real guard still resolves all 18 live upstream targets unchanged. Wires the test into lint-scripts and documents it in AGENTS.md in lockstep. > 🤖 Generated by the Daily AI Assistant
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
Adds
scripts/check-upstream-skills.test.sh, completing the script self-test set in thelint-scriptsgate.check-readme-index.shandinstall.share already test-paired (#52, and the README-index guard self-test); the upstream guard — the highest-blast-radius drift check for this shared library — was the last one with no self-test.Why
check-upstream-skills.shresolves every upstreamgh skill installtarget against its source repo, so a typo'd/renamed/deleted pointer that slips past the offline index lockstep only fails at consume time, across every consumer. The live script needs network, so it can't gate PRs (an outage must never flake a contributor PR) — it runs as the scheduled🔗 Upstream skill targetsworkflow. But its parsing + control flow is pure offline logic a refactor can silently break, and it was unpinned.How
The test runs the real guard against self-contained fixture trees (the sibling
check-readme-index.test.sh/install.test.shidiom) with a deterministic offlineghstub keyed off the fixture repo slug — noghauth, no network. 6 cases:## InstallingURL not resolved → scoping)HTTP 404(renamed/deleted)/tree/segment<path>segment5xx(any non-404 error)It also adds a minimal, behaviour-preserving testability seam to the guard: the retry backoff is now an overridable command (
$UPSTREAM_RETRY_SLEEP, defaultsleep— production unchanged) so the test no-ops it and runs in <1s instead of exercising real 2+4+6s backoff. Verified the real guard still resolves all 18 live upstream targets unchanged (drift=0).Wired into
lint-scriptsand documented inAGENTS.mdin lockstep.Validation
shellcheck scripts/*.sh✓ ·check-readme-index.sh✓ · all self-tests green (check-readme-index9 /install6 /check-upstream-skills6) ✓ ·actionlint .github/workflows/ci.yaml✓ · livecheck-upstream-skills.sh→ 18/18 resolve, exit 0 ✓