You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File snapshots are not restored inside an untyped container #424
ArrayAnySegment snapshots a file so it can be rebuilt after serialisation: serialize_file_snapshot dumps the value, walks the result and records where the files sit, and _restore_files puts them back. The walk only recognises SerializedFile, the shape the marker produces while pydantic goes through a model:
An untyped container is dumped as it is - a deque keeps its elements, and a File inside it stays a File, never SerializedFile. No path is recorded, so the restore step has nothing to restore and the file stays the plain dict pydantic produced later.
An existing test covers it and fails on main:
tests/variables/test_file_snapshots.py::test_snapshots_preserve_files_inside_serializable_models[python]
E assert [{'dify_model_identity': '__dify__file__', ...}] == [File(...), {...}]
Both parametrisations ([python] and [json]) fail, and it is not platform-dependent: every other container in that test is a model, which is why only the deque case shows it.
Expected
A File inside an untyped container round-trips as a File, like the ones inside models and lists.
Fix
Record the path for a File too, and let it through unchanged so the later dump serialises it as before. PR to follow.
Activity