Skip to content

feat: update pullgate from Telegram: a notice for each new release, /update installs it with its units - #43

Merged
groupsky merged 2 commits into
mainfrom
hq-job/pullgate-9-update/r-20261118-123019-48ed
Nov 18, 2026
Merged

groupsky merged 2 commits into
mainfrom
hq-job/pullgate-9-update/r-20261118-123019-48ed

Conversation

@groupsky

Copy link
Copy Markdown
Contributor

Fixes #9

What it does

  • pullgate update (root) runs from pullgate-update.timer (daily) and pullgate-update.path (/update and taps). It uses the copy of install.sh that is built into the binary (embed.go).
  • Daily notice: one per new release that passed the SHA-256 and attestation checks: version, release link, "send /update to install it". A security release (a ### Security section in its notes) says so first and repeats every 23 h until installed. A release that fails a check gets a warning, never the hint. [updates] check = false in listener.toml turns it off.
  • /update: the listener writes a check request to _update/check/request (no data from the message). Root checks the release and asks with the version, the tarball, its SHA-256 and the release link. A newer release closes an open question and asks again.
  • Apply: root takes version and SHA-256 from its own state, forward only. It keeps the old binary as .pullgate.prev (hard link), runs install.sh --version V --sha256 H --forward-only (every check again; the tarball must have the SHA-256 of the question), runs pullgate version, installs the units the new binary prints (pullgate units) where they differ, daemon-reload, reenable + restart, restarts the listener last and checks that it stays active. On failure it puts back the old binary and units. The new listener sends the report, with the units it changed and every drop-in.
  • Name space: _update (not a valid instance name).
  • New install.sh flags: --check-only (no code of the release runs before the tap), --sha256, --forward-only.
  • Docs: DESIGN.md section 15 rewritten, THREAT-MODEL.md T5, T10, T13, new T20; README "Update pullgate: /update".

Tests

  • internal/selfupdate: real built-in install.sh against a fake release (fake curl, gh, uname): TestUpdateAsksAndInstalls, TestUpdateDenyPaths (wrong SHA-256, failed attestation, before the question and on Apply), TestWrongVersion, TestApplyInstallsOnlyTheApprovedFile, TestOlderVersionIsNeverInstalled, TestNewerReleaseClosesTheOpenQuestion, TestSkip, TestExpiredQuestion, TestNewBinaryDoesNotStart (rollback), TestCrashInTheSwap (T10), TestDailyNotice, TestUnitUpdate, TestRollbackOfANewTemplate, TestUnitListCheck, TestUpdateRequestLimit, TestDevBuildDoesNotUpdate.
  • Listener: TestUpdateCommand, TestUpdateCommandWithoutDirectory, TestUpdateQuestionsAreTheirOwn (an instance named pullgate does not touch the updates).
  • embed_test.go: the enable list is the README start block; the embedded files are the repo's.
  • CI install-loop (test: CI installs pullgate as the README says and runs a full loop under the real units #27): builds this commit as 900.0.0 and 900.0.1, installs the first by the README, then /update on the fake Telegram installs the second from a fake GitHub (fake /usr/bin/curl, fake gh via [updates] gh, because a CI build has no attestation), puts back a changed unit and lists a drop-in.

Reviews

A security review subagent and a correctness review subagent ran on the diff. Fixed: the daily look ran the new binary before a tap (now --check-only runs no release code); the rollback now runs with a context that a stop does not cancel; a rollback disables instances of a new template unit; the output cap; a lost question is sent again on /update; an /update sent with a tap is not dropped silently; a broken state removes the request and tells the owner; question IDs come from the clock; network errors before the checks are not reported as a failed release; the CI fake release has the tag API path.

Not fixed, on purpose (low):

  • A changed tarball under the same version closes the old question and asks again, without its own warning. The new question shows the new SHA-256, and the old one is closed.
  • The systemctl helper has a 2-minute timeout but no output cap or process-group kill (systemctl is the system's own program).
  • A network error during gh attestation verify (Sigstore root fetch) is reported as a failed check, once per release.
  • A start of the path unit for a tap's .tmp- file is caught by the HasCheck / approvals test only partly.

🤖 Generated with Claude Code

groupsky and others added 2 commits November 18, 2026 12:55
…update installs it with its units

pullgate update (root, pullgate-update.timer and pullgate-update.path)
looks for a new release with the copy of install.sh built into the
binary. It sends one notice per new release that passed the SHA-256 and
attestation checks (a security release says so and repeats daily), and
a warning for a release that failed them. /update asks with the version,
the SHA-256 and the release link. Apply installs only that tarball, with
every check again, then the units the new binary carries, reloads,
re-enables and restarts them, restarts the listener last, and rolls
back when the listener does not stay active.

Fixes #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@groupsky
groupsky merged commit 8823788 into main Nov 18, 2026
10 checks passed
@groupsky
groupsky deleted the hq-job/pullgate-9-update/r-20261118-123019-48ed branch November 18, 2026 11:03
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.

feat: update pullgate from Telegram: a notice for each new release, /update installs it with its units

1 participant