Fix typos and wrong types in remote_config.py

Offen Anfängerfreundlich
#957 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
75/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Ruhig
Tech-Stack
python
Bereich
api, backend

Rechercherichtung

Beginne in firebase_admin/remote_config.py, indem du evaluate_custom_signal_condition und _Value.as_int() zusammen mit der Typbehandlung in der Nähe liest. Überprüfe die Fallback-Werte und die Rückgabeannotation anhand des Issues und führe anschließend, falls verfügbar, die relevanten remote-config-Tests des Repositorys aus; abgeschlossen ist die Aufgabe, wenn die Defaults und die Annotation ohne Regressionen mit ihren Feldtypen übereinstimmen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

api: remoteconfig
[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:
# 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."""
Vorherrschende Sprache
Python
Sterne
1.2k
Forks
359
Ø Merge
5 T. 6 Min.
Gemergte PRs (30 T.)
2

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus firebase/firebase-admin-python

Alle Issues in firebase/firebase-admin-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.