Skip to content

[FEATURE] Determinism / seam boundary #48

Description

@LukasNiessen

In short

Business logic that calls the clock, randomness, environment variables, or the network directly is hard to test and unpredictable. This bans those calls in the domain layer so they're passed in instead.

Problem

Pure/domain code that reaches for wall-clock time, randomness, environment, or the network directly is untestable and non-deterministic; enforcing seams automatically improves testability.

Proposal

A rule that bans ambient side-effect calls in a layer, e.g. project_files("src/").in_folder("**/domain/**").should_not().use_symbols("datetime.now", "random", "os.environ", "requests"), forcing injected clocks/RNG/config/ports.

Add to README a section on this, include reference and explanation a la "Working Effectively with Legacy Code — Michael Feathers; Building Evolutionary Architectures — Ford, Parsons, Kua:
In plain terms. Business logic that calls the clock, randomness, environment variables, or the network directly is hard to test and unpredictable. This bans those calls in the domain layer so they're passed in instead."

Acceptance criteria

  • A domain module calling datetime.now() fails; an injected clock passes; the banned-symbol list is configurable.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions