feat: realistic domains for the six thinnest pythonic examples - #14
Merged
Conversation
Rewrites pythonic.py (and tests) where the toy domain didn't answer "what does this look like in a real system": - facade: place_order() over inventory/payment/shipping/notification, with the payment-failure rollback tested - dependency_injection: overdue-invoice reminders with clock, source, and mail seams — deterministic tests, no monkeypatching - bridge: alert/digest notifiers bridged over email/Slack/SMS transports - prototype: report-job templates via partial + dataclasses.replace - mediator: checkout form with cascading country/shipping/payment rules - abstract_factory: one report rendered through HTML/Markdown document families naive.py toys kept as-is (the diff against them is the teaching device). READMEs aligned. 236 tests; ruff/mypy --strict clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SuperElectron
added a commit
that referenced
this pull request
Aug 27, 2026
* feat: v2 migration — adapter, bridge, composite as modules Structural batch 1 of the patterns-as-modules refactor: - adapter: pattern/ DelegatingAdapter; examples/payment_gateways (one checkout over two mismatched vendor SDKs, failure conventions unified) - bridge: pattern/ Transport protocol + notifiers (PR #14 seed promoted); examples/notification_center (per-team transport routing) - composite: pattern/ generic Composite/HasTotal with honest interfaces; examples/org_chart (headcount+cost rollups in one pass) - three docs files per unit; legacy variant files removed Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat: v2 migration — decorator, facade, flyweight, proxy as modules Structural batch 2/2 of the patterns-as-modules refactor: - decorator: pattern/ ships logged/timed/retry/rate_limited (ParamSpec-typed, effects injected); examples/resilient_client stacks them on a flaky client and pins the ordering policy - facade: place_order checkout facade promoted to pattern/ (rollback intact, honest saga boundary); examples/order_checkout batch-processes orders through the one door - flyweight: pattern/ ships InternPool with an immutability guard; examples/glyph_styles holds ~30k glyphs on 2 shared styles - proxy: pattern/ ships stackable LazyProxy/ProtectionProxy/MeteringProxy; examples/db_gateway composes all three over one expensive connection - each unit: docs/{fundamentals,implementation,examples}.md with the classic-form contrast and cited external usages; legacy variant files and tests removed Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat: v2 modules — structural group (adapter, bridge, composite, decorator, facade, flyweight, proxy) Assembles feat/v2-structural-1 + -2. Also: fleet example-imports-pattern check upgraded to an AST import walk; legacy sandbox test moved onto the synthetic legacy fixture. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: structural review findings — LazyProxy sentinel, recursive InternPool guard, fleet examples test _MISSING sentinel caches falsy subjects; strict interning recurses into containers; bridge 2x3 asserted + registry house rule; all legacy sandbox tests on the synthetic fixture; parametrized run of every module unit's examples; facade rollback releases on any charge failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the catalog review: the six units whose
pythonic.pywas correct-but-toy now show the pattern in a small-but-plausible business scenario, so each file is something you can lift into real work:place_order()over inventory/payment/shipping/notification — incl. the rollback call sites forget (tested)partial+dataclasses.replace)naive.pytoys unchanged by design — the legible diff against them is the teaching device. READMEs aligned with the new domains.Gates: ruff ✅ mypy
--strict✅ pytest 236 ✅ README table current ✅ all six demos run ✅🤖 Generated with Claude Code