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
3 changes: 2 additions & 1 deletion migrations/1786643346.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ if changed:
PY
)

profile_roots=(
# A rerun that needs only some of these roots sets profile_roots before sourcing.
[[ -v profile_roots ]] || profile_roots=(
"$HOME/.config/chromium"
"$HOME/.config/google-chrome"
"$HOME/.config/google-chrome-beta"
Expand Down
15 changes: 15 additions & 0 deletions migrations/1792474908.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
echo "Repair the Copy URL shortcut for Brave Origin profiles"

# The repair in 1786643346 walked every Chromium-family profile root except
# Brave Origin's, which Omarchy has installed since before the extension id
# was pinned. Those profiles still bind Alt+Shift+L to a ghost id.
#
# Rerun it on Brave Origin's roots alone: every profile it already repaired
# kept a backup it reads as a repair still to verify, and would ask for that
# browser to be closed again.
profile_roots=(
"$HOME/.config/BraveSoftware/Brave-Origin"
"$HOME/.config/BraveSoftware/Brave-Origin-Beta"
"$HOME/.config/BraveSoftware/Brave-Origin-Nightly"
)
source "$OMARCHY_PATH/migrations/1786643346.sh"
43 changes: 43 additions & 0 deletions test/shell.d/copy-url-shortcut-migration-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"

require_command jq
require_command python3

test_dir=$(mktemp -d)
trap 'rm -rf "$test_dir"' EXIT

home="$test_dir/home"
stub_bin="$test_dir/bin"
mkdir -p "$stub_bin"
# Any browser prompt fails the run, so a pass also proves nobody was asked.
printf '#!/bin/bash\nexit 1\n' >"$stub_bin/gum"
chmod +x "$stub_bin/gum"

ghost_id="ikkebdkaanlebnifjnbeiaklodhbjcci"
pinned_id="bgpiichlckmfanooecilcjemknkcpngb"

run_rerun() {
HOME="$home" PATH="$stub_bin:$PATH" OMARCHY_PATH="$ROOT" bash -euo pipefail "$ROOT/migrations/1792474908.sh" >/dev/null 2>&1
}

# The first repair skipped Brave Origin, so its ghost binding is still there.
brave_origin="$home/.config/BraveSoftware/Brave-Origin/Default/Preferences"
mkdir -p "$(dirname "$brave_origin")"
jq -n --arg ghost "$ghost_id" '{extensions: {commands: {"linux:Alt+Shift+L": {command_name: "copy-url", extension: $ghost}}, settings: {}}}' >"$brave_origin"

# A profile the first repair fixed keeps its backup, which that repair reads as
# still to verify; with the browser open the rerun must not ask again.
chromium="$home/.config/chromium/Default/Preferences"
mkdir -p "$(dirname "$chromium")"
jq -n --arg pinned "$pinned_id" '{extensions: {commands: {"linux:Alt+Shift+L": {command_name: "copy-url", extension: $pinned}}, settings: {}}}' >"$chromium"
cp "$chromium" "$chromium.omarchy-copy-url-repair.bak"
ln -sfn "test-host-1234" "$home/.config/chromium/SingletonLock"

run_rerun || fail "Brave Origin rerun completes without prompting for profiles the first repair fixed"
jq -e --arg pinned "$pinned_id" '.extensions.commands["linux:Alt+Shift+L"].extension == $pinned' "$brave_origin" >/dev/null ||
fail "Brave Origin rerun rebinds the Copy URL shortcut to the pinned id"
pass "Brave Origin rerun repairs Brave Origin and leaves already-repaired profiles alone"
Comment on lines +40 to +43

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Repeated repairs go unchecked

The shortened test runs the new migration only once against a stale Brave Origin shortcut. It no longer checks a second run or an existing user-chosen shortcut, as docs/testing.md asks for migrations still being written. Add those cases for the Brave Origin rerun so changes that rewrite repaired profiles or replace custom bindings do not pass unnoticed.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Loading