Skip to content

milestone: richer examples + review-pass fixes - #16

Merged
SuperElectron merged 2 commits into
mainfrom
staging
Aug 27, 2026
Merged

milestone: richer examples + review-pass fixes#16
SuperElectron merged 2 commits into
mainfrom
staging

Conversation

@SuperElectron

Copy link
Copy Markdown
Owner

Two squashed batches since v1.0.0, for review before merge and (optionally) a v1.0.1 tag:

1. Realistic domains for the six thinnest examples (#14)

The units whose pythonic.py was correct-but-toy now show the pattern in a liftable business scenario:

  • facadeplace_order() over inventory/payment/shipping/notification, with the payment-declined rollback tested
  • dependency_injection — invoice-reminder service with clock/source/mail seams; frozen-date tests, no monkeypatching
  • bridge — alert/digest notifiers × email/Slack/SMS transports
  • prototype — report-job templates via partial + dataclasses.replace
  • mediator — checkout form with cascading country→shipping→payment rules
  • abstract_factory — one sales report through HTML/Markdown document families

naive.py toys intentionally unchanged — the legible diff against them is the teaching device.

2. Review-pass fixes + reviewer standards (#15)

0 CRITICAL / 3 HIGH / 4 MEDIUM, all fixed:

  • safe_eval: bool constants rejected (True + 1 no longer computes); depth limit turns hostile nesting into ValueError instead of RecursionError — both tested
  • sandbox: assert runtime guard → real FileNotFoundError; timeout keeps stderr
  • pickle memento: explicit CWE-502 trust-boundary warning (docstring + README caveat)
  • MCP server: catalog now lazy (lru_cache) — no disk I/O at import, per our own global_object unit
  • honest thread-safety/saga-boundary notes in facade/singleton/flyweight
  • docs/code-review.md: the reviewer's contract (tool layer, PEP standards, severity checklist, MCP reference sources)

Gates: ruff ✅ · mypy --strict (206 files) ✅ · pytest 238 ✅ · README table current ✅

🤖 Generated with Claude Code

SuperElectron and others added 2 commits August 26, 2026 18:11
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>
…server (#15)

From a full review pass (bandit + manual, report in PR):

HIGH
- interpreter/real_world.py: safe_eval now rejects bool constants
  (bool subclasses int; True + 1 no longer computes) and depth-limits
  nesting so hostile input gets ValueError, not RecursionError
- sandbox.py: assert path.is_file() replaced with a real pre-flight
  FileNotFoundError check (asserts vanish under python -O); timeout
  path now preserves captured stderr
- memento/real_world.py: explicit CWE-502 warning — pickle.loads only
  on snapshots this process produced; README caveat added

MEDIUM
- server.py: catalog/index now lazy via lru_cache accessors — imports
  do no disk I/O, practicing what patterns/python/global_object teaches
- facade/singleton/flyweight pythonic variants: honest inline notes on
  the saga boundary, unguarded lazy init, and unbounded pool

docs/code-review.md: reviewer standards — tool layer, written
standards, severity checklist, MCP reference sources.

238 tests (2 new hostile-input tests); ruff/mypy --strict clean.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@SuperElectron
SuperElectron merged commit 6df0e96 into main Aug 27, 2026
6 checks passed
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.

1 participant