@@ -87,17 +87,22 @@ def test_a_change_is_made_in_the_theme_and_logged_without_a_stage(self):
8787 log = json .loads ((self .ws / 'changes.json' ).read_text ())
8888 self .assertEqual (log ['schema' ], 'h2wp-changes/1' )
8989 self .assertTrue (log ['changedSinceZip' ])
90+ self .assertEqual (log ['sinceZip' ], 1 )
9091 entry = log ['changes' ][- 1 ]
9192 self .assertEqual ((entry ['what' ], entry ['files' ], entry ['applied' ]),
9293 ('make the heading italic' , ['clara-content/sources/front-page.html' ], True ))
9394 self .assertEqual ((self .ws / 'progress.json' ).read_text (), before , 'no stage started' )
9495 self .assertEqual (self .apply ().returncode , 3 , 'applied: nothing new to apply' )
9596
9697 def test_the_guard_a_delivered_project_starts_no_stage (self ):
98+ before = (self .ws / 'progress.json' ).read_text ()
9799 for args in (('start' , '-1' ), ('start' , '0' ), ('mode' , 'flash' ), ('mode' , 'full' )):
98100 done = run ('bash' , HERE / 'progress.sh' , * args , env = self .env )
99101 self .assertEqual (done .returncode , 3 , args )
100102 self .assertIn ('apply-change.py' , done .stderr )
103+ # The owner's rule: a change never points at starting over.
104+ self .assertNotRegex (done .stderr .lower (), r'rebuild|--new|start over' )
105+ self .assertEqual ((self .ws / 'progress.json' ).read_text (), before , 'a refusal writes nothing: still delivered' )
101106 rebuild = run ('bash' , HERE / 'progress.sh' , 'mode' , 'flash' , '--new' , env = self .env )
102107 self .assertEqual (rebuild .returncode , 0 , rebuild .stderr )
103108 self .assertFalse ((self .ws / 'result.json' ).exists ())
@@ -122,10 +127,22 @@ def test_get_zip_packages_the_live_theme_as_the_next_revision(self):
122127 result = json .loads ((folder / 'result.json' ).read_text ())
123128 self .assertEqual ((result ['theme' ]['file' ], result ['revision' ], result ['checkedRevision' ], result ['status' ]),
124129 ('studio-1.0.0-r2.zip' , 2 , 1 , 'delivered' ))
125- self .assertFalse (json .loads ((self .ws / 'changes.json' ).read_text ())['changedSinceZip' ])
130+ self .assertEqual ({k : json .loads ((self .ws / 'changes.json' ).read_text ())[k ] for k in ('changedSinceZip' , 'sinceZip' )},
131+ {'changedSinceZip' : False , 'sinceZip' : 0 })
126132 again = package ()
127133 self .assertEqual ((json .loads (again .stdout )['reused' ], json .loads (again .stdout )['file' ]), (True , 'studio-1.0.0-r2.zip' ))
128134
135+ def test_the_change_brief_never_offers_starting_over (self ):
136+ # After delivery every change goes into the live theme. What the theme
137+ # cannot change is said plainly — never "Rebuild", never a new run.
138+ skill = (HERE .parent .parent / 'SKILL.md' ).read_text ()
139+ start = skill .index ('## Changes after delivery' )
140+ section = skill [start :skill .index ('\n ## ' , start + 3 )]
141+ self .assertIn ('apply-change.py' , section )
142+ self .assertNotRegex (section .lower (), r'rebuild|--new|start over|mode <' )
143+ for script in ('apply-change.py' , 'package-theme.py' ):
144+ self .assertNotRegex ((HERE / script ).read_text ().lower (), r'rebuild|start over' , script )
145+
129146 def test_not_a_delivered_project (self ):
130147 (self .ws / 'result.json' ).write_text (json .dumps ({'status' : 'stopped' }))
131148 self .assertEqual (self .apply ().returncode , 2 )
0 commit comments