Migrate fresh installs despite a previous channel preference

This commit is contained in:
firestar5683
2026-11-17 18:10:54 -06:00
parent 91241e6183
commit d49eef473c
6 changed files with 20 additions and 9 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ function update_is_ready {
# every boot before swapping trees, including manual reboots.
# Keep this in sync with TRUSTED_LEGACY_RELEASES in updated.py.
TRUSTED_LEGACY_STARPILOT_COMMIT="c2e5e469ee8fefc3cffb514dc2e1a1fb82a421d6"
TRUSTED_LEGACY_STABLE_MIGRATION="0758072c767719dd63d133f78c6738b90505cb4e"
TRUSTED_LEGACY_STABLE_MIGRATION="7ab42497b4590153c88560c7e2c2f3ff8317c6d4"
function trusted_legacy_commit {
[ "$1" = "$TRUSTED_LEGACY_STARPILOT_COMMIT" ] || [ "$1" = "$TRUSTED_LEGACY_STABLE_MIGRATION" ]
@@ -302,8 +302,8 @@ class TestVendoredUpdate(unittest.TestCase):
self.updated.validate_update_revision(str(self.source), target, 'StarPilot')
audited = load_updater().TRUSTED_LEGACY_RELEASES
self.assertEqual(audited, {
'StarPilot': frozenset({'c2e5e469ee8fefc3cffb514dc2e1a1fb82a421d6', '0758072c767719dd63d133f78c6738b90505cb4e'}),
'stable': frozenset({'0758072c767719dd63d133f78c6738b90505cb4e'}),
'StarPilot': frozenset({'c2e5e469ee8fefc3cffb514dc2e1a1fb82a421d6', '7ab42497b4590153c88560c7e2c2f3ff8317c6d4'}),
'stable': frozenset({'7ab42497b4590153c88560c7e2c2f3ff8317c6d4'}),
})
def test_reserved_readiness_marker_rejected_in_modern_and_legacy_trees(self):
+2 -2
View File
@@ -266,8 +266,8 @@ def init_overlay() -> None:
# Audited legacy release, pinned by Git commit identity. Other releases must
# satisfy the modern source manifest contract.
TRUSTED_LEGACY_RELEASES = {
'StarPilot': frozenset({'c2e5e469ee8fefc3cffb514dc2e1a1fb82a421d6', '0758072c767719dd63d133f78c6738b90505cb4e'}),
'stable': frozenset({'0758072c767719dd63d133f78c6738b90505cb4e'}),
'StarPilot': frozenset({'c2e5e469ee8fefc3cffb514dc2e1a1fb82a421d6', '7ab42497b4590153c88560c7e2c2f3ff8317c6d4'}),
'stable': frozenset({'7ab42497b4590153c88560c7e2c2f3ff8317c6d4'}),
}
LEGACY_OS_MARKER = '.git/starpilot-retain-agnos'
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "e50af3c3ccbc4df5d97292180f6972f63009659ab1a5e6e020f1bad9857e64e9", "schema_version": 1}
{"protected_inventory_sha256": "b4d8568468769c810d1a248395406c8c159cc0ca4da5943ab840048e2fef1a23", "schema_version": 1}
+1 -1
View File
@@ -82,7 +82,7 @@ def migrate(repo, params, checkpoint=lambda step: None):
return 'manual branch selection'
target = params / 'UpdaterTargetBranch'
saved = target.read_bytes() if target.exists() else b''
if saved not in (b'', plan['source'].encode(), plan['destination'].encode()):
if pending.exists() and saved not in (b'', plan['source'].encode(), plan['destination'].encode()):
return 'manual updater selection'
if not params.is_dir() or target.is_symlink():
raise ValueError('Updater Params directory is unavailable or unsafe')
+13 -2
View File
@@ -148,12 +148,23 @@ class BranchMigrationTest(unittest.TestCase):
self.assertEqual(runtime.migrate(repo, params), 'not migration release')
self.assertEqual(self.git(repo, 'symbolic-ref', '--short', 'HEAD'), 'StarPilot')
def test_manual_updater_target_is_preserved(self):
def test_fresh_source_install_replaces_a_stale_previous_channel_target(self):
_, repo, params, _ = self.fixture()
(params / 'UpdaterTargetBranch').write_text('StarPilot')
self.assertEqual(runtime.migrate(repo, params), 'migrated to testing')
self.assertEqual((params / 'UpdaterTargetBranch').read_text(), 'testing')
self.assertEqual(self.git(repo, 'symbolic-ref', '--short', 'HEAD'), 'testing')
def test_manual_target_selected_after_an_interruption_is_preserved(self):
_, repo, params, _ = self.fixture()
def stop(step):
if step == 'pending':
raise RuntimeError('interrupted')
with self.assertRaises(RuntimeError):
runtime.migrate(repo, params, stop)
(params / 'UpdaterTargetBranch').write_text('dev')
self.assertEqual(runtime.migrate(repo, params), 'manual updater selection')
self.assertEqual((params / 'UpdaterTargetBranch').read_text(), 'dev')
self.assertEqual(self.git(repo, 'symbolic-ref', '--short', 'HEAD'), 'Dom')
def test_existing_different_destination_is_not_overwritten(self):
_, repo, params, migration = self.fixture()