MIRS571 opened a new pull request, #958:
URL: https://github.com/apache/burr/pull/958
Calling load() for an application with no saved state returns None but
inserts an empty entry into the nested defaultdict used by the in-memory
persisters. A later list_app_ids() then includes that unsaved application.
For example:
```python
from burr.core.persistence import InMemoryPersister
persister = InMemoryPersister()
assert persister.load("tenant", "missing") is None
assert persister.list_app_ids("tenant") == [] # Previously returned
["missing"].
```
AsyncInMemoryPersister has the same behavior.
## Changes
- Use non-inserting lookups in InMemoryPersister.load() and
AsyncInMemoryPersister.load().
- Add eight regression cases covering synchronous/asynchronous calls,
None/ordinary partition keys, empty/populated partitions, absent sequence IDs,
preserved state history, and saving an application after an unsuccessful load.
- Keep the existing save and state-selection behavior.
- Limit the change to burr/core/persistence.py and
tests/core/test_persistence.py; no new dependencies or public APIs.
## How I tested this
- All eight new regression cases fail against upstream
f8488d0cd034fa292c6d7e5fd1a431f12f403ff5.
- With the fix, `python -m pytest tests/core/test_persistence.py
tests/core/test_parallelism.py tests/core/test_application.py -q` completed
with **197 passed** on Windows / Python 3.11.2.
- The changed files passed Black 23.11.0, isort 5.12.0, Flake8 6.1.0 (single
worker), ASF header, AST, end-of-file, trailing-whitespace and `git diff
--check` checks. `pip check` also passed.
- Additional local checks covered four partition keys and 400 missing
application IDs per implementation, repeated sequence IDs, and partition
isolation.
- No paid APIs or external database services were used.
## Notes
Prepared with OpenAI Codex assistance. The validation above was performed
with Codex assistance and is not an independent human test run. No code from
another project was introduced.
These in-memory persisters are intended for testing; this is not a
production database change. list_app_ids() may still allocate an empty
partition internally, which does not introduce phantom application IDs and is
outside this fix.
The full repository test matrix, full pre-commit entry point, frontend hook
and complete CI have **not** been run locally. Applicable Python checks were
run individually.
Generated-by: OpenAI Codex
## Checklist
- [x] PR has an informative and human-readable title (this will be pulled
into the release notes)
- [x] Changes are limited to a single goal (no scope creep)
- [ ] Code passed the pre-commit check & code is left cleaner/nicer than
when first encountered. Applicable Python checks passed individually; the full
pre-commit entry point and frontend hook were not run.
- [x] Any _change_ in functionality is tested
- [ ] New functions are documented (with a description, list of inputs, and
expected output). N/A: no new functions or public parameters.
- [ ] Placeholder code is flagged / future TODOs are captured in comments.
N/A: no placeholder code or new TODOs were introduced.
- [ ] Project documentation has been updated if adding/changing
functionality. No separate documentation change; this fixes an unintended read
side effect without introducing a new API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]