# Correctness / Determinism / Verification

> Every principle in this category is listed as a record.

Page: Ontology · Principles
Canonical: https://banes-lab.com/ontology#arch-category-correctness-determinism-verification

Every principle in this category is listed as a record. Each record carries its kind, its severity, the scopes it applies at and the layer it lives in, then the edge relations that join it to other records, the records that point back at it, the contracts that answer to it and the tensions it takes part in. The descriptors say how it is violated, detected, measured, repaired and enforced. Where the record carries one, an exemplar shows the shape before and after the principle is applied.

Relations diagram

The relations inside this category.

```mermaid
flowchart LR
n_determinism["Determinism"]
n_predictability["Predictability"]
n_referential_transparency["Referential Transparency"]
n_pure_functions["Pure Functions"]
n_immutability["Immutability"]
n_reproducibility["Reproducibility"]
n_repeatability["Repeatability"]
n_correctness["Correctness"]
n_formal_verification["Formal Verification"]
n_specification_based_testing["Specification-Based Testing"]
n_property_based_testing["Property-Based Testing"]
n_static_analysis["Static Analysis"]
n_testability["Testability"]
n_validation["Validation"]
n_verification["Verification"]
n_determinism --> n_predictability
n_determinism --> n_reproducibility
n_predictability --> n_determinism
n_referential_transparency --> n_pure_functions
n_referential_transparency --> n_immutability
n_referential_transparency --> n_determinism
n_referential_transparency --> n_testability
n_pure_functions --> n_testability
n_pure_functions --> n_determinism
n_pure_functions --> n_referential_transparency
n_immutability --> n_predictability
n_reproducibility --> n_determinism
n_repeatability --> n_verification
n_repeatability --> n_predictability
n_correctness --> n_validation
n_formal_verification --> n_correctness
n_specification_based_testing --> n_correctness
n_property_based_testing --> n_correctness
n_testability --> n_pure_functions
n_validation --> n_correctness
n_verification --> n_correctness
```

### Determinism

- Kind: [principle](https://banes-lab.com/records/kind/principle.md)
- Severity: recommended
- Scope: function, process, build, test
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Controlled Inputs](https://banes-lab.com/records/lex/controlled-inputs.md), [Controlled State](https://banes-lab.com/records/lex/controlled-state.md)

Reinforces
[Predictability](https://banes-lab.com/records/arch/predictability.md), [Reproducibility](https://banes-lab.com/records/arch/reproducibility.md)

Enables
[Reliable Testing](https://banes-lab.com/records/lex/reliable-testing.md)

In tension with
[Runtime Adaptivity](https://banes-lab.com/records/lex/runtime-adaptivity.md)

Conflicts with
[Hidden Time/Randomness/Global State](https://banes-lab.com/records/lex/hidden-time-randomness-global-state.md)

Referenced by
[Predictability](https://banes-lab.com/records/arch/predictability.md), [Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md), [Pure Functions](https://banes-lab.com/records/arch/pure-functions.md), [Reproducibility](https://banes-lab.com/records/arch/reproducibility.md), [Artificial Intelligence Architecture](https://banes-lab.com/records/arch/artificial-intelligence-architecture.md), [Agentic Architecture](https://banes-lab.com/records/arch/agentic-architecture.md)

Tensions
[Determinism Runtime Adaptivity](https://banes-lab.com/records/tension/determinism-runtime-adaptivity.md)

Violated by
nondeterministic behavior without explicit source

Detected by
flaky tests, hidden random/time calls

Measured by
flake rate, reproducibility score

Refactored by
Inject Clock/RNG, Control State

Enforced by
deterministic test rules

Before

```typescript
function makeFoo(name: string) {
return { id: crypto.randomUUID(), name, createdAt: new Date() };
}
```

After

```typescript
function makeFoo(name: string, id: FooId, createdAt: Date): Foo {
return { id, name, createdAt };
}
```

### Predictability

- Kind: [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- Severity: recommended
- Scope: API, module, runtime
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Determinism](https://banes-lab.com/records/arch/determinism.md), [Explicit Contracts](https://banes-lab.com/records/arch/explicit-contracts.md)

Reinforces
[Principle of Least Surprise](https://banes-lab.com/records/arch/principle-of-least-surprise.md)

Enables
[Safe Refactoring](https://banes-lab.com/records/lex/safe-refactoring.md)

In tension with
[Dynamic Runtime Behavior](https://banes-lab.com/records/lex/dynamic-runtime-behavior.md)

Conflicts with
[Hidden Behavior](https://banes-lab.com/records/lex/hidden-behavior.md)

Referenced by
[Pattern Consistency](https://banes-lab.com/records/arch/pattern-consistency.md), [Design by Contract](https://banes-lab.com/records/arch/design-by-contract.md), [Explicit Contracts](https://banes-lab.com/records/arch/explicit-contracts.md), [API Contract](https://banes-lab.com/records/arch/api-contract.md), [Postconditions](https://banes-lab.com/records/arch/postconditions.md), [Determinism](https://banes-lab.com/records/arch/determinism.md), [Immutability](https://banes-lab.com/records/arch/immutability.md), [Repeatability](https://banes-lab.com/records/arch/repeatability.md), [Declarative Configuration](https://banes-lab.com/records/arch/declarative-configuration.md), [Convention over Configuration](https://banes-lab.com/records/arch/convention-over-configuration.md), [Runtime Discovery](https://banes-lab.com/records/arch/runtime-discovery.md), [Late Binding](https://banes-lab.com/records/arch/late-binding.md), [Runtime Extensibility](https://banes-lab.com/records/arch/runtime-extensibility.md), [Principle of Least Surprise](https://banes-lab.com/records/arch/principle-of-least-surprise.md), [State Isolation](https://banes-lab.com/records/arch/state-isolation.md), [Controlled Side Effects](https://banes-lab.com/records/arch/controlled-side-effects.md)

Tensions
[Predictability Dynamic Runtime Behavior](https://banes-lab.com/records/tension/dynamic-runtime-behavior-predictability.md)

Violated by
surprising side effects, implicit ordering

Detected by
nondeterministic tests, ambiguous APIs

Measured by
flake/misuse rate

Refactored by
Make Behavior Explicit, Add Contracts

Enforced by
[tests](https://banes-lab.com/records/lex/tests.md), [contracts](https://banes-lab.com/records/lex/contracts.md), linting

Before

```typescript
function saveFoo(foo: Foo) {
if (Math.random() > 0.5) return memoryStore.save(foo);
return sqlStore.save(foo);
}
```

After

```typescript
function saveFoo(store: FooStore, foo: Foo) { return store.save(foo); }
```

### Referential Transparency

- Kind: [principle](https://banes-lab.com/records/kind/principle.md)
- Severity: contextual
- Scope: function, expression
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Pure Functions](https://banes-lab.com/records/arch/pure-functions.md), [Immutability](https://banes-lab.com/records/arch/immutability.md)

Reinforces
[Determinism](https://banes-lab.com/records/arch/determinism.md), [Testability](https://banes-lab.com/records/arch/testability.md)

Enables
[Safe Substitution](https://banes-lab.com/records/lex/safe-substitution.md)

In tension with
[Stateful IO](https://banes-lab.com/records/lex/stateful-io.md)

Conflicts with
[Side Effects](https://banes-lab.com/records/lex/side-effects.md)

Referenced by
[Pure Functions](https://banes-lab.com/records/arch/pure-functions.md)

Tensions
[Referential Transparency Stateful IO](https://banes-lab.com/records/tension/referential-transparency-stateful-io.md)

Violated by
same input producing different output

Detected by
hidden dependency on time/random/global state

Measured by
pure function coverage

Refactored by
Extract Pure Function, Inject Dependency

Enforced by
[code review](https://banes-lab.com/records/arch/code-review.md), functional boundaries

Before

```typescript
function fooTotal(values: number[]) {
globalCounter += 1;
return values.reduce((a, b) => a + b, 0) + globalCounter;
}
```

After

```typescript
function fooTotal(values: readonly number[]) {
return values.reduce((a, b) => a + b, 0);
}
```

### Pure Functions

- Kind: [technique](https://banes-lab.com/records/kind/technique.md)
- Severity: recommended
- Scope: function, domain logic
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[No Side Effects](https://banes-lab.com/records/lex/no-side-effects.md), [Explicit Inputs](https://banes-lab.com/records/lex/explicit-inputs.md)

Reinforces
[Testability](https://banes-lab.com/records/arch/testability.md), [Determinism](https://banes-lab.com/records/arch/determinism.md)

Enables
[Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md)

In tension with
[Stateful Operations](https://banes-lab.com/records/lex/stateful-operations.md)

Conflicts with
[Hidden IO](https://banes-lab.com/records/lex/hidden-io.md)

Referenced by
[Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md), [Testability](https://banes-lab.com/records/arch/testability.md)

Tensions
[Pure Functions Stateful Operations](https://banes-lab.com/records/tension/pure-functions-stateful-operations.md)

Violated by
mutation, IO, global reads/writes

Detected by
side-effect calls inside pure layer

Measured by
pure core ratio

Refactored by
Extract Pure Logic, Move IO Outward

Enforced by
layer rules, [tests](https://banes-lab.com/records/lex/tests.md)

Before

```typescript
function normalizeFoo(foo: Foo) {
foo.name = foo.name.trim();
fooStore.save(foo);
return foo;
}
```

After

```typescript
function normalizeFoo(foo: Foo): Foo {
return { ...foo, name: foo.name.trim() };
}
```

### Immutability

- Kind: [principle](https://banes-lab.com/records/kind/principle.md)
- Severity: recommended
- Scope: data, value object, concurrency
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Value Semantics](https://banes-lab.com/records/lex/value-semantics.md)

Reinforces
[Thread Safety](https://banes-lab.com/records/lex/thread-safety.md), [Predictability](https://banes-lab.com/records/arch/predictability.md)

Enables
[Safe Sharing](https://banes-lab.com/records/lex/safe-sharing.md)

In tension with
[Allocation Cost](https://banes-lab.com/records/lex/allocation-cost.md)

Conflicts with
[Shared Mutable State](https://banes-lab.com/records/arch/shared-mutable-state.md)

Referenced by
[Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md), [Value Object](https://banes-lab.com/records/arch/value-object.md)

Tensions
[Immutability Allocation Cost](https://banes-lab.com/records/tension/allocation-cost-immutability.md)

Violated by
mutating value objects, exposed mutable collections

Detected by
setters on value objects, mutable public fields

Measured by
mutable state count

Refactored by
Make Immutable, Copy-on-Write

Enforced by
type system, lint rules

Before

```typescript
type Foo = { name: string; tags: string[] };
function addTag(foo: Foo, tag: string) { foo.tags.push(tag); return foo; }
```

After

```typescript
type Foo = Readonly<{ name: string; tags: readonly string[] }>;
function addTag(foo: Foo, tag: string): Foo { return { ...foo, tags: [...foo.tags, tag] }; }
```

### Reproducibility

- Kind: [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- Severity: recommended
- Scope: build, test, deployment, ML
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Determinism](https://banes-lab.com/records/arch/determinism.md), [Versioned Inputs](https://banes-lab.com/records/lex/versioned-inputs.md)

Reinforces
[Auditability](https://banes-lab.com/records/arch/auditability.md)

Enables
[Debugging](https://banes-lab.com/records/lex/debugging.md), [Compliance](https://banes-lab.com/records/arch/compliance.md)

In tension with
[Continuous Updates](https://banes-lab.com/records/lex/continuous-updates.md)

Conflicts with
[Floating Dependencies](https://banes-lab.com/records/lex/floating-dependencies.md), [Flaky Test Normalization](https://banes-lab.com/records/arch/flaky-test-normalization.md)

Referenced by
[Determinism](https://banes-lab.com/records/arch/determinism.md), [Machine Learning Architecture](https://banes-lab.com/records/arch/machine-learning-architecture.md), [Prompt Engineering](https://banes-lab.com/records/arch/prompt-engineering.md), [Environment Parity](https://banes-lab.com/records/arch/environment-parity.md), [Infrastructure as Code](https://banes-lab.com/records/arch/infrastructure-as-code.md), [Immutable Infrastructure](https://banes-lab.com/records/arch/immutable-infrastructure.md), [Benchmarking](https://banes-lab.com/records/arch/benchmarking.md)

Tensions
[Reproducibility Continuous Updates](https://banes-lab.com/records/tension/continuous-updates-reproducibility.md)

Violated by
unpinned dependencies, nondeterministic builds

Detected by
build output drift

Measured by
reproducible build/test pass rate

Refactored by
Pin Versions, Lock Inputs, Capture Environment

Enforced by
lockfiles, build verification

Before

```typescript
const result = trainFoo(data, { seed: Math.random() });
```

After

```typescript
const config = { seed: 42, datasetVersion: "foo-v3", algorithmVersion: "1.2.0" } as const;
const result = trainFoo(data, config);
```

### Repeatability

- Kind: [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- Severity: mandatory
- Scope: test, build, process
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Controlled Inputs](https://banes-lab.com/records/lex/controlled-inputs.md)

Reinforces
[Verification](https://banes-lab.com/records/arch/verification.md), [Predictability](https://banes-lab.com/records/arch/predictability.md)

Enables
[Reliable Automation](https://banes-lab.com/records/lex/reliable-automation.md)

In tension with
[Real-World Variability](https://banes-lab.com/records/lex/real-world-variability.md)

Conflicts with
[Environment-Sensitive Behavior](https://banes-lab.com/records/lex/environment-sensitive-behavior.md)

Tensions
[Repeatability Real-World Variability](https://banes-lab.com/records/tension/real-world-variability-repeatability.md)

Violated by
tests depending on ordering/time/external state

Detected by
flaky test results

Measured by
rerun consistency

Refactored by
Isolate Environment, Mock External Inputs

Enforced by
CI rerun policy

Before

```typescript
test("foo", () => expect(runFoo(Date.now())).toEqual(snapshot()));
```

After

```typescript
test("foo", () => {
const clock = new FixedClock("2026-01-01T00:00:00Z");
expect(runFoo(clock)).toEqual(expectedFoo);
});
```

### Correctness

- Kind: [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- Severity: mandatory
- Scope: function, module, system
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Specification](https://banes-lab.com/records/lex/specification.md), [Validation](https://banes-lab.com/records/arch/validation.md), [Tests](https://banes-lab.com/records/lex/tests.md)

Reinforces
[Design by Contract](https://banes-lab.com/records/arch/design-by-contract.md)

Enables
[Safe Operation](https://banes-lab.com/records/lex/safe-operation.md)

In tension with
[Delivery Speed](https://banes-lab.com/records/lex/delivery-speed.md)

Conflicts with
[Undefined Behavior](https://banes-lab.com/records/lex/undefined-behavior.md)

Referenced by
[Design Review](https://banes-lab.com/records/arch/design-review.md), [First-Principles Design](https://banes-lab.com/records/arch/first-principles-design.md), [Finite State Machine](https://banes-lab.com/records/arch/finite-state-machine.md), [Happens-Before Relationship](https://banes-lab.com/records/arch/happens-before-relationship.md), [Design by Contract](https://banes-lab.com/records/arch/design-by-contract.md), [Semantic Contracts](https://banes-lab.com/records/arch/semantic-contracts.md), [Preconditions](https://banes-lab.com/records/arch/preconditions.md), [Postconditions](https://banes-lab.com/records/arch/postconditions.md), [Invariants](https://banes-lab.com/records/arch/invariants.md), [Formal Verification](https://banes-lab.com/records/arch/formal-verification.md), [Specification-Based Testing](https://banes-lab.com/records/arch/specification-based-testing.md), [Property-Based Testing](https://banes-lab.com/records/arch/property-based-testing.md), [Validation](https://banes-lab.com/records/arch/validation.md), [Verification](https://banes-lab.com/records/arch/verification.md), [Domain Model](https://banes-lab.com/records/arch/domain-model.md), [Fail Fast](https://banes-lab.com/records/arch/fail-fast.md), [Error Handling](https://banes-lab.com/records/arch/error-handling.md), [Model Evaluation](https://banes-lab.com/records/arch/model-evaluation.md), [Schema Validation](https://banes-lab.com/records/arch/schema-validation.md), [Type Safety](https://banes-lab.com/records/arch/type-safety.md), [Single Source of Truth](https://banes-lab.com/records/arch/single-source-of-truth.md), [Semantic Consistency](https://banes-lab.com/records/arch/semantic-consistency.md), [Input Validation](https://banes-lab.com/records/arch/input-validation.md), [Atomicity](https://banes-lab.com/records/arch/atomicity.md), [ACID](https://banes-lab.com/records/arch/acid.md), [Consistency](https://banes-lab.com/records/arch/consistency.md), [Isolation](https://banes-lab.com/records/arch/isolation.md), [Concurrency Control](https://banes-lab.com/records/arch/concurrency-control.md)

Tensions
[Correctness Delivery Speed](https://banes-lab.com/records/tension/correctness-delivery-speed.md)

Violated by
behavior diverging from specification

Detected by
failing tests, invariant violations

Measured by
defect rate, spec coverage

Refactored by
Add Tests, Fix Logic, Add Contracts

Enforced by
CI, formal/static checks

Before

```typescript
function averageFoo(total: number, count: number) { return total / count; }
```

After

```typescript
function averageFoo(total: number, count: number) {
if (!Number.isFinite(total)) throw new Error("invalid total");
if (!Number.isInteger(count) || count <= 0) throw new Error("invalid count");
return total / count;
}
```

### Formal Verification

- Kind: [activity](https://banes-lab.com/records/kind/activity.md)
- Severity: contextual
- Scope: algorithm, protocol, critical system
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Formal Specification](https://banes-lab.com/records/lex/formal-specification.md)

Reinforces
[Correctness](https://banes-lab.com/records/arch/correctness.md)

Enables
[Mathematical Assurance](https://banes-lab.com/records/lex/mathematical-assurance.md)

In tension with
[Cost/Complexity](https://banes-lab.com/records/lex/cost-complexity.md)

Conflicts with
[Informal Validation Only](https://banes-lab.com/records/lex/informal-validation-only.md)

Tensions
[Formal Verification Cost/Complexity](https://banes-lab.com/records/tension/cost-complexity-formal-verification.md)

Violated by
critical logic without proof where required

Detected by
missing formal model for critical invariant

Measured by
proven property coverage

Refactored by
Specify Model, Prove Invariant

Enforced by
proof tooling

Before

```typescript
function transferFoo(a: FooBalance, b: FooBalance, amount: number) {
a.value -= amount;
b.value += amount;
}
```

After

```typescript
function transferFoo(state: FooState, amount: PositiveAmount): FooState {
requires(state.from >= amount.value);
const next = { from: state.from - amount.value, to: state.to + amount.value };
ensures(next.from + next.to === state.from + state.to);
return next;
}
```

### Specification-Based Testing

- Kind: [activity](https://banes-lab.com/records/kind/activity.md)
- Severity: recommended
- Scope: function, API, module
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Specification](https://banes-lab.com/records/lex/specification.md)

Reinforces
[Correctness](https://banes-lab.com/records/arch/correctness.md), [Contracts](https://banes-lab.com/records/lex/contracts.md)

Enables
[Behavior Validation](https://banes-lab.com/records/lex/behavior-validation.md)

In tension with
[Spec Maintenance](https://banes-lab.com/records/lex/spec-maintenance.md)

Conflicts with
[Implementation-Only Testing](https://banes-lab.com/records/lex/implementation-only-testing.md), [Mock Mirage](https://banes-lab.com/records/arch/mock-mirage.md)

Tensions
[Specification-Based Testing Spec Maintenance](https://banes-lab.com/records/tension/spec-maintenance-specification-based-testing.md)

Violated by
tests coupled to implementation details

Detected by
lack of spec-derived tests

Measured by
spec coverage

Refactored by
Add Spec Tests

Enforced by
test gates

Before

```typescript
test("saveFoo", async () => expect(await saveFoo(foo)).toBeTruthy());
```

After

```typescript
describeContract("FooStore", store => {
it("returns the saved Foo", async () => {
await store.save(foo);
expect(await store.find(foo.id)).toEqual(foo);
});
});
```

### Property-Based Testing

- Kind: [activity](https://banes-lab.com/records/kind/activity.md)
- Severity: recommended
- Scope: function, algorithm, parser, domain invariant
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Properties/Invariants](https://banes-lab.com/records/lex/properties-invariants.md)

Reinforces
[Correctness](https://banes-lab.com/records/arch/correctness.md), [Robustness](https://banes-lab.com/records/lex/robustness.md)

Enables
[Broad Input Exploration](https://banes-lab.com/records/lex/broad-input-exploration.md)

In tension with
[Shrinking/Debug Complexity](https://banes-lab.com/records/lex/shrinking-debug-complexity.md)

Conflicts with
[Example-Only Testing](https://banes-lab.com/records/lex/example-only-testing.md)

Tensions
[Property-Based Testing Shrinking/Debug Complexity](https://banes-lab.com/records/tension/property-based-testing-shrinking-debug-complexity.md)

Violated by
invariant-heavy code with only example tests

Detected by
missing generative tests for critical properties

Measured by
property coverage, counterexample count

Refactored by
Define Property, Add Generator

Enforced by
property test suite

Before

```typescript
test("normalizeFoo", () => expect(normalizeFoo({ name: " Foo " }).name).toBe("Foo"));
```

After

```typescript
property(string(), name => {
const once = normalizeFoo({ name });
const twice = normalizeFoo(once);
expect(twice).toEqual(once);
});
```

### Static Analysis

- Kind: [mechanism](https://banes-lab.com/records/kind/mechanism.md)
- Severity: mandatory
- Scope: codebase, build
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Ruleset](https://banes-lab.com/records/lex/ruleset.md)

Reinforces
[Type Safety](https://banes-lab.com/records/arch/type-safety.md), [Security](https://banes-lab.com/records/lex/security.md), [Architecture Compliance](https://banes-lab.com/records/lex/architecture-compliance.md)

Enables
[Automated Enforcement](https://banes-lab.com/records/lex/automated-enforcement.md)

In tension with
[False Positives](https://banes-lab.com/records/lex/false-positives.md)

Conflicts with
[Unchecked Dynamic Code](https://banes-lab.com/records/lex/unchecked-dynamic-code.md)

Referenced by
[Metaprogramming](https://banes-lab.com/records/arch/metaprogramming.md), [Reflection](https://banes-lab.com/records/arch/reflection.md), [Plugin Architecture](https://banes-lab.com/records/arch/plugin-architecture.md), [Runtime Discovery](https://banes-lab.com/records/arch/runtime-discovery.md), [Type Safety](https://banes-lab.com/records/arch/type-safety.md)

Tensions
[Static Analysis False Positives](https://banes-lab.com/records/tension/false-positives-static-analysis.md)

Violated by
ignored analyzer findings

Detected by
static analysis rule failures

Measured by
issue count, false-positive rate

Refactored by
Fix Violations, Tune Rules

Enforced by
CI quality gates

Before

```typescript
const foo: any = loadFoo();
foo.nmae.toUpperCase();
```

After

```typescript
const foo: Foo = loadFoo();
foo.name.toUpperCase();
runTypeCheck({ noImplicitAny: true, strictNullChecks: true });
```

### Testability

- Kind: [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- Severity: mandatory
- Scope: class, module, service
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Low Coupling](https://banes-lab.com/records/arch/low-coupling.md), [Deterministic Behavior](https://banes-lab.com/records/lex/deterministic-behavior.md)

Reinforces
[Dependency Inversion Principle (DIP)](https://banes-lab.com/records/arch/dependency-inversion.md), [Pure Functions](https://banes-lab.com/records/arch/pure-functions.md)

Enables
[Regression Safety](https://banes-lab.com/records/lex/regression-safety.md)

In tension with
[Encapsulation Extremes](https://banes-lab.com/records/lex/encapsulation-extremes.md)

Conflicts with
[Hidden Dependencies](https://banes-lab.com/records/lex/hidden-dependencies.md), [Test Pyramid Inversion](https://banes-lab.com/records/arch/test-pyramid-inversion.md)

Referenced by
[Ports and Adapters Architecture](https://banes-lab.com/records/arch/ports-and-adapters-architecture.md), [Hexagonal Architecture](https://banes-lab.com/records/arch/hexagonal-architecture.md), [Clean Architecture](https://banes-lab.com/records/arch/clean-architecture.md), [Interface-Based Design](https://banes-lab.com/records/arch/interface-based-design.md), [Postconditions](https://banes-lab.com/records/arch/postconditions.md), [Single Responsibility Principle (SRP)](https://banes-lab.com/records/arch/single-responsibility.md), [High Cohesion](https://banes-lab.com/records/arch/high-cohesion.md), [Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md), [Pure Functions](https://banes-lab.com/records/arch/pure-functions.md), [Singleton Pattern](https://banes-lab.com/records/arch/singleton-pattern.md), [Dependency Injection](https://banes-lab.com/records/arch/dependency-injection.md), [Service Locator Pattern](https://banes-lab.com/records/arch/service-locator-pattern.md), [Stateless Processing](https://banes-lab.com/records/arch/stateless-processing.md), [State Isolation](https://banes-lab.com/records/arch/state-isolation.md), [Controlled Side Effects](https://banes-lab.com/records/arch/controlled-side-effects.md)

Tensions
[Testability Encapsulation Extremes](https://banes-lab.com/records/tension/encapsulation-extremes-testability.md)

Violated by
hardcoded dependencies, [global state](https://banes-lab.com/records/lex/global-state.md), nondeterminism

Detected by
difficult setup, excessive mocking, flaky tests

Measured by
test setup complexity, coverage, flake rate

Refactored by
Inject Dependencies, Isolate Side Effects

Enforced by
test gates, [architecture review](https://banes-lab.com/records/arch/architecture-review.md)

Before

```typescript
function createFoo(name: string) {
return fooDb.save({ id: crypto.randomUUID(), name, createdAt: new Date() });
}
```

After

```typescript
function createFoo(name: string, ids: IdSource, clock: Clock, store: FooStore) {
return store.save({ id: ids.nextFooId(), name, createdAt: clock.now() });
}
```

### Validation

- Kind: [activity](https://banes-lab.com/records/kind/activity.md)
- Severity: mandatory
- Scope: input, behavior, requirement
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Acceptance Criteria](https://banes-lab.com/records/lex/acceptance-criteria.md)

Reinforces
[Correctness](https://banes-lab.com/records/arch/correctness.md)

Enables
[Fitness for Use](https://banes-lab.com/records/lex/fitness-for-use.md)

In tension with
[Iteration Speed](https://banes-lab.com/records/lex/iteration-speed.md)

Conflicts with
[Assumption-Driven Delivery](https://banes-lab.com/records/lex/assumption-driven-delivery.md)

Referenced by
[Invariants](https://banes-lab.com/records/arch/invariants.md), [Correctness](https://banes-lab.com/records/arch/correctness.md), [Fail Fast](https://banes-lab.com/records/arch/fail-fast.md), [Self-Describing Structures](https://banes-lab.com/records/arch/self-describing-structures.md), [Metadata-Driven Design](https://banes-lab.com/records/arch/metadata-driven-design.md), [Canonicalization](https://banes-lab.com/records/arch/canonicalization.md), [Consistency](https://banes-lab.com/records/arch/consistency.md)

Tensions
[Validation Iteration Speed](https://banes-lab.com/records/tension/iteration-speed-validation.md)

Violated by
unvalidated user/system assumptions

Detected by
missing acceptance tests

Measured by
acceptance coverage

Refactored by
Add Validation Rules, Add Acceptance Tests

Enforced by
CI gates, QA policy

Before

```typescript
function createFoo(input: any) { return fooStore.save(input); }
```

After

```typescript
function createFoo(input: unknown) {
const foo = CreateFooSchema.parse(input);
return fooStore.save(foo);
}
```

### Verification

- Kind: [activity](https://banes-lab.com/records/kind/activity.md)
- Severity: mandatory
- Scope: implementation, system
- Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)

Details

Requires
[Specification](https://banes-lab.com/records/lex/specification.md)

Reinforces
[Correctness](https://banes-lab.com/records/arch/correctness.md)

Enables
[Specification Compliance](https://banes-lab.com/records/lex/specification-compliance.md)

In tension with
[Cost](https://banes-lab.com/records/lex/cost.md)

Conflicts with
[Untested Implementation](https://banes-lab.com/records/lex/untested-implementation.md)

Referenced by
[Repeatability](https://banes-lab.com/records/arch/repeatability.md)

Tensions
[Verification Cost](https://banes-lab.com/records/tension/cost-verification.md)

Violated by
code lacking spec conformance checks

Detected by
missing tests/static checks

Measured by
verification coverage

Refactored by
Add Tests, Add Static Checks

Enforced by
CI gates

Before

```typescript
await fooStore.save(foo);
return { ok: true };
```

After

```typescript
await fooStore.save(foo);
const persisted = await fooStore.find(foo.id);
if (!persisted || persisted.version !== foo.version) throw new Error("verification failed");
return { ok: true } as const;
```

## Links to

- [principle](https://banes-lab.com/records/kind/principle.md)
- [Computation Core](https://banes-lab.com/records/layer/computation-core.md)
- [Controlled Inputs](https://banes-lab.com/records/lex/controlled-inputs.md)
- [Controlled State](https://banes-lab.com/records/lex/controlled-state.md)
- [Predictability](https://banes-lab.com/records/arch/predictability.md)
- [Reproducibility](https://banes-lab.com/records/arch/reproducibility.md)
- [Reliable Testing](https://banes-lab.com/records/lex/reliable-testing.md)
- [Runtime Adaptivity](https://banes-lab.com/records/lex/runtime-adaptivity.md)
- [Hidden Time/Randomness/Global State](https://banes-lab.com/records/lex/hidden-time-randomness-global-state.md)
- [Referential Transparency](https://banes-lab.com/records/arch/referential-transparency.md)
- [Pure Functions](https://banes-lab.com/records/arch/pure-functions.md)
- [Artificial Intelligence Architecture](https://banes-lab.com/records/arch/artificial-intelligence-architecture.md)
- [Agentic Architecture](https://banes-lab.com/records/arch/agentic-architecture.md)
- [Determinism / Runtime Adaptivity](https://banes-lab.com/records/tension/determinism-runtime-adaptivity.md)
- [quality-attribute](https://banes-lab.com/records/kind/quality-attribute.md)
- [Determinism](https://banes-lab.com/records/arch/determinism.md)
- [Explicit Contracts](https://banes-lab.com/records/arch/explicit-contracts.md)
- [Principle of Least Surprise](https://banes-lab.com/records/arch/principle-of-least-surprise.md)
- [Safe Refactoring](https://banes-lab.com/records/lex/safe-refactoring.md)
- [Dynamic Runtime Behavior](https://banes-lab.com/records/lex/dynamic-runtime-behavior.md)
- [Hidden Behavior](https://banes-lab.com/records/lex/hidden-behavior.md)
- [Pattern Consistency](https://banes-lab.com/records/arch/pattern-consistency.md)
- [Design by Contract](https://banes-lab.com/records/arch/design-by-contract.md)
- [API Contract](https://banes-lab.com/records/arch/api-contract.md)
- [Postconditions](https://banes-lab.com/records/arch/postconditions.md)
- [Immutability](https://banes-lab.com/records/arch/immutability.md)
- [Repeatability](https://banes-lab.com/records/arch/repeatability.md)
- [Declarative Configuration](https://banes-lab.com/records/arch/declarative-configuration.md)
- [Convention over Configuration](https://banes-lab.com/records/arch/convention-over-configuration.md)
- [Runtime Discovery](https://banes-lab.com/records/arch/runtime-discovery.md)
- [Late Binding](https://banes-lab.com/records/arch/late-binding.md)
- [Runtime Extensibility](https://banes-lab.com/records/arch/runtime-extensibility.md)
- [State Isolation](https://banes-lab.com/records/arch/state-isolation.md)
- [Controlled Side Effects](https://banes-lab.com/records/arch/controlled-side-effects.md)
- [Predictability / Dynamic Runtime Behavior](https://banes-lab.com/records/tension/dynamic-runtime-behavior-predictability.md)
- [Tests](https://banes-lab.com/records/lex/tests.md)
- [Contracts](https://banes-lab.com/records/lex/contracts.md)
- [Testability](https://banes-lab.com/records/arch/testability.md)
- [Safe Substitution](https://banes-lab.com/records/lex/safe-substitution.md)
- [Stateful IO](https://banes-lab.com/records/lex/stateful-io.md)
- [Side Effects](https://banes-lab.com/records/lex/side-effects.md)
- [Referential Transparency / Stateful IO](https://banes-lab.com/records/tension/referential-transparency-stateful-io.md)
- [Code Review](https://banes-lab.com/records/arch/code-review.md)
- [technique](https://banes-lab.com/records/kind/technique.md)
- [No Side Effects](https://banes-lab.com/records/lex/no-side-effects.md)
- [Explicit Inputs](https://banes-lab.com/records/lex/explicit-inputs.md)
- [Stateful Operations](https://banes-lab.com/records/lex/stateful-operations.md)
- [Hidden IO](https://banes-lab.com/records/lex/hidden-io.md)
- [Pure Functions / Stateful Operations](https://banes-lab.com/records/tension/pure-functions-stateful-operations.md)
- [Value Semantics](https://banes-lab.com/records/lex/value-semantics.md)
- [Thread Safety](https://banes-lab.com/records/lex/thread-safety.md)
- [Safe Sharing](https://banes-lab.com/records/lex/safe-sharing.md)
- [Allocation Cost](https://banes-lab.com/records/lex/allocation-cost.md)
- [Shared Mutable State](https://banes-lab.com/records/arch/shared-mutable-state.md)
- [Value Object](https://banes-lab.com/records/arch/value-object.md)
- [Immutability / Allocation Cost](https://banes-lab.com/records/tension/allocation-cost-immutability.md)
- [Versioned Inputs](https://banes-lab.com/records/lex/versioned-inputs.md)
- [Auditability](https://banes-lab.com/records/arch/auditability.md)
- [Debugging](https://banes-lab.com/records/lex/debugging.md)
- [Compliance](https://banes-lab.com/records/arch/compliance.md)
- [Continuous Updates](https://banes-lab.com/records/lex/continuous-updates.md)
- [Floating Dependencies](https://banes-lab.com/records/lex/floating-dependencies.md)
- [Flaky Test Normalization](https://banes-lab.com/records/arch/flaky-test-normalization.md)
- [Machine Learning Architecture](https://banes-lab.com/records/arch/machine-learning-architecture.md)
- [Prompt Engineering](https://banes-lab.com/records/arch/prompt-engineering.md)
- [Environment Parity](https://banes-lab.com/records/arch/environment-parity.md)
- [Infrastructure as Code](https://banes-lab.com/records/arch/infrastructure-as-code.md)
- [Immutable Infrastructure](https://banes-lab.com/records/arch/immutable-infrastructure.md)
- [Benchmarking](https://banes-lab.com/records/arch/benchmarking.md)
- [Reproducibility / Continuous Updates](https://banes-lab.com/records/tension/continuous-updates-reproducibility.md)
- [Verification](https://banes-lab.com/records/arch/verification.md)
- [Reliable Automation](https://banes-lab.com/records/lex/reliable-automation.md)
- [Real-World Variability](https://banes-lab.com/records/lex/real-world-variability.md)
- [Environment-Sensitive Behavior](https://banes-lab.com/records/lex/environment-sensitive-behavior.md)
- [Repeatability / Real-World Variability](https://banes-lab.com/records/tension/real-world-variability-repeatability.md)
- [Specification](https://banes-lab.com/records/lex/specification.md)
- [Validation](https://banes-lab.com/records/arch/validation.md)
- [Safe Operation](https://banes-lab.com/records/lex/safe-operation.md)
- [Delivery Speed](https://banes-lab.com/records/lex/delivery-speed.md)
- [Undefined Behavior](https://banes-lab.com/records/lex/undefined-behavior.md)
- [Design Review](https://banes-lab.com/records/arch/design-review.md)
- [First-Principles Design](https://banes-lab.com/records/arch/first-principles-design.md)
- [Finite State Machine](https://banes-lab.com/records/arch/finite-state-machine.md)
- [Happens-Before Relationship](https://banes-lab.com/records/arch/happens-before-relationship.md)
- [Semantic Contracts](https://banes-lab.com/records/arch/semantic-contracts.md)
- [Preconditions](https://banes-lab.com/records/arch/preconditions.md)
- [Invariants](https://banes-lab.com/records/arch/invariants.md)
- [Formal Verification](https://banes-lab.com/records/arch/formal-verification.md)
- [Specification-Based Testing](https://banes-lab.com/records/arch/specification-based-testing.md)
- [Property-Based Testing](https://banes-lab.com/records/arch/property-based-testing.md)
- [Domain Model](https://banes-lab.com/records/arch/domain-model.md)
- [Fail Fast](https://banes-lab.com/records/arch/fail-fast.md)
- [Error Handling](https://banes-lab.com/records/arch/error-handling.md)
- [Model Evaluation](https://banes-lab.com/records/arch/model-evaluation.md)
- [Schema Validation](https://banes-lab.com/records/arch/schema-validation.md)
- [Type Safety](https://banes-lab.com/records/arch/type-safety.md)
- [Single Source of Truth](https://banes-lab.com/records/arch/single-source-of-truth.md)
- [Semantic Consistency](https://banes-lab.com/records/arch/semantic-consistency.md)
- [Input Validation](https://banes-lab.com/records/arch/input-validation.md)
- [Atomicity](https://banes-lab.com/records/arch/atomicity.md)
- [ACID](https://banes-lab.com/records/arch/acid.md)
- [Consistency](https://banes-lab.com/records/arch/consistency.md)
- [Isolation](https://banes-lab.com/records/arch/isolation.md)
- [Concurrency Control](https://banes-lab.com/records/arch/concurrency-control.md)
- [Correctness / Delivery Speed](https://banes-lab.com/records/tension/correctness-delivery-speed.md)
- [activity](https://banes-lab.com/records/kind/activity.md)
- [Formal Specification](https://banes-lab.com/records/lex/formal-specification.md)
- [Correctness](https://banes-lab.com/records/arch/correctness.md)
- [Mathematical Assurance](https://banes-lab.com/records/lex/mathematical-assurance.md)
- [Cost/Complexity](https://banes-lab.com/records/lex/cost-complexity.md)
- [Informal Validation Only](https://banes-lab.com/records/lex/informal-validation-only.md)
- [Formal Verification / Cost/Complexity](https://banes-lab.com/records/tension/cost-complexity-formal-verification.md)
- [Behavior Validation](https://banes-lab.com/records/lex/behavior-validation.md)
- [Spec Maintenance](https://banes-lab.com/records/lex/spec-maintenance.md)
- [Implementation-Only Testing](https://banes-lab.com/records/lex/implementation-only-testing.md)
- [Mock Mirage](https://banes-lab.com/records/arch/mock-mirage.md)
- [Specification-Based Testing / Spec Maintenance](https://banes-lab.com/records/tension/spec-maintenance-specification-based-testing.md)
- [Properties/Invariants](https://banes-lab.com/records/lex/properties-invariants.md)
- [Robustness](https://banes-lab.com/records/lex/robustness.md)
- [Broad Input Exploration](https://banes-lab.com/records/lex/broad-input-exploration.md)
- [Shrinking/Debug Complexity](https://banes-lab.com/records/lex/shrinking-debug-complexity.md)
- [Example-Only Testing](https://banes-lab.com/records/lex/example-only-testing.md)
- [Property-Based Testing / Shrinking/Debug Complexity](https://banes-lab.com/records/tension/property-based-testing-shrinking-debug-complexity.md)
- [mechanism](https://banes-lab.com/records/kind/mechanism.md)
- [Ruleset](https://banes-lab.com/records/lex/ruleset.md)
- [Security](https://banes-lab.com/records/lex/security.md)
- [Architecture Compliance](https://banes-lab.com/records/lex/architecture-compliance.md)
- [Automated Enforcement](https://banes-lab.com/records/lex/automated-enforcement.md)
- [False Positives](https://banes-lab.com/records/lex/false-positives.md)
- [Unchecked Dynamic Code](https://banes-lab.com/records/lex/unchecked-dynamic-code.md)
- [Metaprogramming](https://banes-lab.com/records/arch/metaprogramming.md)
- [Reflection](https://banes-lab.com/records/arch/reflection.md)
- [Plugin Architecture](https://banes-lab.com/records/arch/plugin-architecture.md)
- [Static Analysis / False Positives](https://banes-lab.com/records/tension/false-positives-static-analysis.md)
- [Low Coupling](https://banes-lab.com/records/arch/low-coupling.md)
- [Deterministic Behavior](https://banes-lab.com/records/lex/deterministic-behavior.md)
- [Dependency Inversion Principle (DIP)](https://banes-lab.com/records/arch/dependency-inversion.md)
- [Regression Safety](https://banes-lab.com/records/lex/regression-safety.md)
- [Encapsulation Extremes](https://banes-lab.com/records/lex/encapsulation-extremes.md)
- [Hidden Dependencies](https://banes-lab.com/records/lex/hidden-dependencies.md)
- [Test Pyramid Inversion](https://banes-lab.com/records/arch/test-pyramid-inversion.md)
- [Ports and Adapters Architecture](https://banes-lab.com/records/arch/ports-and-adapters-architecture.md)
- [Hexagonal Architecture](https://banes-lab.com/records/arch/hexagonal-architecture.md)
- [Clean Architecture](https://banes-lab.com/records/arch/clean-architecture.md)
- [Interface-Based Design](https://banes-lab.com/records/arch/interface-based-design.md)
- [Single Responsibility Principle (SRP)](https://banes-lab.com/records/arch/single-responsibility.md)
- [High Cohesion](https://banes-lab.com/records/arch/high-cohesion.md)
- [Singleton Pattern](https://banes-lab.com/records/arch/singleton-pattern.md)
- [Dependency Injection](https://banes-lab.com/records/arch/dependency-injection.md)
- [Service Locator Pattern](https://banes-lab.com/records/arch/service-locator-pattern.md)
- [Stateless Processing](https://banes-lab.com/records/arch/stateless-processing.md)
- [Testability / Encapsulation Extremes](https://banes-lab.com/records/tension/encapsulation-extremes-testability.md)
- [Global State](https://banes-lab.com/records/lex/global-state.md)
- [Architecture Review](https://banes-lab.com/records/arch/architecture-review.md)
- [Acceptance Criteria](https://banes-lab.com/records/lex/acceptance-criteria.md)
- [Fitness for Use](https://banes-lab.com/records/lex/fitness-for-use.md)
- [Iteration Speed](https://banes-lab.com/records/lex/iteration-speed.md)
- [Assumption-Driven Delivery](https://banes-lab.com/records/lex/assumption-driven-delivery.md)
- [Self-Describing Structures](https://banes-lab.com/records/arch/self-describing-structures.md)
- [Metadata-Driven Design](https://banes-lab.com/records/arch/metadata-driven-design.md)
- [Canonicalization](https://banes-lab.com/records/arch/canonicalization.md)
- [Validation / Iteration Speed](https://banes-lab.com/records/tension/iteration-speed-validation.md)
- [Specification Compliance](https://banes-lab.com/records/lex/specification-compliance.md)
- [Cost](https://banes-lab.com/records/lex/cost.md)
- [Untested Implementation](https://banes-lab.com/records/lex/untested-implementation.md)
- [Verification / Cost](https://banes-lab.com/records/tension/cost-verification.md)

## Linked from

- [The layer topology](https://banes-lab.com/ontology/schema/the-layer-topology.md)
- [The membership](https://banes-lab.com/ontology/schema/the-membership.md)
