The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Harness OS: a system update is a newer release, not a later build of the same one (#1522)
Bubu-Dudu-52hz5b5fe0e87ce5
diff --git a/os/release_update.py b/os/release_update.pyindex 5807781ba..6d28c7e23 100644--- a/os/release_update.py+++ b/os/release_update.py@@ -63,6 +63,12 @@ def verified(value, fixture=False):return data+def release(package_version):+ """A package version as its release: without the build (`.r<time>.g<commit>`, build-package.py)+ and the package release (`-1`). `0.1.8.r1792577066.g8df82cc2bc-1` is `0.1.8`."""+ return re.sub(r'\.r\d+\.g[0-9a-f]+$', '', package_version.rsplit('-', 1)[0] if '-' in package_version else package_version)++def discover(feed=FEED):fixture = feed != FEEDtry:@@ -87,7 +93,10 @@ def discover(feed=FEED):current = subprocess.check_output(['pacman', '-Q', 'harness-os'], text=True).strip().split()if len(current) != 2 or current[0] != 'harness-os' or not re.fullmatch(r'[0-9A-Za-z.+_-]+', current[1]):raise ValueError('Cannot identify the installed Harness system package.')- newer = int(subprocess.check_output(['vercmp', value, current[1]], text=True)) > 0+ # Newer only as a release: 0.1.9 after 0.1.8. The same release built from a later commit+ # (0.1.8.r1792578870.gbefebc64d5-1 after the ISO's 0.1.8.r1792577066.g8df82cc2bc-1) is not an+ # update for anyone to take.+ newer = int(subprocess.check_output(['vercmp', release(value), release(current[1])], text=True)) > 0if newer:base = json.loads(LOCK.read_text())load_runtime_updater().validate_base(manifest, base)diff --git a/os/tests/test_release_update.py b/os/tests/test_release_update.pyindex ecd7b8587..662008a86 100644--- a/os/tests/test_release_update.py+++ b/os/tests/test_release_update.py@@ -78,6 +78,22 @@ class ReleaseChannel(unittest.TestCase):with patch.object(update.subprocess, 'check_output', side_effect=['harness-os 0.1.0pre4.r3-1', '-1']):self.assertFalse(update.discover(self.url + '/metadata.json')['available'])+ def test_only_a_newer_release_is_an_update_not_a_later_build_of_the_same_one(self):+ self.assertEqual(update.release('0.1.8.r1792577066.g8df82cc2bc-1'), '0.1.8')+ self.assertEqual(update.release('0.1.9-1'), '0.1.9')+ self.assertEqual(update.release('0.1.0pre4.r3-1'), '0.1.0pre4.r3')+ self.manifest['package']['version'] = '0.1.8.r1792578870.gbefebc64d5-1'+ self.publish()+ asked = []+ def commands(args, **_):+ if args[0] == 'pacman':+ return 'harness-os 0.1.8.r1792577066.g8df82cc2bc-1\n'+ asked.append(args[1:])+ return '0\n'+ with patch.object(update.subprocess, 'check_output', side_effect=commands):+ self.assertFalse(update.discover(self.url + '/metadata.json')['available'])+ self.assertEqual(asked, [['0.1.8', '0.1.8']])+def test_existing_feed_discovers_an_official_release_without_reconfiguring_the_client(self):self.manifest['requires_os_version'] = '0.1.0'self.manifest['upgrades_from'] = [self.base]