Skip to content

Split the decode-side manifest transient into a dedicated type #229

Description

@conradbzura

Description

Factor the wire-decoded context transient out of the live context model into a dedicated type. The live model should be unambiguously live — never a half-decoded variant — and the decoded shape should be its own wire-view value object.

Split the model in two:

  • The live chain (Chain) carries only its bound-var index: id, vars, and resets. It holds no decode-side _manifest field, so there is no decoded-but-not-live variant of it.
  • A dedicated manifest type (_ChainManifest) carries the deserialised state of a wire ChainManifest: id, vars, resets, stubs, and decode_error. It is a wire-view POD — never installed, never the active chain state.

The decode path returns the manifest type rather than a half-populated chain. A decoded manifest lives on the dispatch session and the frame (DispatchSession.decoded, Frame.context); Frame.mount merges it into the live chain key-wise at mount time.

Leave external_used out of the manifest. Cross-process token transport — the consumed-token log's only consumer — is out of scope here and tracked in #231.

Motivation

Context carries three near-overlapping concepts in one class: the bound-var index, the decode-side dict[var, value] transient (_manifest), and a vars proxy over it. "Bound" lives in one field; "value" lives elsewhere — except in the window between decode and mount, when it lives in _manifest. A reader has to hold that exception in their head to follow the model. A dedicated decoded type removes it: the live chain is always live, and the decoded shape is a separate thing with a separate name.

Expected Outcome

  • Chain has no _manifest field and is always a live chain.
  • A dedicated manifest type holds the wire-decoded state (id, vars, resets, stubs, decode_error) and is never installed as active state.
  • The decode path yields the manifest type; Frame.mount merges it into the live chain key-wise.
  • The manifest carries no external_used log; cross-process token transport stays out of scope (Picklable wool.Token: enable cross-wire token transport with stdlib parity #231).

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode restructuring without behavior change

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions