Skip to content

fix: respect minimal telemetry on manual stats send and download - #12570

Merged
rubenfiszel merged 2 commits into
mainfrom
fix-minimal-toggle-usage-git-sync
Nov 20, 2026
Merged

rubenfiszel merged 2 commits into
mainfrom
fix-minimal-toggle-usage-git-sync

Conversation

@hugocasa

@hugocasa hugocasa commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

With minimal telemetry on (the disable_stats setting in EE), the scheduled send drops the detailed sections, but the superadmin Send usage and Download usage actions always built the full payload (minimal = false). Git sync usage was also never gated on minimal, so even the scheduled minimal payload carried it.

Changes

  • windmill-api-settings: send_stats and get_stats pass the disable_stats setting as minimal, the same value the scheduled send uses. Both read the saved setting, so a toggle change has to be saved before it applies.
  • EE (stats_ee.rs, companion PR windmill-labs/windmill-ee-private): git_sync_usage is omitted when minimal is true, like feature_usage, instance_onboarding, resource_usage and infra_info.
  • ee-repo-ref.txt bumped to the companion commit.

Test plan

  • EE binary (enterprise,private), one git sync repo configured, GET /api/settings/get_stats:
    • disable_stats=false: git_sync_usage {sync_repos: 1}, onboarding, resource usage and infra info present
    • disable_stats=true: all four are absent
  • Send usage not observed on the wire (needs dev_override to point at a local stats stub); it calls the same payload builder with the same flag.

🤖 Generated with Claude Code


Summary by cubic

Fixes manual telemetry actions so they respect the minimal telemetry setting, matching the scheduled send behavior.

Previously, the superadmin Send usage and Download usage actions always built the full stats payload even when disable_stats was enabled, and git sync usage was included in scheduled minimal payloads too. Now both manual actions read the saved disable_stats setting and pass it as the minimal flag, and git sync usage is omitted from minimal payloads in the EE code.

  • The setting is read from the saved value, so a toggle change must be saved before it applies to the next manual send or download.

Written for commit e5438aa. Summary will update on new commits.

View guided diff Turn on auto-fix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: e5438aa
Status:⚡️  Build in progress...

View logs

@hugocasa

Copy link
Copy Markdown
Collaborator Author

/review

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @hugocasa's task in 40s —— View job


Good to merge

Review

  • Read AGENTS.md / backend/AGENTS.md
  • Read the diff (git diff origin/main...HEAD)
  • Compared against the scheduled send path in stats_ee.rs

What changed: send_stats and get_stats in backend/windmill-api-settings/src/lib.rs:1596,1637 now pass get_disable_stats_setting(&db).await as minimal, where they used to pass a hard-coded false. Both handlers already check require_super_admin before this point. The change adds one global_settings lookup per manual call, which costs nothing that matters.

Matches the scheduled path: On EE (enterprise), the scheduler in stats_ee.rs (~L1302) sends minimal = disable_stats, so the manual actions now behave the same. Two edge cases differ from the scheduler, and both are fine:

  • EE with an offline key and disable_stats=true: the scheduler sends nothing, but a manual Send usage still sends a minimal payload. The superadmin clicked it on purpose, so this is reasonable.
  • private build without enterprise: the scheduler skips sending entirely. A manual send is now minimal, which is a stricter result than before.

CE: the OSS get_disable_stats_setting always returns false, so CE behaviour does not change.

Companion EE change: the stats_ee.rs in this checkout still collects git_sync_usage without checking minimal (around L2073). It probably comes from the previous ref, so I couldn't check the companion commit aa41f42 myself. When you review the companion PR, confirm that git_sync_usage is wrapped in if !minimal like feature_usage and instance_onboarding.

Findings

None.

AGENTS.md compliance

No violations. The change is small, adds no comments that just narrate the code, and the EE ref bump follows docs/enterprise.md.

Test coverage

Backend: only two call-site arguments changed, and the payload builder underneath was already in place. A unit test wouldn't protect anything meaningful, so none is expected.

Manual verification: the PR's own test plan already covers GET /api/settings/get_stats with the toggle on and off. One thing is still untested: what Send usage puts on the wire. Point dev_override at a local stub, save disable_stats=true, click Send usage in superadmin settings, and check that the posted body has no git_sync_usage, feature_usage, instance_onboarding, resource_usage or infra_info. The handler calls the same builder with the same flag, so the risk here is low.

@github-actions

Copy link
Copy Markdown
Contributor

Pi Review

Good to merge

The change is a small, correct fix: the superadmin Send usage (send_stats) and Download usage (get_stats, EE) handlers now pass windmill_common::stats_oss::get_disable_stats_setting(&db).await as the minimal flag instead of hardcoded false, matching what the scheduled sender in schedule_stats computes (minimal = disable_stats in the enterprise path). The companion EE commit (via the ee-repo-ref.txt bump) gates git_sync_usage on !minimal, consistent with the other detailed sections.

I verified:

  • get_disable_stats_setting reads DISABLE_STATS_SETTING, the same setting and helper the scheduled path uses, and is available in both private (re-exported from stats_ee) and non-private (returns false) builds, so the fully-qualified call compiles in all feature combinations.
  • Both handlers were already async and already called stats_oss::send_stats / get_stats_payload, so the added await is placed correctly and there are no borrow or feature-gate issues.
  • In OSS builds send_stats is a no-op and get_stats returns BadRequest, so behavior is unchanged there.
  • The only other non-test callers of get_stats_payload are sqlx::test tests in backend/src/ee.rs that intentionally pass minimal=false; they are unaffected.

Considered and dismissed

  • Offline-license skip not replicated in manual send: the scheduled path skips sending entirely when disable_stats && offline, while a manual send still emits a (now minimal) payload. This is not a regression — previously the manual action always built the full payload — and a superadmin explicitly triggering a send is a deliberate action, so I don't treat it as a defect.
  • Non-enterprise private build mismatch (scheduled skips, manual sends minimal): get_stats/download is enterprise-gated, and the manual send_stats is an explicit admin action; this edge feature combination is not the PR's target and was already inconsistent before this change.
  • get_disable_stats_setting defaults to false on read/parse error, which would send the full payload: this is the same helper the scheduled path already relies on, so behavior is consistent, and defaulting to "send full" on error is a pre-existing choice not introduced here.
  • Minimal payload still carries user_usage/plain emails: identical to the scheduled minimal payload; pre-existing and out of scope.
  • Unverifiable ee-repo-ref.txt hash: standard workflow; the PR body describes the companion change and the test plan confirms the EE behavior.
  • Doc comment on get_stats_payload ("skip job_usage, daily_job_usage, and workspace_usage") doesn't enumerate git_sync_usage/feature_usage/etc.: that comment lives in the private EE repo (not this diff), was already incomplete before this PR, and I cannot see the companion diff to confirm whether it was updated.

Test coverage

Backend change, but the public-repo diff is a three-line plumbing fix (passing an existing helper's result as a flag); the gating logic itself lives in the EE companion. No automated tests were added in the public repo, which is reasonable for a flag pass-through, and there are no integration tests exercising the manual send/download handlers here — worth noting, though the change is too thin to meaningfully unit test on its own.

Manual verification is still needed for the Send usage action, which the PR author already flagged as unobserved on the wire: with disable_stats=true, trigger POST /api/settings/send_stats (or the UI button) against a local stats stub and confirm the emitted payload omits the detailed sections (git_sync_usage, feature_usage, instance_onboarding, resource_usage, infra_info) exactly as GET /api/settings/get_stats already does per the completed test-plan item.

@github-actions

Copy link
Copy Markdown
Contributor

Codex Review

Good to merge

No issues found.

Test coverage

No automated regression tests were added. The PR reports EE download verification with minimal telemetry enabled and disabled. I did not run tests or exercise a live instance. I inspected the pinned EE source; the previous EE ref was unavailable locally for comparison.

Manual Send usage verification remains: capture requests with a local telemetry stub under both saved settings and confirm detailed sections, including git_sync_usage, are omitted when minimal telemetry is enabled.

This commit updates the EE repository reference after PR #1001 was merged in windmill-ee-private.

Previous ee-repo-ref: aa41f4277be8f39dc71cbb044f817da0fcb82a4f

New ee-repo-ref: d01848c5a62d19896cf5c67dd0b69582e5365be9

Automated by sync-ee-ref workflow.
@windmill-internal-app

Copy link
Copy Markdown
Contributor

🤖 Updated ee-repo-ref.txt to d01848c5a62d19896cf5c67dd0b69582e5365be9 after windmill-ee-private PR #1001 was merged.

@windmill-internal-app windmill-internal-app Bot changed the title [ee] fix: respect minimal telemetry on manual stats send and download fix: respect minimal telemetry on manual stats send and download Nov 20, 2026
@rubenfiszel
rubenfiszel marked this pull request as ready for review November 20, 2026 15:32
@claude

claude Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@rubenfiszel
rubenfiszel merged commit a44f315 into main Nov 20, 2026
17 of 20 checks passed
@rubenfiszel
rubenfiszel deleted the fix-minimal-toggle-usage-git-sync branch November 20, 2026 15:32
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants