Skip to content

fix(backend): NameError on BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH - #7473

Merged
beastoin merged 2 commits into
mainfrom
fix/memories-created-nameError-7466
May 24, 2026
Merged

beastoin merged 2 commits into
mainfrom
fix/memories-created-nameError-7466

Conversation

@beastoin

@beastoin beastoin commented May 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes NameError: name 'BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH' is not defined crashing get_plan_features() for all basic (free) plan users
  • PR chore: remove unused memories-created quota/limit (display-only) #7427 removed the variable definition but missed two references in get_plan_features() (lines 664-665)
  • The variable was always 0 (env default), so the conditional always evaluated to "Unlimited memories" — replaced the 4-line dead conditional with the literal string
  • Added regression test test_basic_plan_features_include_unlimited_memories and fixed database.announcements stub in test collection

Changes

  1. backend/utils/subscription.py: Replace 4-line conditional referencing undefined variable with "Unlimited memories" literal (1 insertion, 5 deletions)
  2. backend/tests/unit/test_subscription_plans.py: Add regression test + fix database.announcements import stub for CI

Test plan

  • py_compile passes on subscription.py and users.py
  • No remaining references to BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH in backend/
  • 3/3 subscription plan tests pass (including new regression test)
  • CODEx review confirmed fix is correct and legacy_plan_features() also covered (falls through to get_plan_features)

Risks

Closes #7466

🤖 Generated with Claude Code

…ONTH reference

PR #7427 removed the variable definition but missed two references in
get_plan_features(), causing NameError for all basic-plan users.

Closes #7466

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@greptile-apps

greptile-apps Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a NameError crash in get_plan_features() caused by PR #7427 removing BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH while leaving two references to it in subscription.py. Since the variable defaulted to 0, the conditional always resolved to "Unlimited memories", so replacing it with the literal string is semantically identical and correct.

  • Removes the dead 4-line conditional in get_plan_features() and replaces it with the hardcoded string "Unlimited memories", eliminating the NameError for all basic (free) plan users.
  • No other files are changed; no remaining references to the removed variable exist in the backend.

Confidence Score: 5/5

Safe to merge — the one-line replacement is semantically identical to the deleted conditional and eliminates a live crash for all basic-plan users.

The removed conditional always evaluated to 'Unlimited memories' because its controlling variable defaulted to 0, so the literal replacement is behaviorally identical. The fix is confined to a single expression in one function, there are no remaining references to the deleted variable in the backend, and the author confirmed tests pass.

No files require special attention.

Important Files Changed

Filename Overview
backend/utils/subscription.py Removes dead conditional referencing an undefined variable and replaces it with the equivalent literal string "Unlimited memories"; fix is minimal, correct, and complete.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[get_plan_features called] --> B{plan == PlanType?}
    B -->|Pro/Neo| C[Return pro/neo feature list]
    B -->|Basic / free| D[Build basic feature list]
    D --> E[Minutes limit or Unlimited listening]
    E --> F[Words transcribed limit or Unlimited words]
    F --> G[Insights limit or Unlimited insights]
    G --> H["Unlimited memories ← hardcoded fix"]
    H --> I[Return list to caller]
Loading

Reviews (1): Last reviewed commit: "fix(backend): remove dangling BASIC_TIER..." | Re-trigger Greptile

Prevents NameError regression if memories-created quota variable
is accidentally referenced again. Also fixes test collection by
stubbing database.announcements import.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@beastoin

Copy link
Copy Markdown
Collaborator Author

All omi-pr-workflow checkpoints passed (CP0–CP9B):

  • CP4 CODEx: confirmed MUST_FIX, approach validated, legacy_plan_features() also covered
  • CP7 reviewer: PR_APPROVED_LGTM — no remaining references, diff correct
  • CP8 tester: TESTS_APPROVED — 3/3 tests pass, regression test covers the exact crash path
  • CP9A L1: backend boot-check clean, get_plan_features() returns correctly for all 4 plan types
  • CP9B L2: /v1/payments/available-plans returns 200, backend serves requests without crash

PR is ready for merge.

by AI for @beastoin

@beastoin

Copy link
Copy Markdown
Collaborator Author

lgtm

@beastoin
beastoin merged commit 813b1bd into main May 24, 2026
2 checks passed
@beastoin
beastoin deleted the fix/memories-created-nameError-7466 branch May 24, 2026 02:35
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.

NameError: BASIC_TIER_MEMORIES_CREATED_LIMIT_PER_MONTH not defined in get_plan_features

1 participant