Fix typos and wrong types in remote_config.py

Open Beginner friendly
#957 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
api, backend

Research direction

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.

Written by the indexing model from the issue text.

Description

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."""
Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
5d 6m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-python

All issues in firebase/firebase-admin-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.