Repository navigation
feat(cloud): statistics come with FTW Cloud only, accepted once - #2112
Merged
Merged
Conversation
Fredrik decided on 28 November 2026: either no cloud at all, or FTW Cloud with the anonymous statistics included; the terms are accepted once, at pairing on the phone or the web app, and the box does not ask again. An assistant's default access length is 90 days everywhere. Statistics: - The one answer (Link.SharesStatistics) is FTW Cloud on under the current terms and nothing else. It gates the hourly upload, the fleet report, the energy report and the public driver counts. A box without Cloud sends none of them. - Stored state: statistics/share_v1 is written "off" once at start and read by nothing, so a rollback cannot start sending without Cloud. A statistics-only link an earlier release left ends, so the service deletes its rows; a grant under older terms loses a leftover stats purpose. fleet_ping.enabled is no longer read. - POST /api/cloud/stats answers 409 without Cloud; stats-policy says standalone and local_optional false. Box pages: - The Overview prompt and the "Share anonymous statistics" checkbox go. Settings → FTW app → Anonymous statistics states which case holds. - The Cloud panel shows facts once the terms are accepted. Only Cloud under earlier terms offers the current ones, in Settings. - Access counts the phone's acceptance; its blocker no longer mentions statistics-only sharing. - Assistant grants and invitations start at 90 days; a grant posted without a length lasts 90 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…runs Review of #2112: - The hourly reports carry a statistics id so Sourceful can delete them, so "anonymous statistics" was untrue for them. The Cloud panel, the pairing line and the section say "project statistics"; the section is now Settings → FTW app → Statistics and says which reports are linked to the Cloud home for 48 hours and which carry no box id. - No release names an Oblivious HTTP relay, yet comments and the energy report paragraph spoke as if one hid the address. main.go, the energyreport package doc, the panel, the config example, ADR 0008 and protocol-cloud.md now say the fleet report goes straight to FTW Cloud and the energy report is not sent. - A collector set in fleet_ping.endpoint gets no daily report without FTW Cloud; the changeset, config.example.yaml and config.go say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
The energy report waited for an independent relay that never came, so no box sent one and stats.ftw.energy showed no energy. The box now posts it to https://cloud.ftw.energy/v1/energy, as the fleet report goes to /v1/fleet (Fredrik, 12 November 2026). The body is the padded inner request (reportwire), unsealed, as message/bhttp; only a 204 counts. FTW Cloud sees the box's address while the request is open and keeps neither the address nor the report. It goes only with FTW Cloud on under the current terms and never for a site a partner controls: the sender reads the one statistics answer from #2112. The energy report has no sealed path any more: FTW Cloud's OHTTP gateway is gone (srcfl/ftw-cloud#72), so the sender always uses the direct client and the Settings preview drops its relay field. The sealed half of statsrelay stays, since fleetping.RelayProvider still calls it. Rebased onto master after #2112 and #2114. Settings, the config example, main.go, ADR 0008, architecture.md and protocol-cloud.md say where the report goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
The energy report waited for an independent relay that never came, so no box sent one and stats.ftw.energy showed no energy. The box now posts it to https://cloud.ftw.energy/v1/energy, as the fleet report goes to /v1/fleet (Fredrik, 12 November 2026). The body is the padded inner request (reportwire), unsealed, as message/bhttp; only a 204 counts. FTW Cloud sees the box's address while the request is open and keeps neither the address nor the report. It goes only with FTW Cloud on under the current terms and never for a site a partner controls: the sender reads the one statistics answer from #2112. The energy report has no sealed path any more: FTW Cloud's OHTTP gateway is gone (srcfl/ftw-cloud#72), so the sender always uses the direct client and the Settings preview drops its relay field. The sealed half of statsrelay stays, since fleetping.RelayProvider still calls it. Rebased onto master after #2112 and #2114. Settings, the config example, main.go, ADR 0008, architecture.md and protocol-cloud.md say where the report goes. Signed-off-by: Fredrik Ahlgren <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fredrik decided on 28 November 2026:
Core did otherwise:
statistics/share_v1=default, set byMigrateStatistics), could share by a local yes, and kept an old statistics-only Cloud link running.Change
Core (
go/internal/cloudlink,go/cmd/ftw):Link.SharesStatisticsis the one answer: FTW Cloud on under the current terms (ftw-cloud-2026-10-v3), and nothing else. It gates the hourly upload, the fleet report, the energy report and the public driver counts. With no Cloud link, nothing is sent. The package-levelSharesStatistics(kv),SaidYesToStatisticsandMigrateStatisticsgo.Statsrefuses without Cloud (ErrNotGranted, 409) and changes nothing under the current terms.StopStatsstill refuses under the current terms and still strips statistics from older grants./api/cloud/stats-policysaysstandalone: false,local_optional: false,local_default: "off"; its retention line names only turning Cloud off./api/agentswithoutttlSlasts 90 days (was 30).Box pages:
web/project-statistics.js: no Overview prompt in any state. The Cloud panel shows facts once the current terms are accepted ("FTW Cloud is on. Its terms include project statistics." and Turn FTW Cloud off). Only Cloud under earlier terms offers "Accept the current terms", in Settings. The Access panel offers "Accept Cloud terms and turn it on" only while Cloud is off, which is the first and only acceptance for an owner with no phone.web/settings/tabs/fleet.js: the checkbox goes and the section is now "Statistics". It says the hourly reports are linked to the Cloud home for 48 hours so Sourceful can delete them, and the daily reports carry no box id; "anonymous" was untrue for the hourly ones. One bold line states the case: "On, as part of FTW Cloud…", "Off. FTW Cloud runs under earlier terms…" or "Off. This box does not use FTW Cloud, so nothing is sent." The payload previews stay.web/settings/tabs/app.js: the pairing line stays one line and now names the statistics: "…which keeps a readable copy of your energy data and takes project statistics. Pairing accepts its terms."web/settings/tabs/access.js:defaultLengthpicks 90 days, or the longest offered when less (a box withoutlongestMsstill gives 30). Invitations offer 1, 7, 30, 90 days and a year, starting at 90. A renewal of an ended grant starts at 90. The Cloud blocker readscloudReady(cloud): link on and current terms accepted, which a phone's grant at pairing satisfies.terms3.No relay runs: comments in
main.goand theenergyreportpackage doc, the energy-report paragraph on the panel,config.example.yaml, ADR 0008 and protocol-cloud.md now say the fleet report goes straight to FTW Cloud, which sees the address, and the energy report is not sent.Docs: ADR 0008 amendment (28 November), protocol-cloud.md routes and policy note, architecture.md, agents.md (90 days), ADR 0011 line, config.example.yaml, the
fleet_pingcomment inconfig.go.Stored state
statistics/share_v1("on", "default" or "off") is written "off" at every start (cloudlink.RetireLocalStatistics) and read by nothing. "Off" also keeps a rollback to an older release from sending without Cloud; under the current Cloud terms an older release still sends, as this one does.ReconcileStatistics→End), so the service deletes its rows. A grant under older terms that still carriesstatsloses it; Cloud keeps running.cloud/statistics_decision_v1is no longer written or read.fleet_ping.enabledis not read at all.fleet_ping.endpointstill picks the collector, but a household's own collector without FTW Cloud now gets nothing. The changeset,config.example.yamlandconfig.gosay so.Contract notes for the clients
No registry change and no new field.
GET /api/cloud: same fields.statisticsandstatisticsRequiredare now equal, true only with Cloud on under the current terms.statisticsDecisionRequiredstays false.statisticsOnlyreads false after the first start.GET /api/cloud/stats-policy:policy,cloud_policy,cloud_includes_statisticsandavailableunchanged, which is what the iPhone and Android apps check.standalone,local_optionalandlocal_defaultchange as above.POST /api/cloud/grant: unchanged. A phone's grant at pairing makescloudTermsAcceptedtrue and the box asks nothing more, on the Overview, in Settings or in Access.POST /api/cloud/stats: 409 without Cloud (was 200 with a saved local yes). Only the apps' demo boxes call it.POST /api/agentswithoutttlS: 90 days.contract/registry.yamllines 192 to 194 still say "a box without Cloud keeps its own statistics answer". I left the comment alone, since changing it means copying the file into both clients; fix it in the next paired registry change.With #2007: merge this first
Merge #2112 before #2007, then rebase #2007.
git merge-treewithenergy-report-directnow conflicts in three places, all prose this PR had to correct because no relay runs:go/internal/energyreport/energyreport.gopackage doc: take feat(stats): send the daily energy report straight to FTW Cloud #2007's direct-path text, keeping "no box id" rather than "anonymous".web/settings/tabs/fleet.jsenergy paragraph: take feat(stats): send the daily energy report straight to FTW Cloud #2007's "Until then it goes straight to FTW Cloud…" in place of this PR's "Until then this release does not send it."docs/protocol-cloud.md(the 24 October / 28 November paragraph): keep this PR's paragraph and change its last sentence to say the energy report goes straight to/v1/energy.#2007's
energyLinesays "if sharing were on"; "with FTW Cloud on" matches the fleet line. Its tests do not depend on this PR's answer. Together, the energy report goes straight to FTW Cloud only from a box with Cloud on under the current terms, since itsEnabledreads the same answer, so the address FTW Cloud sees is one it already has.Paired with srcfl/ftw-web#50 (privacy page). The iPhone, Android and web apps get their side in separate PRs.
Evidence
After the review fixes (46759e8):
go test ./internal/cloudlink/ ./cmd/ftw/ ./internal/api/ ./internal/config/ ./internal/energyreport/ ./internal/fleetping/ok;npm test1072 pass, 0 fail.New or rewritten tests:
TestWithoutCloudStatisticsAreRefusedAndNothingIsShared,TestEveryEarlierLocalAnswerIsRetiredAsOff,TestTheOldLocalAnswerCountsForNothing,TestAStatisticsOnlyLinkSendsNothingAndEnds,TestOlderTermsLoseALeftoverStatsPurpose,TestABuildWithoutAServiceSharesNothing,TestBothReportsReadTheOneStatisticsAnswer(real link: no Cloud, old local yes, current terms, retired fleet switch, partner site, Cloud off),TestWithoutALinkNothingIsSent,TestTheStatisticsTermsComeOnlyWithCloud, and the web tests for each panel state,cloudReadyand the 90-day defaults.A local Core with a test config (no drivers, no Cloud):
GET /api/fleet-pingsaysenabled: false; a storedstatistics/share_v1 = defaultreadsoffafter a restart;POST /api/cloud/statsanswers 409. I looked at Settings → FTW app and Settings → Access in a browser, on that Core, with/api/cloudstubbed in the page for the Cloud-on, earlier-terms and paired states: no Overview prompt, the one-line pairing note, the facts-only panel once accepted, the single accept button under earlier terms, Access ready once accepted, and an invitation at 90 days.🤖 Generated with Claude Code