Skip to content

Keep nested containers frozen after Box addition - #369

Open
vanshbarfiwala-lgtm wants to merge 1 commit into
cdgriffith:developfrom
vanshbarfiwala-lgtm:fix/frozen-operation-results
Open

vanshbarfiwala-lgtm wants to merge 1 commit into
cdgriffith:developfrom
vanshbarfiwala-lgtm:fix/frozen-operation-results

Conversation

@vanshbarfiwala-lgtm

@vanshbarfiwala-lgtm vanshbarfiwala-lgtm commented Nov 17, 2026 •

Copy link
Copy Markdown

Fixes #368.

Frozen Box addition currently returns mutable new children, so nested writes unexpectedly succeed and hashing the result fails. Keep the frozen configuration during forced merges and use a temporary internal write permission instead. Preserve the frozen setting when building the plain-dict operand for reflected addition.

The permission is restored in finally, including reentrant callbacks and exceptions, and does not propagate to child configuration. This avoids reconstructing the completed result and applying custom recast functions again. Public updates to frozen Boxes remain rejected.

Seven regression/compatibility cases cover both addition directions, mutable controls, nested dictionaries and lists, hashing, recast behavior with dotted keys, exceptions, and reentrancy. Three cases fail on unchanged develop.

Validation:

  • Pure Python on Windows / Python 3.13.9: 1,231 tests pass, one skipped; 100% line and branch coverage.
  • Full Ruff lint, formatting, and mypy pass.
  • Pure-Python wheel and source distribution build pass.
  • Compiled Cython modules on Linux / Python 3.13.18: 1,231 tests pass, one skipped. Both box.box and box.box_list import compiled .so files. Other Python versions were not tested locally.

Includes changelog and contributor entries. AI assistance: OpenAI Codex assisted investigation, implementation, and testing.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant