From 8179aa3d32af15f180c9b533d61d6f03caf2280e Mon Sep 17 00:00:00 2001 From: colangelo Date: Mon, 16 Nov 2026 22:41:07 +0100 Subject: [PATCH 1/4] fix(skill): frontmatter description as a block scalar, valid YAML The plain one-line description contained ': ', which YAML forbids in an unquoted scalar. Claude Code tolerated it; Pi's strict parser and pyyaml rejected it, so Pi did not load the skill (reported by infra). The test now requires the folded block form and Pi's 1024-character limit. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++++ skill_test.go | 21 +++++++++++++++++++-- skills/hp/SKILL.md | 3 ++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e501b..2197993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to hp (hittyping) will be documented in this file. +## [Unreleased] + +### Fixed + +- Agent skill frontmatter: the `description` is a folded block scalar, so strict YAML loaders (Pi, pyyaml) accept it; an unquoted value containing ": " is invalid YAML + ## [0.8.10] - 2026-11-15 ### Fixed diff --git a/skill_test.go b/skill_test.go index a2952e6..c73fa06 100644 --- a/skill_test.go +++ b/skill_test.go @@ -20,8 +20,25 @@ func TestSkillDocumentsEveryFlag(t *testing.T) { }) } +// The description is a folded block scalar: a plain one-line value holding +// ": " is invalid YAML, which strict loaders (Pi, pyyaml) reject. func TestSkillFrontmatterNamesHp(t *testing.T) { - if !strings.HasPrefix(skillText, "---\nname: hp\ndescription: ") { - t.Errorf("skills/hp/SKILL.md must open with frontmatter naming hp; got %q", skillText[:min(40, len(skillText))]) + const head = "---\nname: hp\ndescription: >-\n" + if !strings.HasPrefix(skillText, head) { + t.Fatalf("skills/hp/SKILL.md must open with %q; got %q", head, skillText[:min(60, len(skillText))]) + } + block, _, found := strings.Cut(skillText[len(head):], "\n---\n") + if !found { + t.Fatal("skills/hp/SKILL.md frontmatter has no closing ---") + } + var words []string + for _, line := range strings.Split(block, "\n") { + if !strings.HasPrefix(line, " ") { + t.Fatalf("description line %q is not indented under the block scalar", line) + } + words = append(words, strings.TrimSpace(line)) + } + if n := len(strings.Join(words, " ")); n > 1024 { + t.Errorf("description is %d characters; Pi rejects more than 1024", n) } } diff --git a/skills/hp/SKILL.md b/skills/hp/SKILL.md index 30f49f3..a81c503 100644 --- a/skills/hp/SKILL.md +++ b/skills/hp/SKILL.md @@ -1,6 +1,7 @@ --- name: hp -description: Use when checking or watching a host's HTTP(S) latency or reachability with hp (hittyping, prettyping for HTTP): run a bounded probe, pick protocol, thresholds or display flags, or read its output (the glyph bar, the stats line, the exit summary and its UP/DOWN timeline). `hp --skill` prints this guide from the binary. +description: >- + Use when checking or watching a host's HTTP(S) latency or reachability with hp (hittyping, prettyping for HTTP): run a bounded probe, pick protocol, thresholds or display flags, or read its output (the glyph bar, the stats line, the exit summary and its UP/DOWN timeline). `hp --skill` prints this guide from the binary. --- # hp: HTTP(S) latency monitor From 37f3fcf0654336bb41e8a36436587398237f8f4d Mon Sep 17 00:00:00 2001 From: colangelo Date: Wed, 18 Nov 2026 14:51:03 +0100 Subject: [PATCH 2/4] fix: draw the last request of an odd braille run as a half cell A braille cell pairs two requests; the last one of an odd run waited for a partner that never came, so it was counted in the stats but never drawn. flushPending draws it as a left-column half cell when the run ends (count reached or Ctrl+C). A lone failure is a purple cell (dots) or a red ! (bang). Fixes #37 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + main.go | 26 +++++++++++++++++++++ main_test.go | 56 ++++++++++++++++++++++++++++++++++++++++++++++ skills/hp/SKILL.md | 3 +-- 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2197993..8f7143b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to hp (hittyping) will be documented in this file. ### Fixed +- Braille mode: the last request of an odd run (`-c 3`, or Ctrl+C after an odd count) is drawn as a half cell; before, it was counted but never shown (#37) - Agent skill frontmatter: the `description` is a folded block scalar, so strict YAML loaders (Pi, pyyaml) accept it; an unquoted value containing ": " is invalid YAML ## [0.8.10] - 2026-11-15 diff --git a/main.go b/main.go index 07b41a7..e9fd71b 100644 --- a/main.go +++ b/main.go @@ -175,6 +175,28 @@ func recordResult(s *stats, r result) { } } +// flushPending draws a braille request still waiting for its pair (the +// last one of an odd run) as a half cell, so every request is on the bar. +func flushPending(s *stats) { + if !s.braille || !s.hasPending { + return + } + s.blocks = append(s.blocks, getBrailleHalf(s.pendingRTT)) + s.hasPending = false +} + +// getBrailleHalf renders one request in the left column of a braille cell. +func getBrailleHalf(rtt time.Duration) string { + h := getBrailleHeight(rtt) + if h < 0 { + if brailleFail == failDots { + return purple + bold + "⣿" + reset + } + return red + bold + "!" + reset + } + return getColorForRTT(rtt) + string(rune(0x2800)+brailleLeft[h]) + reset +} + // lowerWorkingProto probes each protocol below current, down to minProto, // and returns the first one that answers. func lowerWorkingProto(host string, current, minProto int, timeout time.Duration, insecure bool) (int, bool) { @@ -335,6 +357,8 @@ func main() { signal.Notify(sigCh, os.Interrupt) go func() { <-sigCh + flushPending(s) + printDisplay(s) closePeriods(s) if !*o.silent { printFinal(displayURL, s) @@ -458,6 +482,8 @@ func main() { } runFixedRate(*o.count, gap, prepare, handle) + flushPending(s) + printDisplay(s) closePeriods(s) if !*o.silent { printFinal(displayURL, s) diff --git a/main_test.go b/main_test.go index a88f2be..2248cf8 100644 --- a/main_test.go +++ b/main_test.go @@ -1,6 +1,7 @@ package main import ( + "errors" "os" "testing" "time" @@ -840,3 +841,58 @@ func TestHostname(t *testing.T) { } } } + +// Issue #37: the last request of an odd braille run must still be drawn. +func TestFlushPending_OddBrailleRunDrawsEveryRequest(t *testing.T) { + ok := result{rtt: 50 * time.Millisecond} + fail := result{err: errTimeout} + tests := []struct { + name string + style failStyle + runs []result + last string + }{ + {"success-half-cell", failDots, []result{ok, ok, ok}, green + "⡀" + reset}, + {"failure-dots", failDots, []result{fail, fail, fail}, purple + bold + "⣿" + reset}, + {"failure-bang", failBang, []result{fail, fail, fail}, red + bold + "!" + reset}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + withThresholds(0, 150, 400, func() { + withFailStyle(tc.style, func() { + s := &stats{min: time.Hour, braille: true} + for _, r := range tc.runs { + recordResult(s, r) + } + flushPending(s) + if len(s.blocks) != 2 { + t.Fatalf("3 requests drew %d cells; want 2", len(s.blocks)) + } + if s.blocks[1] != tc.last { + t.Errorf("last cell = %q; want %q", s.blocks[1], tc.last) + } + flushPending(s) + if len(s.blocks) != 2 { + t.Errorf("second flush drew another cell") + } + }) + }) + }) + } +} + +func TestFlushPending_EvenRunAndBlockModeUnchanged(t *testing.T) { + ok := result{rtt: 50 * time.Millisecond} + for _, braille := range []bool{true, false} { + s := &stats{min: time.Hour, braille: braille} + recordResult(s, ok) + recordResult(s, ok) + before := len(s.blocks) + flushPending(s) + if len(s.blocks) != before { + t.Errorf("braille=%v: flush after an even run added a cell", braille) + } + } +} + +var errTimeout = errors.New("timeout") diff --git a/skills/hp/SKILL.md b/skills/hp/SKILL.md index a81c503..4a5174a 100644 --- a/skills/hp/SKILL.md +++ b/skills/hp/SKILL.md @@ -57,7 +57,7 @@ The live stats line reads `failed/total (loss%) lost; min/avg/max ms; last: N ms | red | `▆▇█` at or above `--yellow` | `⡇` | | failure | red `!` | purple `⣿` (`--fail-style dots`, default) or red `!` (`--fail-style bang`) | -- Braille cells pair two requests (left dot column = older). The cell's color is the slower one's. +- Braille cells pair two requests (left dot column = older). The cell's color is the slower one's. A request still waiting for its pair when the run ends is drawn as a half cell. - `--fail-style dots` (0.8.7+): any cell holding a failure becomes a purple `⣿`. `--fail-style bang` (behavior up to 0.8.6): red `!` only when both requests failed; one failure leaves its column blank and the cell shows the other request. Block mode ignores `--fail-style`. @@ -65,7 +65,6 @@ The live stats line reads `failed/total (loss%) lost; min/avg/max ms; last: N ms whatever earlier ones are doing, as ping does, so loss % is the share of time the host did not answer. Glyphs are drawn in send order: during an outage the bar runs up to `--timeout` behind, while up to timeout ÷ interval requests (5 with the defaults) wait in flight. -- With `-b` and an odd `-c`, the last request is counted in the stats but never drawn. ## Flags From f2e1c9120387e8f6e25d0a43f8ecc3e30f77bd5f Mon Sep 17 00:00:00 2001 From: colangelo Date: Wed, 18 Nov 2026 14:52:15 +0100 Subject: [PATCH 3/4] ci: publish Sigstore bundles, verify with --bundle cosign deprecates --signature/--certificate on verify-blob. The release now also writes .sigstore.json bundles (non-fatal step, so the release path cannot stop on it; .sig/.pem stay). verify-release and verify-installed use the bundle when the release has one and fall back to .sig/.pem for releases before v0.8.11. SECURITY.md shows --bundle. Fixes #39 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 11 ++++++++++ CHANGELOG.md | 4 ++++ SECURITY.md | 24 ++++++++++------------ justfile | 38 ++++++++++++++++++----------------- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd30742..d82596e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,6 +125,16 @@ jobs: # Sign the checksums file too cosign sign-blob --yes --output-signature checksums.txt.sig --output-certificate checksums.txt.pem checksums.txt + # Sigstore bundles replace .sig/.pem (cosign deprecates --certificate on verify). + # Kept non-fatal so the release never stops on it; verify recipes fall back to .sig/.pem. + - name: Sigstore bundles + continue-on-error: true + run: | + for file in hp-* checksums.txt; do + case "$file" in *.sig|*.pem|*.sigstore.json) continue ;; esac + cosign sign-blob --yes --bundle "${file}.sigstore.json" "${file}" + done + - name: Upload Release Assets uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 with: @@ -134,6 +144,7 @@ jobs: checksums.txt checksums.txt.sig checksums.txt.pem + checksums.txt.sigstore.json generate_release_notes: true update-homebrew: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7143b..425996c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to hp (hittyping) will be documented in this file. ## [Unreleased] +### Security + +- Releases also carry Sigstore bundles (`*.sigstore.json`); `just verify-release`, `just verify-installed` and SECURITY.md verify with `--bundle`, since cosign deprecates `--signature`/`--certificate`. Releases before v0.8.11 fall back to `.sig`/`.pem` (#39) + ### Fixed - Braille mode: the last request of an odd run (`-c 3`, or Ctrl+C after an odd count) is drawn as a half cell; before, it was counted but never shown (#37) diff --git a/SECURITY.md b/SECURITY.md index 2df30f8..d52122c 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -42,10 +42,12 @@ All release binaries are signed with [Sigstore cosign](https://docs.sigstore.dev Each release includes: - `hp--` - the binary -- `hp--.sig` - cosign signature -- `hp--.pem` - signing certificate +- `hp--.sigstore.json` - Sigstore bundle: signature and certificate (v0.8.11+) +- `hp--.sig` / `.pem` - cosign signature and certificate (kept for older instructions) - `checksums.txt` - SHA256 checksums -- `checksums.txt.sig` / `checksums.txt.pem` - signed checksums +- `checksums.txt.sigstore.json`, `checksums.txt.sig` / `.pem` - signed checksums + +Releases before v0.8.11 have no `.sigstore.json`: verify them with `--signature "${BIN}.sig" --certificate "${BIN}.pem"` in place of `--bundle`. ### Option 1: Verify before installing (download from releases) @@ -58,12 +60,10 @@ OS=$(uname -s | tr '[:upper:]' '[:lower:]') && \ ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \ BIN="hp-${OS}-${ARCH}" && \ BASE_URL="https://github.com/colangelo/HittyPing/releases/latest/download" && \ -curl -sLO "${BASE_URL}/${BIN}" && \ -curl -sLO "${BASE_URL}/${BIN}.sig" && \ -curl -sLO "${BASE_URL}/${BIN}.pem" && \ +curl -fsSLO "${BASE_URL}/${BIN}" && \ +curl -fsSLO "${BASE_URL}/${BIN}.sigstore.json" && \ cosign verify-blob \ - --signature "${BIN}.sig" \ - --certificate "${BIN}.pem" \ + --bundle "${BIN}.sigstore.json" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ "${BIN}" @@ -84,15 +84,13 @@ OS=$(uname -s | tr '[:upper:]' '[:lower:]') && \ ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \ BIN="hp-${OS}-${ARCH}" && \ BASE_URL="https://github.com/colangelo/HittyPing/releases/download/v${VERSION}" && \ -curl -sLO "${BASE_URL}/${BIN}.sig" && \ -curl -sLO "${BASE_URL}/${BIN}.pem" && \ +curl -fsSLO "${BASE_URL}/${BIN}.sigstore.json" && \ cosign verify-blob \ - --signature "${BIN}.sig" \ - --certificate "${BIN}.pem" \ + --bundle "${BIN}.sigstore.json" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ "${HP_PATH}" && \ -rm -f "${BIN}.sig" "${BIN}.pem" +rm -f "${BIN}.sigstore.json" ``` Or if you have the repo cloned: `just verify-installed` diff --git a/justfile b/justfile index 283ac4e..9f999af 100644 --- a/justfile +++ b/justfile @@ -75,15 +75,16 @@ verify-release: cd "$DIR" echo "Downloading ${BIN} into ${DIR}..." curl -fsSLO "${BASE_URL}/${BIN}" - curl -fsSLO "${BASE_URL}/${BIN}.sig" - curl -fsSLO "${BASE_URL}/${BIN}.pem" - echo "Verifying signature..." - cosign verify-blob \ - --signature "${BIN}.sig" \ - --certificate "${BIN}.pem" \ - --certificate-oidc-issuer https://token.actions.githubusercontent.com \ - --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ - "${BIN}" + ID=(--certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp 'github.com/colangelo/HittyPing') + if curl -fsSLO "${BASE_URL}/${BIN}.sigstore.json" 2>/dev/null; then + echo "Verifying Sigstore bundle..." + cosign verify-blob --bundle "${BIN}.sigstore.json" "${ID[@]}" "${BIN}" + else + echo "No Sigstore bundle (release before v0.8.11): verifying .sig/.pem..." + curl -fsSLO "${BASE_URL}/${BIN}.sig" + curl -fsSLO "${BASE_URL}/${BIN}.pem" + cosign verify-blob --signature "${BIN}.sig" --certificate "${BIN}.pem" "${ID[@]}" "${BIN}" + fi chmod +x "${BIN}" echo "Verified! Binary: ${DIR}/${BIN}" @@ -119,15 +120,16 @@ verify-installed: DIR=$(mktemp -d "${TMP%/}/hp-verify-installed.XXXXXX") trap 'rm -rf "$DIR"' EXIT echo "Downloading signatures for ${BIN}..." - curl -fsSL -o "${DIR}/${BIN}.sig" "${BASE_URL}/${BIN}.sig" - curl -fsSL -o "${DIR}/${BIN}.pem" "${BASE_URL}/${BIN}.pem" - echo "Verifying..." - cosign verify-blob \ - --signature "${DIR}/${BIN}.sig" \ - --certificate "${DIR}/${BIN}.pem" \ - --certificate-oidc-issuer https://token.actions.githubusercontent.com \ - --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ - "${HP_PATH}" + ID=(--certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp 'github.com/colangelo/HittyPing') + if curl -fsSL -o "${DIR}/${BIN}.sigstore.json" "${BASE_URL}/${BIN}.sigstore.json" 2>/dev/null; then + echo "Verifying Sigstore bundle..." + cosign verify-blob --bundle "${DIR}/${BIN}.sigstore.json" "${ID[@]}" "${HP_PATH}" + else + echo "No Sigstore bundle (release before v0.8.11): verifying .sig/.pem..." + curl -fsSL -o "${DIR}/${BIN}.sig" "${BASE_URL}/${BIN}.sig" + curl -fsSL -o "${DIR}/${BIN}.pem" "${BASE_URL}/${BIN}.pem" + cosign verify-blob --signature "${DIR}/${BIN}.sig" --certificate "${DIR}/${BIN}.pem" "${ID[@]}" "${HP_PATH}" + fi echo "Verified! ${HP_PATH} matches signed release v${VERSION}" # Check that verify-release and verify-installed leave the checkout untouched (needs network, cosign, an installed hp) From 6c9465a8d8f645ff6aadfb44fbab426e27505ae6 Mon Sep 17 00:00:00 2001 From: colangelo Date: Wed, 18 Nov 2026 14:53:00 +0100 Subject: [PATCH 4/4] chore: prepare v0.8.11 release Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- ROADMAP.md | 6 ++++++ main.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 425996c..dd0c8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to hp (hittyping) will be documented in this file. -## [Unreleased] +## [0.8.11] - 2026-11-18 ### Security diff --git a/ROADMAP.md b/ROADMAP.md index f64ac64..d18bee4 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -74,6 +74,12 @@ If hp evolves toward interactive features, consider migrating to [Bubble Tea](ht ## Completed +### v0.8.11 - Braille Odd Runs & Sigstore Bundles + +- [x] Last request of an odd braille run drawn as a half cell (#37) +- [x] Sigstore bundles on releases; verify with `--bundle` (#39) +- [x] Skill frontmatter is valid YAML for strict loaders (Pi) + ### v0.8.10 - go install & Fuzzing - [x] Module path matches the repository, so `go install github.com/colangelo/HittyPing@latest` works diff --git a/main.go b/main.go index e9fd71b..119705c 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ import ( // cleanly pause rendering before the process is actually stopped. var displayMu sync.Mutex -const version = "0.8.10" +const version = "0.8.11" //go:embed skills/hp/SKILL.md var skillText string