Skip to content

Fix native member topology across edits, saved state and undo - #65

Open
trissim wants to merge 6 commits into
mainfrom
work/commander-layout--P927--objectstate
Open

trissim wants to merge 6 commits into
mainfrom
work/commander-layout--P927--objectstate

Conversation

@trissim

@trissim trissim commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

P927: native member topology, saved reads and history

3 commits, 7 files, +505/−496 against current main. object_state.py: 2847 → 2625 lines. Two prefix-parsing reconstruction walks → zero. Two field-admission rules → one. Six downstream dataclass-shape retests → zero on the reviewed paths.

Published source: 1f859f06f70accd8c524a69b196d2837b0d79c70. Source changes only; all authored controls remain UNRUN. No author checker, product imports, application/provider execution, sync or installation.

Native edit: prepare once, publish once

Before, mutation admitted only existing children. Replacing unrelated native members retained obsolete children and owners. ObjectState._prepare_parameter_update now prepares the actual subtree through the same _admit_parameter operation used by recursive extraction, retires obsolete descendants, rebuilds affected native ancestors, and uses the validated rebuilt root rather than discarding it. Siblings and exclusions survive. Failed preparation precedes all publication/history/notifications.

ParameterStructure.admit_container records actual container membership, including zero-child records. Reconstruction consumes direct_paths; descendants and ordering derive from DottedFieldPath.contains_path and lineage. A zero-child record is still a leaf value for dirty comparison, but its recorded container identity reconstructs its actual native type.

Saved epoch: build at publication, not per read

The first checkpoint rebuilt the entire saved graph at every saved read. That was BOUND-1 slop: the saved topology was repeatedly inferred outside its publication. ObjectState._refresh_saved_resolved now builds and publishes _saved_resolved and its matching _saved_structure together. Saved getters, source comparisons and registry invalidation reuse that epoch. Mark-saved, ancestor-source refresh and explicit restore replace it through the same operation. This is the saved resolved epoch's structure, not an independently refreshed cache or another writable member value.

apply_prepared_construction attaches both historical live and saved structures from its prepared schema. The rejected saved_structure argument threading through registry restore methods was deleted. Local transaction checkpoints retain and restore the matching saved structure with saved resolved values. No snapshot file format or alternate history mechanism was added.

History: captured member before schema filtering

_parameter_epoch extracts captured native live/saved graphs before _reconcile_snapshot_schema filters paths. PreparedStateRestore retains scope/parent/delegation validation and atomic publication. Genuinely removed root declarations are still filtered. A union member change no longer resurrects the constructor's obsolete child names.

Deleted mechanisms

  • Existing-child-only mutation and annotation-first container inference.
  • Both hand prefix/substring reconstruction loops; direct-child topology now supplies their traversal.
  • _reconstruct_from_prefix, a forwarding-only entry point.
  • Repeated to-object/top-level-kwargs reconstruction: reconstruct_top_level_parameters owns it. Its explicit delegate-sync argument preserves the existing no-sync reconstruction path without a second walk.
  • ObjectState's index forwarder and redundant reindexing after exact structure restoration.
  • Live-only saved/history ownership lookup and per-read saved extraction.
  • Test monkeypatch of the removed index method; real topology assertions remain.

Source evidence and limits

Retained source map: ObjectState production30 modules and controls40, zero parse omissions; dependency map covers formbridge/python-introspect. Updated AST-only working map covers12 affected provider/form/control files; dynamic annotations/lazy resolution remain semantic reads, not an AST execution proof. Publication commands/results are retained in p927-provider-review-publication.log and p927-provider-attachment-publication.log. No ratchet or test was run by the author.

Base provider3f795a7 was production-identical to pinned b5dd9f7. Old unready ObjectState#62 stays untouched: its unique migration still needs python-introspect#25 (2518631cb, resolve_declared_type), absent from current python-introspect main. This PR neither activates nor discards that work.

Authored controls — UNRUN

  • tests/test_native_member_topology.py: unrelated records, empty record, None/scalar/return transitions; exact paths/metadata/notifications, siblings/exclusions, saved native values and stable saved epoch across repeated reads, dirty until mark_saved, atomic failed preparation, real registry undo/redo.
  • tests/test_object_state_update_instance.py: actual replacement topology without mocking a deleted helper; absent-baseline behavior preserved explicitly.
  • tests/test_construction_history.py: saved-context assertion uses the public saved-value owner rather than the retired private computation signature.
  • Existing callable, delegation, exclusion, schema-removal and source-inheritance controls remain.

Root owns one narrowed matched provider/Core/actual-form qualification, then the private New/Fork application journey. Core#3595 merges first; this provider and ToAD#1322 must match in the actual lock before qualification. Install Core with the matching ToAD, not Core alone. P916 retains its separate installed physical acceptance.

Assumed: source publication is not test, installation or application success. Other dependency pins must remain unchanged.

ask one saved leaf for its value
no longer reconstruct its entire ancestry for testimony

Copilot AI balanced review requested due to automatic review settings October 30, 2026 00:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim force-pushed the work/commander-layout--P927--objectstate branch from 1b67e45 to 6c6d474 Compare October 30, 2026 01:40

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.

2 participants