Skip to content

fix: keep missing in-memory state loads out of application lists - #958

Open
MIRS571 wants to merge 1 commit into
apache:mainfrom
MIRS571:fix/in-memory-load-app-list
Open

MIRS571 wants to merge 1 commit into
apache:mainfrom
MIRS571:fix/in-memory-load-app-list

Conversation

@MIRS571

@MIRS571 MIRS571 commented Oct 14, 2026

Copy link
Copy Markdown

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:

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 f8488d0.
  • 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

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • 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.
  • 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.

@github-actions github-actions Bot added area/core Application, State, Graph, Actions area/storage Persisters, state storage labels Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions area/storage Persisters, state storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant