Files
Felis/internal/updater/doc.go
T
flyemoji 96b3cc901c feat(updater): wire updates.Run to a caller with PaperMC v3 release discovery
internal/updates is a pure, fakes-tested decision core with no production caller,
so nothing could produce its "版本号状态" report. Add internal/updater as that caller:

- topology: the fixed platform components and their user-set policies (felis-api
  and cloudflared Scheduled+manageable; k3s Notify, high-blast-radius single node;
  velocity Notify, off-cluster and unmanageable). Minecraft is pinned by ABSENCE,
  never force-tracked here, appended from the live fleet at runtime.
- PaperMC Fill v3 release source: the v2 API (api.papermc.io) was retired
  2026-07-01 and returns HTTP 410, so this targets fill.papermc.io/v3, sends the
  required non-generic User-Agent, and returns the newest STABLE version, filtering
  the -SNAPSHOT/rc prereleases the plan would otherwise suppress. Its test fixture
  is captured from the live v3 response shape (2026-07-04).
- RoutingSource: the single ReleaseSource updates.Run requires, dispatching
  velocity to PaperMC and returning errGitHubNotWired for the GitHub-backed
  components so they degrade to "latest unknown" honestly, never a fabricated one.
- Runner: gather current versions (seam) -> assemble Components -> updates.Run ->
  Report; report-only when notifier and applier are nil.

Verification boundary: the parse/plan/compose logic is unit-tested (httptest +
fakes, fixture grounded in the live v3 shape). Live network/TLS/User-Agent
enforcement, the GitHub Releases source, the concrete version gatherer, the
notifier and applier, and the felis update CLI/CronJob remain integration work,
enumerated in doc.go.
2026-07-04 23:41:46 +09:00

31 lines
1.9 KiB
Go

// Package updater is the integration/caller side of the component self-update
// subsystem — it gives the pure decision core in internal/updates its first real
// caller. internal/updates declares the seams (ReleaseSource / Notifier / Applier)
// and orchestrates them (updates.Run) but performs no I/O; this package supplies the
// concrete wiring: the platform topology (which components Felis tracks and under
// what policy), the upstream release sources, and the Runner that gathers current
// versions, runs the plan against a maintenance window, and renders the "版本号状态"
// report.
//
// Verification boundary — stated honestly so a green test suite is not mistaken for
// "the updater works against real infra":
//
// - BUILT + UNIT-VERIFIED (Go tests, WSL oracle): the topology, the PaperMC Fill
// v3 parser (its fixture is captured from the REAL live response shape on
// 2026-07-04 — a grounded contract test, not a self-referential one), the
// routing source, and the Runner's report-only composition. These prove the
// parse/plan/compose LOGIC and that the core is now wired to a caller.
//
// - WRITTEN, NOT LIVE-VERIFIED: the tests assert the required non-generic
// User-Agent is transmitted, but real fill.papermc.io network/TLS/UA-enforcement
// is not exercised here; the fixture proves today's shape, not its future
// stability.
//
// - REMAINING INTEGRATION (not built here): the GitHub Releases source (felis-api,
// k3s, cloudflared — RoutingSource returns errGitHubNotWired for them today), the
// concrete VersionGatherer (`k3s --version`, image-tag / jar inspection), the
// concrete Notifier (SMTP + in-game) and Applier (control-plane image bump,
// cloudflared swap), the `felis update` CLI + CronJob entry point, and the
// runtime append of the live Pinned Minecraft fleet.
package updater