Skip to content

test(scripts): self-test check-upstream-skills.sh upstream guard#53

Merged
devantler merged 1 commit into
mainfrom
claude/test-check-upstream-skills-guard
Jun 26, 2026
Merged

test(scripts): self-test check-upstream-skills.sh upstream guard#53
devantler merged 1 commit into
mainfrom
claude/test-check-upstream-skills-guard

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Assistant

What

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 (#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.sh resolves every upstream gh skill install target 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 targets workflow. 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.sh idiom) with a deterministic offline gh stub keyed off the fixture repo slug — no gh auth, no network. 6 cases:

Case Expect
healthy index (in-house self-pointer row skipped; ## Installing URL not resolved → scoping) pass
parser yields no upstream rows (Skills-table / parser drift) fail closed
upstream target HTTP 404 (renamed/deleted) hard drift / fail
github URL with no /tree/ segment unparseable / fail
tree URL missing the <path> segment malformed / fail
persistent 5xx (any non-404 error) transient warning, still exits 0

It also 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 (drift=0).

Wired into lint-scripts and documented in AGENTS.md in lockstep.

Validation

shellcheck scripts/*.sh ✓ · check-readme-index.sh ✓ · all self-tests green (check-readme-index 9 / install 6 / check-upstream-skills 6) ✓ · actionlint .github/workflows/ci.yaml ✓ · live check-upstream-skills.sh → 18/18 resolve, exit 0 ✓

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
@devantler devantler marked this pull request as ready for review June 26, 2026 06:51
@devantler devantler merged commit 07fe8f8 into main Jun 26, 2026
15 checks passed
@devantler devantler deleted the claude/test-check-upstream-skills-guard branch June 26, 2026 12:13
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.

1 participant