Skip to content

feat: tell people they are behind, without being asked - #41

Merged
AviOfLagos merged 1 commit into
mainfrom
feat/update-nudge
Sep 10, 2026
Merged

AviOfLagos merged 1 commit into
mainfrom
feat/update-nudge

Conversation

@AviOfLagos

Copy link
Copy Markdown
Owner

snare update --check only helped someone who already suspected they were out of date. The people who most need the fixes are the ones who cloned once and never thought about it again — and several defects made the scanner report a repo clean when it wasn't, which is exactly the result that stops you looking further.

Every command now surfaces it:

rule how
never blocks network check runs detached; only a cached answer is read on the command path — snare help measured at 0.03s
stays quiet one line, only when actually behind, at most once a day
sends nothing a git ls-remote against a public repo. No identifier, no telemetry

Off with SNARE_NO_UPDATE_CHECK=1; suppressed in CI and when stdout isn't a terminal, so it never lands in a pipe or a log.

Two things learned the hard way: macOS ships no setsid, and backgrounding succeeds even when the command doesn't exist — so the || fallback guarding it could never fire. The detached refresh is therefore best-effort, and the cache is also refreshed synchronously by doctor and scan github, which already wait on the network. Verified: cache populates deterministically after doctor.

Also fixed: snare version ran a live git fetch to decide whether to nudge, so a one-line command took ~5s on a slow link. It reads the cache now.

Verified: exit status preserved (findings still exit 1), silent when piped, silent under CI=1, silent with the opt-out, and renders correctly on a tty when behind.

🤖 Generated with Claude Code

`snare update --check` only ever helped someone who already suspected they
were out of date. The people who most need the fixes are the ones who cloned
once and never thought about it again — and several defects made the scanner
report a repository clean when it was not, which is precisely the result that
stops you looking further.

Every command now surfaces it, subject to three rules:

  never blocks     the network check runs detached and only a CACHED answer is
                   read on the command path. Measured: `snare help` 0.03s.
  stays quiet      one line, and only when actually behind
  sends nothing    a git ls-remote against a public repository. No identifier,
                   no telemetry, nothing about the user or their repositories.

Off with SNARE_NO_UPDATE_CHECK=1, and suppressed in CI or when stdout is not a
terminal, so it never lands in a pipe, a log or a script's output.

The detached refresh is best effort and nothing depends on it. Two things were
learned the hard way here: macOS ships no setsid, and backgrounding succeeds
even when the command does not exist, so the `||` fallback guarding it could
never fire. So the cache is also refreshed synchronously by the commands that
already wait on the network — doctor and scan github — which costs a user
nothing they would notice and makes the nudge work even where detaching does
not survive.

Also: `snare version` ran a live git fetch to decide whether to nudge, so a
command that prints one line took about five seconds on a slow link. It reads
the cache now. `update --check` still does the live check, because there the
waiting is the point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@AviOfLagos
AviOfLagos merged commit 19b1132 into main Sep 10, 2026
2 checks passed
@AviOfLagos
AviOfLagos deleted the feat/update-nudge branch September 10, 2026 10:20
AviOfLagos added a commit that referenced this pull request Sep 10, 2026
…#42)

The release notes were written twice — once in CHANGELOG.md and once as 233
lines of hand-written HTML in docs/src/changelog.html. Nothing kept them in
agreement, so the site could tell someone a fix had shipped when it had not,
which for this project is the same category of problem as a scanner reporting
clean on an infected repository.

CHANGELOG.md is the single source now. docs/changelog-gen.py renders it into
the page's existing markup: releases become sections, "### Fixed — false clean
results" and "### Fixed — destructive behaviour" mark their group and items
critical, (#41) becomes a link to the pull request, and @name becomes a profile
link. Update the changelog in a pull request and the website follows on the
next build — no second edit, and no way to drift.

CI fails if SNARE_VERSION has no matching CHANGELOG.md entry, or if the
generator produces no section for it. A version bump that forgets the changelog
would otherwise publish a page that silently omits the release.

1.2.0 itself is mostly other people's work: the remediation fix from
@phoenixdahdev (#39), which stopped `fix` deleting the build config it was
supposed to repair, and the new campaign it documents — npm's own lib/cli.js
rewritten in place, so every `npm` invocation ran the loader.

Co-authored-by: Avioflagos <ellumainc@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants