Repository navigation
Encode transcode clipboard file URIs - #13360
HerrStolzier wants to merge 2 commits into
Conversation
Resolve output paths and percent-encode them before passing text/uri-list to wl-copy, so reserved characters and literal percent escapes keep their filesystem meaning. Add regression coverage for image and video paths, UTF-8 and control characters, relative symlinks, Python import isolation, and failure paths.
Automated AI review
Verified: the URI fix is correct, and the new test catches the bug it targets. No issue was found in the production change within the tested scope. One point concerns coordination with open PR #12135: once both are merged, the new test no longer passes. Verified by running the real base and head scripts (encoders, notifications and
Head was not worse than base for any tested name in any tested consumer. Verified, also:
New test fails when combined with #12135The #13360 diff applies cleanly on top of #12135 (quality tiers), and #12135 does not touch With only that match relaxed, the file stops at the first video case: #12135 prompts for quality when no fourth argument is given, and this test has no Impact: whichever of the two PRs lands second leaves Suggested change: match the Note: Optional test improvement: Review informationTest scope: PR test, mutations and payload parsing ran in an isolated command sandbox with Python 3.14.7, GLib 2.88.3 and Qt 6.11.2, with encoders, notifications and the clipboard stubbed. GTK 4.22.4's AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
Address llstrk's review on omacom#13360. Match the completion message prefix in both positive and negative checks, answer only the optional quality prompt in a stub, and reject unexpected menu requests. Stub ffprobe so dummy media stays on the estimate fallback path. Report named failures for unsuccessful transcodes and verify the injected failure statuses, so an unrelated early menu error cannot satisfy a negative test. The 15 cases pass on the current command and a focused overlay of the transcode command from omacom#12135 at b9535ec, including open stdin and PTY runs. Fifteen mutation/error-injection checks are detected. Full test/all runs before and after retain identical failing and skipped file sets (31 failing and 23 with skips out of 263 shell test files), plus the unchanged VS Code CLI assertion. No production code is changed.
|
Thanks @llstrk — I reproduced both failures and addressed the test feedback in 40a1500. The test now matches the completion-message prefix in both positive and negative checks, answers only the optional quality prompt with a Verification: 15/15 cases pass with the current command and with the exact transcode command from #12135 at
|
Automated AI review
Outcome: No defects found at 40a1500; both test points from the earlier review are resolved. Earlier points, rechecked at 40a1500 (production code is unchanged since that review):
Verified
Reproducer: combination with #12135 (current and earlier test)Build the combination (#12135's current head 0886701 plus this PR's changes) in a fresh clone: git clone https://github.com/omacom/omarchy && cd omarchy
git fetch origin pull/12135/head pull/13360/head
git switch --detach 0886701bed5a349e6aad2d21dceea61cc06fb6ae
git diff e1614f2bdb94f7df11eda072644b31e1e118f1ba 40a15001a1ffcefc9b751972438dcfa271b05f55 | git applyCurrent test (40a1500): bash test/shell.d/transcode-clipboard-test.sh; echo "exit $?"Earlier test (f995c1c), same tree: git show f995c1cf3481154ca1a9877e9302cb353138df56:test/shell.d/transcode-clipboard-test.sh > test/shell.d/transcode-clipboard-test.sh
bash test/shell.d/transcode-clipboard-test.sh; echo "exit $?"Negative checks, same combined tree with the current test restored ( python3 - <<'PY'
from pathlib import Path
p = Path('bin/omarchy-transcode')
lines = p.read_text().splitlines(keepends=True)
i = lines.index(' transcode_picture "$input" "$format" "$resolution" "$output"\n')
assert lines[i + 1] == ' copy_to_clipboard "$output"\n'
lines.insert(i + 3, lines.pop(i + 1)) # copy now runs after the success notification
p.write_text(''.join(lines))
PYCurrent test: 13 (exit 1). With only the three negative checks changed back to the earlier Environment of the recorded run: bash 5.3.15, Python 3.14.7, GNU grep 3.12, in an isolated command sandbox with a tripwire stub for every menu, clipboard, notification and encoder command (none was called). The recorded run used a tree equivalent to the commands above (tree hash checked against 0886701). Review informationTest scope: Sandbox tests only at 40a1500, with menus, clipboard, notifications and encoders stubbed; combinations are each related PR's head plus this diff; AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
|
Reviewed at 40a1500 against Reproduction. On the worker I ran the real command end to end: ImageMagick made the encode, Tests. Scope. The production change is one line and proportionate. The test is broader than the fix needs. The encoder-failure and clipboard-failure cases cover behaviour this PR doesn't change, and the quality-prompt and Second opinion. Codex Medium reviewed the same diff. It found no defect in the fix and agreed the bug is real and Next. This is waiting on the maintainer. It isn't marked ready yet because the suite on |
Problem
omarchy transcodebuilds its clipboard URI by concatenatingfile://with an unescaped output path. The encode succeeds, but URI consumers can resolve that text to a different file:#becomes a fragment,?becomes a query, and a literal%20in a filename becomes a space.I reproduced this with actual ImageMagick/FFmpeg conversions and GIO's
g_file_new_for_uri()/g_file_get_path(), while substituting only clipboard delivery and notifications. For example, the generatedshot#1-low.jpgwas interpreted asshot, andshot%20-low.pngasshot -low.png.Change
Use Python's standard-library
Path.resolve().as_uri()when buildingtext/uri-list. This retains absolute/symlink resolution and percent-encodes the path. The Python invocation uses-Iso it does not import apathlib.pyfrom the current directory.The only production change is in
copy_to_clipboard(). Encoder arguments, output naming, menus, and clipboard MIME type are unchanged. No migration is needed.Verification
Base:
e1614f2bdb94f7df11eda072644b31e1e118f1ba. The complete uploaded Git archive reconstructed tree1dbe5d3de4f8e7b712290332f59518ddb88cda37, matching that source tree. Tests ran unprivileged in an isolated, headless Debian 13 environment, with private HOME/tmp, read-only source/system directories, and no network or desktop-session sockets.bash test/shell.d/transcode-clipboard-test.sh: 15 success records, exit 0. Covers plain paths, reserved characters, literal percent escapes, spaces, UTF-8, newline/tab, apostrophes, parent directories, relative/symlink paths, Python module shadowing, PNG/JPG/MP4/GIF outputs, and encoder/URI/clipboard failure paths. This uses the real command and substitutes media/clipboard/notification boundaries.#, and with the system Python interpreter.pathlibas the oracle..resolve(), undoing%25escaping, and removing-I. The import-isolation mutation was checked with Debian's system Python; the sandbox's virtualenv pre-importspathlib, so it masks that particular mutation.bash -n,git diff --check, andbin-style-test.shpass../test/allcompleted on both the untouched and changed trees. Both return 1: the CLI suite stops at the same existing VS Code theme assertion; 31 shell test files fail in both runs (262 files before, 263 after). The failing-file set, all 25 emittednot oklines, and the 23-file skip set are identical. The new transcode suite passes in the full run. No unrelated tests were changed or suppressed.Full-suite failures present on both trees in this environment
Several require unavailable tools (for example Lua, updatedb, or mise), companion repositories, or capabilities unavailable in this headless environment; others are existing failing assertions. This is a baseline comparison, not a claim that every failure is environmental or that the full suite is green.
Scope and related work
No live Wayland clipboard delivery or graphical paste test was performed. The byte payload and actual GIO path interpretation were tested instead. No real package transactions, boot changes, or desktop configuration changes were performed.
I checked the current
omarchy-transcodeversions in #12135 and #6698: both still concatenate an unescaped URI. They modify the same file for different features; this change is limited to clipboard URI construction and its regression coverage.Developed and tested with AI assistance (ChatGPT).