mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
88c08bbfc7
- `ItemStorageMemory.get` now throws an `ItemNotFoundError` when the requested `item_id` is not found. - Update docstrings in ABC and tests. The new memory item storage implementation implemented the `get` method incorrectly, by returning `None` if the item didn't exist. The ABC typed `get` as returning `T`, while the SQLite implementation typed `get` as returning `Optional[T]`. The SQLite implementation was referenced when writing the memory implementation. This mismatched typing is a violation of the Liskov substitution principle, because the signature of the implementation of `get` in the implementation is wider than the abstract class's definition. Using `pyright` in strict mode catches this. In `invocation_stats_default`, this introduced an error. The `_prune_stats` method calls `get`, expecting the method to throw if the item is not found. If the graph is no longer stored in the bounded item storage, we will call `is_complete()` on `None`, causing the error. Note: This error condition never arose the SQLite implementation because it parsed the item with pydantic before returning it, which would throw if the item was not found. It implicitly threw, while the memory implementation did not. |
||
---|---|---|
.. | ||
aa_nodes | ||
app | ||
backend | ||
fixtures | ||
inpainting | ||
test_model_manager | ||
test_model_probe/vae | ||
__init__.py | ||
conftest.py | ||
dev_prompts.txt | ||
legacy_tests.sh | ||
test_config.py | ||
test_item_storage_memory.py | ||
test_model_manager.py | ||
test_model_probe.py | ||
test_path.py | ||
test_profiler.py | ||
test_sqlite_migrator.py | ||
validate_pr_prompt.txt |