WEBVTT

00:00:00.500 --> 00:00:03.455
Before anything is deployed, we can run the modules on their

00:00:03.468 --> 00:00:03.898
own.

00:00:04.798 --> 00:00:06.895
No canister, no upgrade.

00:00:07.793 --> 00:00:10.489
Just commands going in and answers coming out.

00:00:11.387 --> 00:00:15.085
Each row of a simulation says three things: the command, the

00:00:15.098 --> 00:00:18.262
answer we expect, and what must still be true afterward.

00:00:19.160 --> 00:00:19.707
Run it.

00:00:20.606 --> 00:00:22.090
Loan seven goes out.

00:00:22.989 --> 00:00:25.567
The same member asks again and is refused.

00:00:26.465 --> 00:00:28.418
A ladder that is out is refused.

00:00:29.317 --> 00:00:32.364
Loan five comes back, and now the ladder can go.

00:00:33.262 --> 00:00:35.710
And a branch with tools out will not close.

00:00:36.608 --> 00:00:39.772
After every single command, all four rules are checked.

00:00:40.671 --> 00:00:43.210
Look at how many of these rows are refusals.

00:00:44.108 --> 00:00:45.202
That is deliberate.

00:00:46.101 --> 00:00:48.575
The ordinary path rarely hides a mistake.

00:00:49.473 --> 00:00:50.384
The edges do.

00:00:51.283 --> 00:00:54.278
And rule four checks the thing we asked for in lesson one: a

00:00:54.291 --> 00:00:55.840
refusal changes nothing.

00:00:56.739 --> 00:01:00.423
Once the hand-written rows pass, ask for a long random run under

00:01:00.437 --> 00:01:01.478
the same rules.

00:01:02.377 --> 00:01:05.762
A simulation answers one question: are the rules right?

00:01:06.660 --> 00:01:10.293
It is fast, and it sets the day itself, because the day is an

00:01:10.306 --> 00:01:10.931
argument.

00:01:11.830 --> 00:01:13.848
It says nothing about an upgrade.

00:01:14.746 --> 00:01:17.624
For that we need a real canister with a real old release in

00:01:17.637 --> 00:01:17.884
it.

00:01:20.033 --> 00:01:22.272
A rehearsal starts where production is.

00:01:23.173 --> 00:01:25.673
Install the old release, the real build.

00:01:26.571 --> 00:01:30.399
Fill it through its public methods: two branches, three tools,

00:01:30.673 --> 00:01:31.714
five loans.

00:01:32.613 --> 00:01:34.084
Then write down what is there.

00:01:34.983 --> 00:01:36.506
These values are the test.

00:01:37.404 --> 00:01:40.399
Now attempt every upgrade that could happen, in order.

00:01:41.298 --> 00:01:45.087
A build that forgot to name its predecessor: refused, values

00:01:45.100 --> 00:01:45.608
equal.

00:01:46.506 --> 00:01:50.022
A build that fails late: rolled back, values equal.

00:01:50.920 --> 00:01:54.839
The real release three: converted, and every old value is there

00:01:54.852 --> 00:01:56.441
with the new field beside it.

00:01:57.339 --> 00:02:00.503
Then the old build again: refused, nothing lost.

00:02:01.402 --> 00:02:05.673
Then release three once more, over itself: accepted, values

00:02:05.686 --> 00:02:06.180
equal.

00:02:07.079 --> 00:02:08.108
Five attempts.

00:02:09.006 --> 00:02:12.808
Each one has a before, an after, and an expected difference.

00:02:13.706 --> 00:02:16.063
Four of the five expect no difference at all.

00:02:16.962 --> 00:02:19.631
One more step, and it is the one people skip.

00:02:20.529 --> 00:02:22.717
After the upgrade, use the app.

00:02:23.615 --> 00:02:24.475
Lend a tool.

00:02:25.373 --> 00:02:26.363
Take one back.

00:02:27.261 --> 00:02:28.381
Record a condition.

00:02:29.279 --> 00:02:31.506
Old data read correctly is half of it.

00:02:32.404 --> 00:02:35.165
New writes on top of old data is the other half.

00:02:37.300 --> 00:02:38.784
This is what you hand over.

00:02:39.684 --> 00:02:41.976
The modules and what each one saves.

00:02:42.875 --> 00:02:45.114
Who owns whom, and who calls whom.

00:02:46.013 --> 00:02:47.549
A bound on every collection.

00:02:48.447 --> 00:02:50.544
What each storage choice must promise.

00:02:51.442 --> 00:02:52.861
The files that are frozen.

00:02:53.760 --> 00:02:55.635
When the app is ready to upgrade.

00:02:56.533 --> 00:02:58.630
The scenario, and the rehearsal.

00:02:59.528 --> 00:03:01.377
You did not write a line of the code.

00:03:02.276 --> 00:03:04.515
You decided everything that the code must be.

