Advanced

Watching as a component that owns a list

A watcher is not a smaller build. The watcher is a component that owns the file list, and the list is why a change rebuilds part.

What you will see

bug empty set. A change that rebuilds nothing is the whole bug.

About 1 min of reading

Try It

Answer a change with a set

1

Write the map

printf 'a.css /a/ /b/\nb.css /b/\n' > /tmp/m.txt; wc -l < /tmp/m.txt

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

What it prints
2. Two names is the map, which is the component.
2

Answer a change

printf 'a.css\n' | awk '{print $2, $3}'

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

What it prints
Two pages. The set is smaller than the site.
3

Name an empty set

printf 'changed zzz pages 0\n' | awk '{print ($4==0) ? "bug empty set" : "ok"}'

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

What it prints
bug empty set. A change that rebuilds nothing is the whole bug.

Data Flow

A change to a smaller rebuild
1 The map is built at the first build
↓
2 A change names one file
↓
3 The map answers with the pages it affects
↓
4 The set is rebuilt and counted
Why this works
Why the map is written down

A map that is written is a map a reader checks. A map that is guessed is a map that misses a page.

The failure at this step

A change that rebuilds nothing. The set is empty, and an empty set is the whole bug.

Examples

The list is the component state

Names to the pages they affect. The map is the component, and the component is what a change is asked about.

A change rebuilds a set

The set is the pages the name affects. A set is what makes a rebuild smaller than a build.

The loop is not the build

The loop asks and the build answers. Two parts is what makes the loop testable alone.

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.

← Drafts as a written switch
Previous Lesson
Drafts as a written switch
Next Lesson
Deploying gated by the report
Deploying gated by the report →