Skip to content

Commit d1a19c7

Browse files
authored
fix(homebrew): overwrite generated gateway config during migration (ai-openshell#3752)
Closes ai-openshell#3746 Use Homebrew atomic_write for exact legacy config migrations and keep the first-install write distinct in the formula test. Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent f37d89b commit d1a19c7

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎architecture/build.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ The Homebrew service keeps gateway TLS under the Homebrew state directory but
226226
mirrors Docker sandbox client TLS into `$HOME/.local/state/openshell/homebrew/tls`
227227
at service start, because Docker Desktop bind mounts must use paths visible to
228228
the macOS user's shared home directory.
229+
On upgrade, the formula atomically replaces only exact package-generated
230+
schema-v1 gateway configs, leaving user-edited configs untouched.
229231

230232
Local image work should use `mise` tasks rather than direct Docker commands so
231233
the same staging and tagging assumptions are used locally and in CI.

‎python/openshell/release_formula_test.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def test_generate_homebrew_formula_uses_channel_urls_and_exact_version(
100100
assert 'bind_address = "[::1]:17670"' in legacy_ipv6_config.group("contents")
101101
assert "gateway_config.read == legacy_empty_gateway_config_contents ||" in formula
102102
assert "gateway_config.read == legacy_ipv6_gateway_config_contents" in formula
103-
assert "gateway_config.write gateway_config_contents" in formula
103+
assert formula.count("gateway_config.write gateway_config_contents") == 1
104+
assert "gateway_config.atomic_write gateway_config_contents" in formula
104105
assert '# compute_driver = "vm"' not in formula
105106
assert (
106107
"openshell gateway add https://localhost:17670 --local --name openshell"

‎tasks/scripts/release.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def post_install
448448
# Keep any user-edited config untouched.
449449
if gateway_config.read == legacy_empty_gateway_config_contents ||
450450
gateway_config.read == legacy_ipv6_gateway_config_contents
451-
gateway_config.write gateway_config_contents
451+
gateway_config.atomic_write gateway_config_contents
452452
end
453453
end
454454

0 commit comments

Comments
 (0)