Master

Shipping a bounded system

The end state is not that the module runs. It is that the module runs inside limits that someone wrote, and that a breach of a limit is a refusal with a number.

What you will see

One line with both numbers and a date. That line is the record of the decision.

About 1 min of reading

Try It

Write the four limits and prove a refusal

1

Write the limits file

printf 'memory_pages 512\nfuel 1000000\nimports 2\ntimeout_ms 5000\n' > /tmp/lim.txt; wc -l < /tmp/lim.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
4. Four numbers is the whole contract of the system.
2

Attempt a run that breaches one

printf 'fuel_used 1200000\n' | awk '{print ($1>1000000) ? "refuse" : "run"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse. The refusal came from the file, not from a person reading it.
3

Name the breached limit

printf 'refuse limit=fuel used=1200000 max=1000000 date=2026-10-10\n' >> /tmp/stops.txt; tail -1 /tmp/stops.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line with both numbers and a date. That line is the record of the decision.

Data Flow

A system to a shippable state
1 The module contract is written
↓
2 The host limits are written
↓
3 The suite runs on every deploy
↓
4 A breach refuses and names the limit
Why this works
Why the ceiling is enforced in the host

The module cannot stop itself. The host is the only component that can refuse, so the ceiling lives there.

The end state of this subject

Two contracts and one file each. The module contract and the host limits, both stamped, both argued with.

Examples

The limits are one file

Memory, fuel, imports, and timeout. Four numbers, one file, and the file is the contract of the system.

The suite runs on every deploy

The same rule as every shippable system. A deploy that skips the suite is a deploy that changes the contract.

The open cases are the honest list

Inputs that were not tried. The list is short, and the shortness is the claim.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Debugging a module
Previous Lesson
Debugging a module