Skip to content

Codify OO + constructor-DI architecture rules and fail-fast / fail-closed guidance in CLAUDE.md (closes #397)#516

Merged
FidoCanCode merged 3 commits into
mainfrom
codify-oo-di-rules
Apr 15, 2026
Merged

Codify OO + constructor-DI architecture rules and fail-fast / fail-closed guidance in CLAUDE.md (closes #397)#516
FidoCanCode merged 3 commits into
mainfrom
codify-oo-di-rules

Conversation

@FidoCanCode
Copy link
Copy Markdown
Owner

@FidoCanCode FidoCanCode commented Apr 14, 2026

Fixes #397.

Codifies the OO + constructor-DI architecture as the default pattern in CLAUDE.md, replacing the stale module-level-function guidance. Adds explicit rules for migration smells (callable-slot DI, patch-heavy tests) and fail-fast / fail-closed handling in core runtime paths so reviewers have clear language to reject drift.


Work queue

Completed (3)
  • Replace module-level-function rule with OO + constructor-DI architecture guidance
  • Add migration-smell rules for callable-slot DI and patch-heavy tests
  • Add fail-fast / fail-closed guidance for core runtime paths

… task 1/3)

Replace the stale "use module-level functions" guidance with the actual
architecture: all behavior lives on injected objects, module-level code is
restricted to constants/value-helpers/type-defs/thin composition roots.

Define composition root, show the constructor-DI pattern, move the
@staticmethod rule into the new subsection with a clearer rationale.
Documents two patterns that signal incomplete migration to constructor-DI:
callable slots wired via default args (_run, _print_prompt, _fn_*) and
@patch-heavy tests that override module globals instead of injecting
collaborators. Both are debt markers — not errors, but invitations to
finish the refactor when touching that code.
Documents five concrete rules for authoritative runner paths: no broad
catch-log-continue, no synthetic success from real failures, explicit
subprocess failure handling via check=True or returncode, direct key
indexing instead of .get() defaults for required payload keys, and
fail-closed on startup precondition failures. Includes a worked example
contrasting the wrong and right approaches for subprocess error handling.
@FidoCanCode FidoCanCode marked this pull request as ready for review April 15, 2026 00:11
@FidoCanCode FidoCanCode requested a review from rhencke April 15, 2026 00:11
@FidoCanCode FidoCanCode merged commit 5460acd into main Apr 15, 2026
3 checks passed
@FidoCanCode FidoCanCode deleted the codify-oo-di-rules branch April 15, 2026 00:12
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.

Codify OO + constructor-DI architecture rules and fail-fast / fail-closed guidance in CLAUDE.md

2 participants