Skip to content

Option G design study + prototype: spec-carried boundary codecs on a flat proxy (#86) - #88

Merged
thorwhalen merged 4 commits into
masterfrom
claude/option-g-interface-codecs
Aug 10, 2026
Merged

Option G design study + prototype: spec-carried boundary codecs on a flat proxy (#86)#88
thorwhalen merged 4 commits into
masterfrom
claude/option-g-interface-codecs

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

What

Design study + experimental prototype for discussion #86: the maintainer's proposal of wrapt-inspired object proxies, KT/VT-annotated interface specs, and flatten-and-compile codec stacks — evaluated as Option G in the #86 option space.

  • misc/docs/dol_issue86_design.md — the design study (survived a 4-lens adversarial panel; corrections folded in and flagged)
  • dol/_interface_wrap.pyprivate, experimental engine (not exported; stdlib-only leaf module)
  • dol/tests/test_interface_wrap.py — 32 tests: census shapes, flat stacking, no-double-apply, pickle matrix, loudness policies, laziness, 3.10-parity rules

Headline findings

  1. is-a wrapping does not fix Key-transform wrappers delegate capability methods with the unmapped key (url_for etc. silently address the wrong object) #83 for backend-direct method bodies (verified) — corrects the "both Key-transform wrappers delegate capability methods with the unmapped key (url_for etc. silently address the wrong object) #83 and wrap_kvs will wrap the instance but self of instance is not wrapped #18 disappear" claim in Robustly wrapping stores that have key- and value-taking methods #86's option F verdict. F and G serve disjoint populations.
  2. The boundary invariant ("a method correct on the bare leaf stays correct under the stack") holds only under stated codec laws (total+injective decoder, mutual inverses, boundary copies) — refuted as unconditional by the panel, restated with fine print.
  3. The flat compiled stack dissolves the chain-walking family and gives the missing inverse key mapping — scoped to pure-codec stacks (filters/caches are not codecs and still nest). Measured 3.6× faster than nested wrap_kvs at depth 6.
  4. wrapt itself has exactly dol's wrap_kvs will wrap the instance but self of instance is not wrapped #18 hole (verified) — take its lessons (capability mirroring, _self_ naming, loud pickle posture), not its transparency goal.

Safety

Purely additive: no existing module touched except a CLAUDE.md docs-index row. Full suite green (559 passed incl. doctests); prototype doctests verified on Python 3.10 and 3.12.

Closes nothing; feeds discussions #86/#24/#35 and the #18/#5/#10 design conversations (open question 0: who owns the wrap_kvs endgame).

https://claude.ai/code/session_01FLZ8T5a6Y4P3u25yC1JD9R

… on a flat proxy

Private module dol/_interface_wrap.py + tests. Design study for discussion #86.

Claude-Session: https://claude.ai/code/session_01FLZ8T5a6Y4P3u25yC1JD9R
- *keys: KT var-positional now maps elementwise (was silent tuple corruption);
  **kwargs roles refuse loudly
- unannotated params in spec methods refuse (UnderAnnotatedSpecError) — the
  silence-by-omission hole one level down
- None defaults never encoded (leaf-domain rule; converges 3.10 implicit-
  Optional with 3.11+)
- fast path guarded to no-default leading positional params
- properties/classmethods in specs refuse instead of vanishing
- wrapping a legacy dol Store warns (mixed-architecture stacks are scoped)
- tests: all of the above + in-flight iterator survives stack extension,
  unspec'd dunders absent (no raw __or__ leak), nested Iterator[Iterator[KT]]

Claude-Session: https://claude.ai/code/session_01FLZ8T5a6Y4P3u25yC1JD9R
- 3.10: positional-plan fallback for builtin slots with no text signature
  (dict-form specs over dict were red on the 3.10 CI matrix)
- dict-form spec pickle/copy round-trip (from_dict now accepts its own
  normalized 3-tuple form)
- explicit dunder access no longer escapes to the leaf (AttributeError,
  not a raw leaf-bound method answering in the wrong key domain)
- __getitem__-only proxies refuse sequence-protocol iteration loudly
- fast path handles keyword calls of the first param (spec name is the
  contract; re-emitted positionally for leaf-name independence)
- Iterable args materialized (re-iterable contract); Iterator stays lazy
- undeclared policy string validated; class cache keyed by spec source
  (content), dict-form uncached; dead NamedTuples removed
- 7 new regression tests; 3.10 parity probes green

Claude-Session: https://claude.ai/code/session_01FLZ8T5a6Y4P3u25yC1JD9R
@thorwhalen
thorwhalen merged commit 8fb5858 into master Aug 10, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the claude/option-g-interface-codecs branch August 10, 2026 22:19
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.

Key-transform wrappers delegate capability methods with the unmapped key (url_for etc. silently address the wrong object)

1 participant