Repository navigation
feat(countme): implement weekly countme client reporting to countme.projectbluefin.io - #69
mrbobbytables wants to merge 2 commits into
Conversation
Implement weekly client reporting to countme.projectbluefin.io following Project Bluefin ADR 0006. - Add /usr/libexec/utah-countme script to compute weekly cohort bucket, extract image metadata (repo, tag, flavor, arch), and send empty GET ping. - Add systemd units utah-countme.service and utah-countme.timer with DynamicUser=yes and StateDirectory=utah-countme. - Enable utah-countme.timer in 85-utah-desktop.preset and configure-services.sh. - Add utah-countme.timer to contracts/bluefin-desktop.toml. - Support opt-out via /etc/projectbluefin/countme/disabled. - Add unit tests for utah-countme in tests/unit/test_countme.py. - Update desktop-contract skill and regenerate catalog. Closes projectbluefin#49 Assisted-by: Gemini 3.8 Flash via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
hanthor
left a comment
There was a problem hiding this comment.
Telemetry enabled by default needs a maintainer sign-off, not a code review
The implementation is careful — DynamicUser=yes, StateDirectory=, RandomizedDelaySec=12h, Persistent=true, a 7-day throttle via lastrun, Fedora-style cohort bucketing so the value is coarse, and an empty GET with no body. That is close to the DNF countme design and about as low-impact as this kind of reporting gets.
But this is the one PR in the queue that adds an outbound network call from every installed system, and the changes enable it by default:
system_files/shared/usr/lib/systemd/system-preset/85-utah-desktop.presetenablesutah-countme.timerscripts/configure-services.shconfigures itcontracts/bluefin-desktop.tomladds it to the enabled-services contract, soverify-desktop-contract.pywill now fail the build if it is ever absent
That last one is the part that needs thought. Adding the timer to the desktop contract means telemetry becomes a build-time invariant — an image that ships without it is a contract violation. That is a strong statement to encode as a side effect of a feature PR, and it makes the opt-out path harder to reason about later.
Opt-out is /etc/projectbluefin/countme/disabled, a file the user must know to create. That is opt-out-by-obscurity; nothing surfaces it. Please confirm ADR 0006 actually specifies default-on with a filesystem opt-out, and link the ADR — the body references it but does not link it, and it is the entire justification for the default.
Specific things to address
1. Document what is transmitted, in the repo. The query string is repo=utah&tag=${IMAGE_TAG}&flavor=${IMAGE_FLAVOR}&arch=${ARCH}&countme=${BUCKET}. That should be written down in docs/skills/desktop-contract.md next to the opt-out path, in plain terms, including what the server logs (IP address, necessarily). Users and downstream packagers will ask.
2. DynamicUser=yes plus a persistent epoch is in tension. The cohort bucket is computed from /var/lib/utah-countme/epoch, which must survive across boots and be stable, while DynamicUser=yes gives a different UID each run. StateDirectory= handles the ownership remapping, but please confirm the epoch file is actually readable on the second run and that a failed read degrades to "no ping" rather than "recreate epoch", since silently recreating it would reset every machine to bucket 1 forever and make the data meaningless.
3. Failure behaviour. What happens when countme.projectbluefin.io is unreachable — a common case on a machine that is offline or behind a captive portal? The service must not retry aggressively, must not fail the boot, and ideally should not update lastrun on failure in a way that skips a real week. Worth stating.
4. --fail and timeouts on the curl. A hung connection on a weekly timer is harmless-ish, but an explicit --max-time is cheap insurance.
Process notes
CI never ran. Build Utah is action_required (run 34651757332) — fork PRs need maintainer approval to execute. So just check did not run, and neither did the new tests/unit/test_countme.py, despite the description reporting them passing locally.
The base is red. main@636b48e fails Build Utah at Containerfile:81 (run 34654001732), so no image can be built to test this against until #56 lands with its typo fixed.
Conflicts. #62 also edits scripts/configure-services.sh, contracts/bluefin-desktop.toml, 85-utah-desktop.preset and docs/skills/desktop-contract.md — the same four files. #63 and #61 also regenerate docs/skills/index.json / index.md. Expect conflicts.
The code is fine. The default-on decision and the contract entry are what need an explicit maintainer yes before this merges.
Generated by Claude Code
Document query string parameters, empty GET payload, and server logging in docs/skills/desktop-contract.md. Harden utah-countme client to degrade to no-op on unreadable or corrupt epoch file rather than resetting cohort age to bucket 1. Add unit tests verifying corrupt epoch handling and curl failure behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
|
Thanks @hanthor! Addressed the feedback:
🐝 Hive Agent:
|
hanthor
left a comment
There was a problem hiding this comment.
This merges clean and the feature is wanted (countme parity with Bluefin), but two things before it can land:
- Test layout — same note as #40/#80:
tests/unit/test_countme.pyunder pytest is never collected byjust check, which runspython3 -m unittest discover -s tests -p 'test_*.py'. Please port totests/test_countme.pyasunittest.TestCases so the 222 lines of coverage actually run in CI. - Preset + enable — you add
utah-countme.timerto bothconfigure-services.shand85-utah-desktop.preset, which is right (bootc re-applies presets on first boot, so a bareenableis undone;tests/test_package_resolution.pyonmainnow asserts exactly this pairing once #105 lands — worth running against it).
One question from the diff rather than a change: utah-countme posts to countme.projectbluefin.io — is that endpoint live for Utah's image name, or does it need the server side to know utah first? If the latter, the timer should probably ship disabled until it does.
Generated by Claude Code
|
Closing rather than holding it open for the rework in the review above; the feature is wanted and a fresh PR with the tests in Generated by Claude Code |
Summary
Implements weekly countme client reporting to
countme.projectbluefin.iomatching Project Bluefin ADR 0006.Resolves #49
Changes
/usr/libexec/utah-countme):/usr/share/ublue-os/image-info.jsonor/etc/os-releaseto extractrepo=utah,tag,flavor, andarch./var/lib/utah-countme/epoch./var/lib/utah-countme/lastrun.https://countme.projectbluefin.io/metalink?repo=utah&tag=${IMAGE_TAG}&flavor=${IMAGE_FLAVOR}&arch=${ARCH}&countme=${BUCKET}./etc/projectbluefin/countme/disabledexists.utah-countme.service: One-shot service running underDynamicUser=yeswithStateDirectory=utah-countme.utah-countme.timer: Weekly timer withRandomizedDelaySec=12handPersistent=true.85-utah-desktop.presetand configured viascripts/configure-services.sh.utah-countme.timertocontracts/bluefin-desktop.tomlenabled services.docs/skills/desktop-contract.mdwith telemetry architecture and regenerated catalog.tests/unit/test_countme.pycovering opt-out behavior, epoch creation, metadata extraction, throttling, and cohort bucket calculation.just check.— hive: backend=copilot model=gemini-3.8-flash
🐝 Hive Agent:
contributor| SHA:0ba4fb2