Skip to content

ENH: Serialize null interface refs as literals - #268

Open
aminemanai2003 wants to merge 1 commit into
fumitoh:mainfrom
aminemanai2003:agent/serialize-null-interface-literal
Open

ENH: Serialize null interface refs as literals#268
aminemanai2003 wants to merge 1 commit into
fumitoh:mainfrom
aminemanai2003:agent/serialize-null-interface-literal

Conversation

@aminemanai2003

@aminemanai2003 aminemanai2003 commented Aug 8, 2026

Copy link
Copy Markdown

Summary

  • serialize deleted modelx interface references as literal Interface tuples instead of storing their null objects in data.pickle
  • restore the original null-interface type without relying on binary data
  • add regression coverage for serializer versions 6, 7, and 8

Root cause

InterfaceRefEncoder only accepted valid interfaces. A reference to deleted Cells or Spaces therefore fell through to PickleEncoder, producing an opaque entry such as ("Pickle", 1) in the generated source.

Null interfaces now use an explicit representation such as ("Interface", (None, "Cells")). The outer tuple remains a two-element interface reference, retaining the existing automatic-reference restoration behavior when a deleted target can no longer satisfy a relative reference.

Validation

  • python -m pytest modelx/tests/serialize -q — 250 passed, 2 skipped
  • python -m pytest modelx/tests -q — 1221 passed, 6 skipped
  • git diff --check

Closes #226

@aminemanai2003
aminemanai2003 force-pushed the agent/serialize-null-interface-literal branch from a05a960 to 7cf84d9 Compare August 9, 2026 00:00
@aminemanai2003
aminemanai2003 marked this pull request as ready for review August 9, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Serialize null interface as literal

1 participant