Skip to content

Revert "feat: Add analytics opt-out environment variable tests (#1118)"#1195

Merged
muddlebee merged 1 commit intomainfrom
revert-1189-feature/analytics-opt-out-tests
May 2, 2026
Merged

Revert "feat: Add analytics opt-out environment variable tests (#1118)"#1195
muddlebee merged 1 commit intomainfrom
revert-1189-feature/analytics-opt-out-tests

Conversation

@muddlebee
Copy link
Copy Markdown
Collaborator

Reverts #1189

@muddlebee muddlebee merged commit b9fff2f into main May 2, 2026
9 checks passed
@muddlebee muddlebee deleted the revert-1189-feature/analytics-opt-out-tests branch May 2, 2026 06:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🎉 MERGED! @muddlebee just shipped something. The diff gods are pleased. 🙌


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 2, 2026

Greptile Summary

This PR reverts #1189, removing two test functions (test_analytics_disabled_via_opensre_env_var and test_analytics_disabled_via_do_not_track_env_var) from tests/analytics/test_provider.py. The production implementation of the opt-out feature (_is_opted_out() in app/analytics/provider.py) remains intact, so the revert leaves the env-var-based analytics opt-out logic without any test coverage.

Confidence Score: 4/5

Safe to merge — pure test deletion with no production code changes, but removes coverage for an active feature.

Only P2 findings present; no production logic is altered. The sole concern is loss of test coverage for the opt-out env var paths that remain in the codebase.

tests/analytics/test_provider.py — the removed tests should be re-added in a follow-up PR to cover _is_opted_out() in app/analytics/provider.py.

Important Files Changed

Filename Overview
tests/analytics/test_provider.py Removes two tests covering opt-out env var behavior; the underlying _is_opted_out() implementation remains in production code, leaving it uncovered.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Analytics.__init__()"] --> B["_is_opted_out()"]
    B --> C{"OPENSRE_ANALYTICS_DISABLED == '1'\nor DO_NOT_TRACK == '1'"}
    C -- Yes --> D["self._disabled = True"]
    C -- No --> E["self._disabled = False"]
    D --> F["capture() → early return (no-op)"]
    E --> G["capture() → enqueue event"]
Loading

Comments Outside Diff (1)

  1. tests/analytics/test_provider.py, line 74 (link)

    P2 Opt-out behavior now untested

    The two removed tests covered the only code paths for _is_opted_out() — specifically that OPENSRE_ANALYTICS_DISABLED=1 and DO_NOT_TRACK=1 each set Analytics._disabled = True and suppress capture() calls. The production implementation in app/analytics/provider.py (_is_opted_out, lines 41-44) is still in place, but after this revert it has zero test coverage. Per the project's testing conventions, new features and their corresponding tests should travel together; removing the tests while keeping the feature leaves a gap that could silently regress.

    Context Used: Testing conventions and patterns (source)

Reviews (1): Last reviewed commit: "Revert "feat: Add analytics opt-out envi..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant