[Bug]: etcd cluster storage loses stored empty-string values
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.7k
- Forks
- 2.8k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 489
Description
System Info
Platform-independent etcd cluster-storage behavior on current main.
Reproduction
Etcd3ClusterStorage.get() uses the truthiness of the returned bytes to distinguish a missing key:
data, meta = self.client.get(key)
return data.decode('utf-8') if data else None
An existing key containing the valid empty string is returned by etcd as b"", which is falsey, so the storage layer converts it to None and makes it indistinguishable from a missing key. The HTTP backend preserves empty strings.
Expected behavior
Return "" when the key exists with an empty value, and None only when the etcd client returns no data.
Actual behavior
Both an empty stored value and a missing key return None.
Proposed fix
Check data is not None instead of truthiness and add CPU-only mocked regression coverage for both empty and missing values.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Etcd3ClusterStorage.get() entry point and inspect how the client returns data for existing and missing keys. Add CPU-only mocked regression coverage for an existing empty value and a missing value, with completion shown by returning "" for the former and None for the latter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100