Analytics on-ramp: Resolve with an empty app reads the account alone; AN-C42 reviewed
telemetry.Resolve(sqid, "") no longer reads AppKey(sqid, ""), a key the DirStore refuses (the account settings page asked that way and showed 'could not be read' there). accountAnalyticsDefault uses it, so the census card is approvals only. AN-C42 went through a one-row Luna pass, which added a sentence about existing accounts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+30
−4
analytics_cmd.go+2 −1docs/superpowers/plans/2026-10-26-analytics-onramp-copy.md+5 −1docs/superpowers/plans/LUNA-COPY-REVIEW-ANALYTICS-ONRAMP.md+10 −1internal/telemetry/telemetry.go+7 −1internal/telemetry/telemetry_test.go+6 −0
diff --git a/analytics_cmd.go b/analytics_cmd.go| index 93c06c240..71a4c1bff 100644 |
| --- a/analytics_cmd.go |
| +++ b/analytics_cmd.go |
| @@ -15,7 +15,8 @@ import ( |
| const analyticsUsage = `usage: carlos analytics --app <a> [flags] |
| Page views, daily visitors, bytes served, top pages, top referers and named |
| -events, counted at the edge. New accounts start with analytics on. |
| +events, counted at the edge. New accounts start with analytics on. Existing |
| +accounts keep their current setting. |
| --range is today, 7d or 30d; multi-day visitor totals are daily visitors |
| summed. The same view is the Analytics tab on the app's dashboard. |
diff --git a/docs/superpowers/plans/2026-10-26-analytics-onramp-copy.md b/docs/superpowers/plans/2026-10-26-analytics-onramp-copy.md| index b33875fa2..011eae691 100644 |
| --- a/docs/superpowers/plans/2026-10-26-analytics-onramp-copy.md |
| +++ b/docs/superpowers/plans/2026-10-26-analytics-onramp-copy.md |
| @@ -11,6 +11,10 @@ Luna changed 7 rows (AN-C02, C04, C06, C15, C21, C22, C40), flagged none, and |
| left 21 alone. A round with nothing flagged ends the review (AGENTS.md, |
| stopping rule 1). The text below is Luna's, verbatim. |
| +AN-C42 was added after round 1 and reviewed alone |
| +(LUNA-COPY-BRIEF-ANALYTICS-ONRAMP-C42.md, answer appended to the review |
| +file): Luna added one sentence, flagged nothing. |
| + |
| The rules (the same as the console navigation deck, |
| `2026-10-25-console-ux-nav-copy.md`): |
| @@ -78,4 +82,4 @@ What the strings are for: |
| | AN-C36 | analyticsonramp.go (`carlos apps create` refusal printed to a member) | (new) | only an owner can choose analytics for a new app. Leave out --analytics and --no-analytics to follow the account | gate | approved | |
| | AN-C40 | ../../docs/site/cli.md (carlos analytics, first paragraph) | Off until you turn it on, for one app or for the whole account. | New accounts start with analytics on. Turn it on or off for one app or for the whole account. | gate | approved | |
| | AN-C41 | ../../docs/site/cli.md (carlos apps, after the `--region` example) | (new) | `--analytics` or `--no-analytics` turns analytics on or off for the new app. Without either, the app follows the account's setting. Only an owner can choose differently from the account. | gate | approved | |
| -| AN-C42 | ../../analytics_cmd.go (`carlos analytics --help`, first paragraph; found after the Luna pass, and uses AN-C40's approved first sentence verbatim) | Off until you turn it on. | New accounts start with analytics on. | gate | approved | |
| +| AN-C42 | ../../analytics_cmd.go (`carlos analytics --help`, first paragraph; found after round 1, reviewed alone in a second Luna pass) | Off until you turn it on. | New accounts start with analytics on. Existing accounts keep their current setting. | gate | approved | |
diff --git a/docs/superpowers/plans/LUNA-COPY-REVIEW-ANALYTICS-ONRAMP.md b/docs/superpowers/plans/LUNA-COPY-REVIEW-ANALYTICS-ONRAMP.md| index 756fd4992..f0a28cd2b 100644 |
| --- a/docs/superpowers/plans/LUNA-COPY-REVIEW-ANALYTICS-ONRAMP.md |
| +++ b/docs/superpowers/plans/LUNA-COPY-REVIEW-ANALYTICS-ONRAMP.md |
| @@ -10,4 +10,13 @@ |
| Flagged rows: none. |
| -7 rows changed, 0 flagged, 21 left alone. |
| \ No newline at end of file |
| +7 rows changed, 0 flagged, 21 left alone. |
| +## Fix round: AN-C42 alone (brief: LUNA-COPY-BRIEF-ANALYTICS-ONRAMP-C42.md) |
| + |
| +| ID | current | new | why | |
| +|---|---|---|---| |
| +| AN-C42 | New accounts start with analytics on. | New accounts start with analytics on. Existing accounts keep their current setting. | Clarifies the existing-account behavior. | |
| + |
| +Flagged rows: none. |
| + |
| +Changed: 1; flagged: 0; left alone: 0. |
| \ No newline at end of file |
diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.go| index 33f7a5e0f..c0c48e52a 100644 |
| --- a/internal/telemetry/telemetry.go |
| +++ b/internal/telemetry/telemetry.go |
| @@ -105,7 +105,10 @@ type Resolved struct { |
| } |
| // Resolve reads both levels and folds them over the defaults. A store |
| -// error fails the resolve; an absent object at either level is fine. |
| +// error fails the resolve; an absent object at either level is fine. An |
| +// empty app resolves the account level alone (the account settings page and |
| +// the create form ask that way): there is no app object to read, and |
| +// AppKey(sqid, "") is a key some stores refuse outright. |
| func Resolve(ctx context.Context, s release.Store, sqid, app string) (Resolved, error) { |
| if s == nil { |
| return Fold(Settings{}, Settings{}), nil |
| @@ -114,6 +117,9 @@ func Resolve(ctx context.Context, s release.Store, sqid, app string) (Resolved, |
| if err != nil { |
| return Fold(Settings{}, Settings{}), err |
| } |
| + if app == "" { |
| + return Fold(acct, Settings{}), nil |
| + } |
| appSt, _, err := Read(ctx, s, AppKey(sqid, app)) |
| if err != nil { |
| return Fold(Settings{}, Settings{}), err |
diff --git a/internal/telemetry/telemetry_test.go b/internal/telemetry/telemetry_test.go| index 3e2dc5557..6dd3ca170 100644 |
| --- a/internal/telemetry/telemetry_test.go |
| +++ b/internal/telemetry/telemetry_test.go |
| @@ -36,6 +36,12 @@ func TestResolveAppThenAccountThenDefault(t *testing.T) { |
| if r.LogLevel != LogLevelWarn || r.Count != CountOff || r.CountFrom != "app" { |
| t.Fatalf("app override = %+v", r) |
| } |
| + // An empty app is the account level alone, on a store that refuses the |
| + // "apps/bab//telemetry.json" key a read of AppKey("bab", "") would name. |
| + r, err = Resolve(ctx, s, "bab", "") |
| + if err != nil || r.Count != CountEdge || r.CountFrom != "account" || r.LogLevel != LogLevelWarn { |
| + t.Fatalf("account alone = %+v %v", r, err) |
| + } |
| // Update preserves the other key. |
| if err := Update(ctx, s, AppKey("bab", "web"), func(st *Settings) { st.Errors = &Errors{LogLevel: LogLevelError} }); err != nil { |
| t.Fatal(err) |