v3.22.3: the mismatch on_fail, the self-healing move, the pruning reconciliation

Three test-management issues:

- an expectation whose command type did not match the pending command
  hard-coded level 'error', so on_fail "warning" tolerated "no command
  pending" but not "a different command is pending".  The check now honours
  the step's on_fail - the tolerant form for "the applet either asks X or
  does Y" (the mismatched command is still fetched and answered).
- moving a script between suites could answer 500 and leave two owners:
  _test_script_move detached only from the suite named by the script's
  suite_id and appended to the target unconditionally, so a duplicate
  listing or a stale suite_id (a hand edit, an interrupted move) collided
  on the attach.  It now detaches from every suite that lists the script,
  takes the on_fail from the explicit owner (suite_id if that suite lists
  it, else the first lister), updates the script first (a refused
  validation changes nothing) and re-attaches with a prune; the same-suite
  no-op only applies when the target really is the only lister.
- reconcile_scripts_to_suites() now prunes duplicate listings to the
  explicit owner (it only adopted before), so those states self-heal at
  startup and after a bundle import; the "Imported scripts" suite is only
  created when there are orphans.

Docs: the bundle-import note (importing into the source store duplicates
the suite and its scripts - the round-trip is not idempotent) and the
expectation on_fail clarification.
Tests: 839 frontend + 818 Python; sw cache simple-v407.
This commit is contained in:
2026-10-06 21:14:07 +03:00
parent a76e0154b6
commit 7d997272ef
9 changed files with 258 additions and 55 deletions
+33
View File
@@ -563,6 +563,39 @@ class TestRunnerDialogue(RunnerTestCase):
self.assertIn('no proactive command pending',
run['steps'][0]['checks'][0]['detail'])
def test_a_command_mismatch_honours_on_fail(self):
# v3.22.3: a different command pending is a check failure at the
# step's on_fail level, like every other expectation check - so
# on_fail "warning" expresses "the applet either asks X or does Y"
# (the mismatched command is still fetched and answered).
scc = FakeScc()
scc.push('80F2', '', '9102') # STATUS: DISPLAY TEXT pending
scc.push('8012', DISPLAY_TEXT_CMD, '9000')
scc.push('8014', '', '9000')
run = self.run_script(FakeServer(scc), [
{'type': 'action', 'kind': 'status', 'params': {'attempts': 2}},
{'type': 'expect', 'command': 'SEND SHORT MESSAGE',
'respond': {'result': 'ok'}, 'on_fail': 'warning'},
])
self.assertEqual(run['status'], 'warning', run['steps'])
check = run['steps'][1]['checks'][0]
self.assertEqual(check['label'], 'Command')
self.assertFalse(check['ok'])
self.assertEqual(check['level'], 'warning')
self.assertIn('DISPLAY TEXT', check['actual'])
self.assertTrue(run['steps'][1]['sent'].startswith('TR '))
# the default (error) still stops the run
scc2 = FakeScc()
scc2.push('80F2', '', '9102')
scc2.push('8012', DISPLAY_TEXT_CMD, '9000')
scc2.push('8014', '', '9000')
run2 = self.run_script(FakeServer(scc2), [
{'type': 'action', 'kind': 'status', 'params': {'attempts': 2}},
{'type': 'expect', 'command': 'SEND SHORT MESSAGE',
'respond': {'result': 'ok'}},
])
self.assertEqual(run2['status'], 'error')
def test_text_mismatch_fails_the_expectation(self):
scc = FakeScc()
scc.push('80C2', '', '9105')