Reviewing a Change
Tutorial 11 of 12 takes Leaseline's edits through a Change, with tests, a scenario and an Evaluator on the notice, to review, merge and deploy.
Every edit to a definition is a Change, reviewed before it merges. Leaseline declares a Lease Noun, and its notice is graded before any resident reads it.
What you build
You add a scenario test and an Evaluator for the notice's tone, then review, merge and deploy the Change that holds tutorials 2 to 10.
Steps
To test the whole path, write a scenario that walks it as a manager would:
tests/first-renewal.test.ts import { clock, expect, test, walk } from 'startup-builder/test' test('a lease ending in 60 days gets its notice', async () => { const manager = await walk('manager') await manager.subscribe('pro') await manager.import('mappings/ rent-roll', 'fixtures/ rent-roll.csv') await clock.advance('1 day') expect(await manager.inbox()).toContainMessage('Your lease at 4B ends') }) To grade the notice, write its rubric:
evaluators/notice-tone.ts import { evaluator } from 'startup-builder' export default evaluator({ rubric: 'States the end date and the new rent,offers one clear next step, and makes no threat.', grade: async (notice: string, $) => $`Grade this renewal notice against the rubric: ${notice}`, }) To review the Change, run every test and Evaluator on its preview:
npx startup-builder do Change.review --json '{"change":"change_3Ex8uVSOyQ"}' To merge it into a new Version, call merge. A field changed on both sides sends it back to review:
npx startup-builder do Change.merge --json '{"change":"change_3Ex8uVSOyQ"}' To serve the new Version, deploy it:
npx startup-builder do Version.deploy --json '{"version":"version_4HTEMs14G4"}'
Result
The Change passed its Verb tests, the scenario and the tone Evaluator, merged into a new Version and serves at Leaseline's address. A bad merge is reverted by a new Change, and nothing is deleted. Checkpoint leaseline@ch11 (status planned) adds tests/ and evaluators/.
Next steps
- Tutorial 12 takes the Startup Live.
- Changes and records: how a Change merges, and what writes directly.