Master

Shipping with every limit in one file

A site ships when the numbers are inside the limits. The limits are one file, and one file is why a refusal can name the limit it broke.

What you will see

One line with the numbers. Written numbers are what a change is compared against.

About 1 min of reading

Try It

Ship with named limits

1

Write the limits

printf 'pages 12 bytes 90000 depth 3 refusals 0\n' > /tmp/l.txt; wc -w < /tmp/l.txt

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

What it prints
8. Four names and four numbers is one file.
2

Compare name by name

printf 'refusals 0\nmax_refusals 0\n' | awk '{print ($1>$3) ? "breach refusals" : "ok refusals"}'

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

What it prints
ok refusals. One comparison per limit is a separate line.
3

Write the shipped numbers

printf 'shipped pages 12 bytes 88123\n' >> /tmp/s.txt; tail -1 /tmp/s.txt

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

What it prints
One line with the numbers. Written numbers are what a change is compared against.

Data Flow

A report and limits to a ship
1 The limits are written as names and numbers
↓
2 The report is compared name by name
↓
3 Each breach is written as its own line
↓
4 The ship writes the numbers it shipped with
Why this works
Why a limit is never a default in code

A default in code is a limit nobody can read. A limit in a file is a limit that a refusal can name.

The one limit that is not a number

The set of pages that must exist. A set is a limit, and a missing name is a breach of that limit.

Examples

The limits are names and numbers

Pages, bytes, depth, refusals. Names are what a refusal repeats, and a refusal that repeats is a refusal that is actionable.

The report is compared name by name

One comparison per limit. One per limit is what makes every breach a separate line.

The ship is the last line of the report

The ship writes the numbers it shipped with. Written numbers are what a later change is compared against.

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.

← A wrong page as ordered prints
Previous Lesson
A wrong page as ordered prints