Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -134,6 +144,7 @@ jobs:
checksums.txt
checksums.txt.sig
checksums.txt.pem
checksums.txt.sigstore.json
generate_release_notes: true

update-homebrew:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to hp (hittyping) will be documented in this file.

## [0.8.11] - 2026-11-18

### 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)
- 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
Expand Down
6 changes: 6 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 11 additions & 13 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ All release binaries are signed with [Sigstore cosign](https://docs.sigstore.dev

Each release includes:
- `hp-<os>-<arch>` - the binary
- `hp-<os>-<arch>.sig` - cosign signature
- `hp-<os>-<arch>.pem` - signing certificate
- `hp-<os>-<arch>.sigstore.json` - Sigstore bundle: signature and certificate (v0.8.11+)
- `hp-<os>-<arch>.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)

Expand All @@ -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}"
Expand All @@ -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`
Expand Down
38 changes: 20 additions & 18 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -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)
Expand Down
28 changes: 27 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -458,6 +482,8 @@ func main() {
}

runFixedRate(*o.count, gap, prepare, handle)
flushPending(s)
printDisplay(s)
closePeriods(s)
if !*o.silent {
printFinal(displayURL, s)
Expand Down
56 changes: 56 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"os"
"testing"
"time"
Expand Down Expand Up @@ -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")
21 changes: 19 additions & 2 deletions skill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 3 additions & 3 deletions skills/hp/SKILL.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -56,15 +57,14 @@ 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`.
- One glyph is one `--interval` of wall time, up or down (a braille cell is two). A request starts every interval
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

Expand Down
Loading