Skip to content

Fix #1: .items()/.values() honour dol wrappers; scan_items/scan_values opt-in - #5

Merged
thorwhalen merged 3 commits into
masterfrom
fix/1-views-escape-wrapper
Oct 13, 2026
Merged

thorwhalen merged 3 commits into
masterfrom
fix/1-views-escape-wrapper

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Closes #1 (the user-visible escape); structural hook refactor split to a follow-up issue.

  • Removed the nested ValuesView/ItemsView that routed through leaf-bound iter_items/iter_values; dol's default views (via __iter__+__getitem__) are correct under any wrapper. Cost: one get per key instead of one scan.
  • iter_items/iter_values methods removed (API break, nothing in the fleet used them); accessing them raises an AttributeError naming the replacement. New free functions scan_items(store) / scan_values(store) give the single-scan fast path and refuse wrapped stores with a TypeError (a free function cannot apply the wrapper's mapping). This follows the spirit of cosmodol.ops (keyed/leaky capabilities leave the method surface) but not its mechanism: cosmodol's free functions resolve keys through wrappers via inner_most_key, which has no use here because dynamodol has no key-taking method; the leak was return-side.
  • Offline tests (existing FakeTable; moto not needed): Route A and B key scoping, value codec, scan fast path, removed-method messages.

Adversarial review (Opus subagent): scoping held on all reader/persister classes and wrap routes; one confirmed defect — my first __getattr__ for removed methods masked real AttributeErrors from properties like table. Replaced with a descriptor (class access returns itself so class-wraps still work), regression test added. Also made scan_* validate eagerly. Speculative: patch-release API break; slower unwrapped .items().

Dependents gate: no dependent suites; the 5 doctest failures (live DB) are identical on master.

🤖 Generated with Claude Code

thorwhalen and others added 3 commits October 13, 2026 07:31
…es opt-in fast path

Drop the nested ValuesView/ItemsView (they routed through leaf-bound
iter_items/iter_values, escaping any key/value codec). iter_items/iter_values
are replaced by free functions that accept only an unwrapped reader.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tr__ that masks AttributeErrors

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit 30054ea into master Oct 13, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/1-views-escape-wrapper branch October 13, 2026 07:36
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/value transforms live outside dol's hooks: .items() and .values() on a wrapped dynamodol store silently escape the wrapper's scope

1 participant