Skip to content

PIR: Add freemium eligibility and feature flag - #9779

Open
landomen wants to merge 1 commit into
developfrom
feature/landomen/pir-freemium-eligibility
Open

landomen wants to merge 1 commit into
developfrom
feature/landomen/pir-freemium-eligibility

Conversation

@landomen

@landomen landomen commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1203581873609357/task/1213684502971022?focus=true
Tech Design URL (if applicable): https://app.asana.com/1/137249556945/project/1203581873609357/task/1213689395263676?focus=true
API Proposals URL(s) (if applicable): N/A

Description

  • Adds a new feature flag for PIR Freemium that's enabled by default for internal builds.
  • Adds storing of PIR Freemium activated state
  • Updates PIR eligibility checks to account for the feature flag and stored activated state

Out of scope:

  • Writing the activated flag will be done later

Steps to test this PR

Verify PIR entry point behaves correctly

  • Remove existing subscription
  • Install this build
  • Verify you don't see PIR entry point
  • Add subscription
  • Verify you still see the PIR entry point and it opens the PIR Web dashboard

UI changes

No UI changes


Note

Medium Risk
Changes subscription gating and eligibility semantics for PIR; incorrect precedence could let freemium users run paid work or block subscribers until follow-up run-mode enforcement lands.

Overview
Introduces freemium PIR behind a new internal-default freemium() remote toggle and a PirFreemiumDataStore that persists whether the user activated freemium (read path only in this PR; setting didActivate is deferred).

canRunPir() no longer returns a bare enabled/disabled: PirEligibility.Enabled now carries PirRunMode (SCAN_AND_OPT_OUT for active PIR subscribers, SCAN_ONLY when the freemium flag is on and the user has activated). Paid entitlement is resolved before freemium so subscribers are never downgraded to scan-only. Users without subscription or PIR entitlement can still become eligible via freemium instead of always getting SUBSCRIPTION_EXPIRED / ENTITLEMENT_LOST.

Tests are updated for the new Enabled(runMode) shape and add coverage for freemium vs subscription precedence.

Reviewed by Cursor Bugbot for commit 3866103. Bugbot is set up for automated code reviews on this repo. Configure here.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@landomen
landomen added this pull request to stack #9782 September 11, 2026 08:47
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.

2 participants