Context
app_helpers.py declares the default model id in two places:
as a key in the AVAILABLE_MODELS dict, and again as the
top-level constant DEFAULT_MODEL_ID = "minimax-m3-free". If
the catalogue ever changes (a model is renamed, a new default
ships), a contributor has to remember to update both. The
existing AppHelpersModuleTests already pins the invariant
"DEFAULT_MODEL_ID must be in AVAILABLE_MODELS" — this
turns the test into a structural guarantee.
What to change
In app_helpers.py, define DEFAULT_MODEL_ID as the first
Free-tier entry of AVAILABLE_MODELS:
DEFAULT_MODEL_ID = next(
mid for mid, info in AVAILABLE_MODELS.items()
if info.get("tier") == "Free"
)
The catalogue declaration should keep its existing order — the
first Free entry is the implicit default — so a one-line
doc-comment is enough to lock the contract.
How to verify
python -c "from app_helpers import DEFAULT_MODEL_ID, AVAILABLE_MODELS; assert DEFAULT_MODEL_ID in AVAILABLE_MODELS" exits 0.
- The
AppHelpersModuleTests.test_default_model_id_is_in_catalogue
test still passes.
- Renaming a model id in the catalogue (and not touching
DEFAULT_MODEL_ID) still produces a coherent default.
Skill: refactor, removing duplication.
Estimated effort: S.
Context
app_helpers.pydeclares the default model id in two places:as a key in the
AVAILABLE_MODELSdict, and again as thetop-level constant
DEFAULT_MODEL_ID = "minimax-m3-free". Ifthe catalogue ever changes (a model is renamed, a new default
ships), a contributor has to remember to update both. The
existing
AppHelpersModuleTestsalready pins the invariant"
DEFAULT_MODEL_IDmust be inAVAILABLE_MODELS" — thisturns the test into a structural guarantee.
What to change
In
app_helpers.py, defineDEFAULT_MODEL_IDas the firstFree-tier entry of
AVAILABLE_MODELS:The catalogue declaration should keep its existing order — the
first Free entry is the implicit default — so a one-line
doc-comment is enough to lock the contract.
How to verify
python -c "from app_helpers import DEFAULT_MODEL_ID, AVAILABLE_MODELS; assert DEFAULT_MODEL_ID in AVAILABLE_MODELS"exits 0.AppHelpersModuleTests.test_default_model_id_is_in_cataloguetest still passes.
DEFAULT_MODEL_ID) still produces a coherent default.Skill: refactor, removing duplication.
Estimated effort: S.