Skip to content

Bug: NameError in refund.py prevents database migrations and server startup #8736

@priyanshuharshbodhi1

Description

@priyanshuharshbodhi1

Description

After pulling the latest changes from the main branch, running database migrations (uv run task db_migrate) or starting the API server fails with a NameError in server/polar/models/refund.py. The issue was introduced in commit 8fed8aae6d ("server/refund: add Refund.payment and refactor service").

Current Behavior

Running any command that imports the models (e.g., uv run task db_migrate or uv run task api) fails with:
NameError: name 'Order' is not defined

Expected Behavior

Database migrations and server startup should work without errors. The fix is to wrap the type annotations in quotes to make them forward references:

Screenshots

Environment:

Operating System: Linux (Ubuntu)
Browser: brave
Python Version: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions