Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ evidence; the helper never resets, stashes, cleans, forces, repins or deletes it

It fetches only fixed upstream and fast-forwards `main`, then invokes that fetched
checkout's `bash install.sh update --no-pull` once, including equal-SHA reinstalls.
`--no-pull` suppresses only the outer installer pull. The receipt reports old,
helper-selected and final SHA. Installer output
owns component outcomes; nonzero/partial failure propagates and successful host
items remain installed, not rolled back. Repair the reported cause and retry only
compatible selected failures. Reload/reopen the current agent session for discovery;
`--no-pull` suppresses only the outer installer pull. After the installer finishes,
the helper repeats the old and helper-selected SHAs alongside the final SHA on one
line, then reports `installer_exit`. Installer output owns component outcomes;
nonzero/partial failure propagates and successful host items remain installed,
not rolled back. Repair the reported cause and retry only compatible selected
failures. Reload/reopen the current agent session for discovery;
package refresh does not reload a running agent. The installer can activate Orbi
when that component is selected; it does not qualify live delivery.

Expand Down
2 changes: 1 addition & 1 deletion skills/update-kit/scripts/update_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def update(source, flags):
finally:
final = git(source, 'rev-parse', 'HEAD', check=False)
final_sha = final.stdout.strip() if final.returncode == 0 else 'NOT_CHECKED'
print(f'final_sha={final_sha}', flush=True)
print(f'old_sha={old} selected_sha={selected} final_sha={final_sha}', flush=True)
if final.returncode:
print('Final source revision NOT_CHECKED: ' + final.stderr.strip(), flush=True)
elif final_sha != selected:
Expand Down
44 changes: 27 additions & 17 deletions tests/test_update_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ def test_fresh_equal_and_fast_forward_reinstall_literal_argv(self):
out = self.success(*flags)
self.assertTrue((self.source / 'scripts/install_menu.py').is_file())
self.assertEqual(git(self.source, 'remote', 'get-url', 'origin'), updater.SOURCE)
self.assertIn(old, out)
self.assertIn(f'old_sha=ABSENT\nselected_sha={old}\n', out)
self.assertEqual(out.splitlines()[-2], f'old_sha=ABSENT selected_sha={old} final_sha={old}')
self.assertIn('check for updates every run', out)
self.assertIn('restart only proven affected active integrations', out)
self.assertIn('Selecting Orbi stops, updates and restarts verified local deployments', out)
self.success(*flags)
new = self.advance()
out = self.success(*flags)
self.assertEqual(git(self.source, 'rev-parse', 'HEAD'), new)
self.assertIn(old, out)
self.assertIn(new, out)
self.assertEqual(out.splitlines()[-2], f'old_sha={old} selected_sha={new} final_sha={new}')
expected = [b'update', b'--no-pull', *(arg.encode() for arg in flags)]
self.assertEqual(self.argv(), expected * 3)

Expand All @@ -132,9 +132,10 @@ def test_secondary_refresh_reports_selected_and_final_sha(self):
os.environ['SECONDARY'] = str(self.upstream)
with patch.object(updater, '_source_url', return_value=str(snapshot)):
out = self.success()
self.assertIn('secondary', out.lower())
self.assertIn(selected, out)
self.assertIn(final, out)
lines = out.splitlines()
self.assertEqual(lines[-3], f'old_sha={selected} selected_sha={selected} final_sha={final}')
self.assertIn('Secondary source change', lines[-2])
self.assertTrue(lines[-1].startswith('installer_exit=0;'), out)
self.assertEqual(len(self.argv()), 4)
self.assertEqual((self.home / 'native-installer-argv').read_bytes(), b'update\0--no-pull\0')

Expand All @@ -143,8 +144,11 @@ def test_installer_partial_failure_is_not_rolled_back(self):
code, out = self.invoke('--skip', 'orbi')
self.assertEqual(code, 7, out)
self.assertTrue(self.source.exists())
self.assertIn('final_sha=', out)
self.assertIn('not rolled back', out)
selected = git(self.upstream, 'rev-parse', 'HEAD')
lines = out.splitlines()
self.assertEqual(lines[-2], f'old_sha=ABSENT selected_sha={selected} final_sha={selected}')
self.assertTrue(lines[-1].startswith('installer_exit=7;'), out)
self.assertIn('not rolled back', lines[-1])
self.assertEqual(self.argv(), [b'update', b'--no-pull', b'--skip', b'orbi'])

def test_unavailable_final_readback_does_not_claim_a_secondary_change(self):
Expand All @@ -162,8 +166,11 @@ def unavailable(argv, **kwargs):
with patch.object(updater, 'run', side_effect=unavailable):
code, out = self.invoke('--skip', 'orbi')
self.assertEqual(code, 7, out)
self.assertIn('final_sha=NOT_CHECKED', out)
self.assertIn('fixture readback failed', out)
selected = git(self.upstream, 'rev-parse', 'HEAD')
lines = out.splitlines()
self.assertEqual(lines[-3], f'old_sha=ABSENT selected_sha={selected} final_sha=NOT_CHECKED')
self.assertIn('fixture readback failed', lines[-2])
self.assertTrue(lines[-1].startswith('installer_exit=7;'), out)
self.assertNotIn('Secondary source change', out)

def test_preview_has_no_writes_or_probes(self):
Expand Down Expand Up @@ -381,14 +388,17 @@ def local_transport(argv, **kwargs):
raise SystemExit(m.main(sys.argv[3:]))
'''
command = [sys.executable, '-B', '-c', program, str(HELPER), str(self.upstream)]
for flags in (['--skip', 'orbi'], ['--only', 'pi,tx']):
selected = git(self.upstream, 'rev-parse', 'HEAD')
for flags, old, exit_code in ((['--skip', 'orbi'], 'ABSENT', 0),
(['--only', 'pi,tx'], selected, 0),
(['--skip', 'orbi'], selected, 7)):
result = subprocess.run([*command, *flags], cwd=self.root, capture_output=True,
text=True, timeout=30, env=dict(os.environ))
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn('pi installed; codex skipped', result.stdout)
self.assertIn('selected_sha=', result.stdout)
self.assertIn('final_sha=', result.stdout)
self.assertIn('installer_exit=0', result.stdout)
text=True, timeout=30, env=dict(os.environ, INSTALL_EXIT=str(exit_code)))
self.assertEqual(result.returncode, exit_code, result.stdout + result.stderr)
lines = result.stdout.splitlines()
self.assertIn('pi installed; codex skipped', lines[-3])
self.assertEqual(lines[-2], f'old_sha={old} selected_sha={selected} final_sha={selected}')
self.assertTrue(lines[-1].startswith(f'installer_exit={exit_code};'), result.stdout)
argv = self.argv()
result = subprocess.run([*command, '--only', 'hermes'], cwd=self.root,
capture_output=True, text=True, timeout=30, env=dict(os.environ))
Expand Down
Loading