firebase / firebase/firebase-admin-python

Fix typos and wrong types in remote_config.py

Aperta Adatta ai principianti
#957 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
api: remoteconfig
Lingua principale
Python
Stelle
1.2k
Fork
359
Merge medio
5g 6m
PR unite (30g)
2

Descrizione

### [READ] Step 1: Are you in the right place?
This is a bug in the code of this repository (`firebase_admin/remote_config.py`).

---

### [REQUIRED] Step 2: Describe your environment

* Operating System version: Windows 11
* Firebase SDK version: 6.x (latest)
* Firebase Product: remote_config
* Python version: 3.11
* Pip version: 24.x

---

### [REQUIRED] Step 3: Describe the problem

#### Steps to reproduce:

In `firebase_admin/remote_config.py`, the method `evaluate_custom_signal_condition`
uses `{}` (empty dict) as the default fallback for string and list fields:

custom_signal_operator = custom_signal_condition.get('customSignalOperator') or {}
custom_signal_key = custom_signal_condition.get('customSignalKey') or {}
target_custom_signal_values = custom_signal_condition.get('targetCustomSignalValues') or {}

These should be `''` (string) and `[]` (list) respectively, as the fields are
not dicts. Using `{}` is semantically incorrect.

Also, `_Value.as_int()` has a wrong return type annotation `-> float` instead
of `-> int`.

#### Relevant Code:

```python
# Wrong defaults — should be '' and []
custom_signal_operator = custom_signal_condition.get('customSignalOperator') or {}
custom_signal_key = custom_signal_condition.get('customSignalKey') or {}
target_custom_signal_values = custom_signal_condition.get('targetCustomSignalValues') or {}

# Wrong return type annotation — should be -> int
def as_int(self) -> float:
"""Returns the value as a number."""

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in firebase_admin/remote_config.py, reading evaluate_custom_signal_condition and _Value.as_int() along with nearby type handling. Verify the fallback values and return annotation against the issue, then run the repository's relevant remote-config tests if available; done means the defaults and annotation match their field types without regressions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
75/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.