Harness Notes
Lecture 10

Only a full pipeline run counts as real verification

Unit tests prove isolated parts. End-to-end tests prove the parts still work after they are wired together.

Notes from Learn Harness Engineering - Lecture 10

export_featurefull pipeline
Renderer tests
Preload tests
Service tests
Click buttonPreload bridgeService layerFile systemExported file

Only the bottom path observes the real system

The defect lives between components.

In the Electron export example, the renderer, preload script, and service layer each pass unit tests. The first real click exposes wrong path format, stuck progress, memory leakage, permission differences, and missing error propagation.

Unit-test view

Fast, precise, and isolated. Useful for local logic, but blind to the contracts between mocked components.

Every component looks correct on its own.
vs.

E2E view

Slower, but it exercises the real path through UI, bridge, service, operating system, and side effects.

Only end-to-end testing can prove absence of system-level defects.

Unit tests have systematic blind spots.

Isolation is the design philosophy that makes unit tests fast. It is also why they cannot catch defects created by wiring, shared state, real resources, or environment differences.

Interface mismatch

Renderer sends a relative file path while preload expects an absolute path.

State propagation

Schema changes but cached ORM entries still reflect the old table shape.

Resource lifecycle

File handles, database connections, and sockets leak across component boundaries.

Environment dependency

Mocked tests hide configuration, latency, permissions, and service availability.

E2E tests change how agents write code.

The lecture's overlooked point: when agents know the real flow will be run, they stop optimizing for the fastest green check and start respecting integration pressure.

01

Component interactions

The agent asks how this interface connects upstream and downstream.

02

Architectural boundaries

Executable tests force the agent to follow boundary rules instead of copying bad local patterns.

03

Error paths

Failure scenarios push exception handling, UI feedback, and propagation into the implementation.

Core concepts

Remember the gradient: each wider test layer catches a larger class of defects.

Component boundary defectsEach component passes alone, but the interaction between A and B fails.
Testing adequacy gradientUnit-detectable defects <= integration-detectable defects <= E2E-detectable defects.
Executable architectureArchitecture rules become lint checks or tests that fail automatically.
Review promotionRecurring review feedback becomes a permanent automated check.
Agent-oriented errorsFailure messages include what went wrong, why it matters, and exactly how to fix it.

Define boundaries before E2E.

Without architectural intent, a full-pipeline run only proves that the whole mess runs. For agent-built codebases, constraints need to exist on day one because agents copy existing patterns.

TypesConfigRepoServiceRuntimeUI

Rule: dependencies flow forward through fixed layers. Cross-domain concerns enter through explicit provider interfaces. Any other dependency is forbidden and mechanically enforced.

Promote review feedback into the harness.

A repeated review comment should not stay a comment. Turn it into a check with an error message that teaches the agent how to repair the violation.

01

Review finds: renderer imports fs directly.

02

Add a direct filesystem import check.

03

Error explains how to move access to preload.

04

Harness runs the check automatically.

05

Next violation fails immediately.

How to apply it

Require E2E for cross-component work.

Validation hierarchy: unit, integration, then E2E when multiple components change.

Automate architecture rules.

Convert constraints such as "renderer must not access filesystem" into lint or test checks.

Write repair instructions.

Failure messages need what, why, and fix steps so the agent can self-correct.

Grow the harness from reviews.

Every recurring defect category becomes a new permanent automated check.

ERROR: Found direct import of 'fs' in src/renderer/App.tsx:12
WHY: Renderer process has no access to Node.js APIs for security
FIX: Move file operations to src/preload/file-ops.ts
     and call via window.api.readFile()

Electron export case: E2E caught all five.

Unit tests for renderer, preload, and service all passed. The end-to-end flow found every system-level defect.

DefectDescriptionUnitE2E
Interface mismatchInconsistent file path format.MissedCaught
State propagationExport progress not sent back to UI via IPC.MissedCaught
Resource leakLarge file export handles not released.MissedCaught
Permission issueDifferent permissions in packaged environment.MissedCaught
Error propagationService layer exceptions did not reach UI layer.MissedCaught

Runtime tradeoff

5
defects
caught by E2E
0
defects
caught by unit tests
2s
unit phase
fast but incomplete
15s
E2E phase
acceptable for agents
TAKEAWAY

Run the real path: UI to bridge to service to side effect, with architecture checks that teach the repair.