Repository navigation
Fix shell tests that read the developer's session, and add testing rules for agents - #16229
Conversation
[Low impact] The PR appears safe to merge, with the existing non-blocking scratchpad issue still open. Findings
SummaryThe PR keeps shell-test logs and reduces interference from the developer’s desktop session.
Since the previous review, only the test-writing guidance in Reviews (2) · Last reviewed commit: "Tell agents when a test is worth adding" · Reviewed by Greptile |
| workspace=$(hyprctl -j monitors | jq '.[0].activeWorkspace.id') | ||
| if (( $(hyprctl -j clients | jq --argjson ws "$workspace" '[.[] | select(.workspace.id == $ws)] | length') == 0 )); then |
There was a problem hiding this comment.
Open scratchpad escapes background check
When the first monitor's regular workspace is empty but special:scratchpad is open, this filter counts zero windows because the scratchpad has a different workspace ID. Both background tests then run against covered or dimmed pixels and can report false failures. Also check the monitor's specialWorkspace before allowing these tests to run.
./test/shellhad 10 failing files on a working desktop, and none of the failures came from code. Agents would run the suite, see red, rerun to find out why, and rerun again to check that the failures weren't theirs. Each failure turned out to be a test reading the developer's real session:HOMEat a scratch directory, but a desktop session exportsXDG_CONFIG_HOME,XDG_CACHE_HOME,XDG_DATA_HOMEandXDG_STATE_HOMEto the real home. The Elsewhen migration test ranrm -rfon the real~/.cache/omacom-elsewhen, andprovision-useranddefault-appsread and wrote the real config.base-test.shnow unsets all four.OMARCHY_STARTUP_CURSOR_THEME=defaultbeat the GSettings theme the test expects. The fake environment now owns every cursor variable.grim -g "0,0 1x1"to raise a screencast event. With outputs placed away from the origin, nothing is at 0,0, so grim failed and no event came. It now captures a pixel at the first output's origin.background-instant-reloadandbackground-intro-clonesample the background layer off the first output, and on a working desktop they sample whatever window covers it. CI never runs them because they need a compositor. A newrequire_uncovered_backgroundskips them, saying why, unless that output's workspace is empty.I18N_STRUCTURAL=1, so the strict default only ran locally, where it fails whenever translations are waiting on the sync workflow. That is the normal state, 32 menu entries in 49 languages right now. The structural check is now the default, andI18N_STRICT=1asks for the strict one. The workflows still setI18N_STRUCTURAL=1, which is now unused but harmless. Changing workflow files needs a token with theworkflowscope, so removing it is left for a follow-up.To stop the reruns:
Logs are kept:
./test/shellnow leaves every file's log in a freshomarchy-test-shell.*directory under$TMPDIR. It prints that directory at the end and each failed file's log next to it, so a failure can be read without running the suite again.AGENTS.mdrules: run your area's files directly, and the full suite at most once, at the end, and only for shared code. Write output to a log file instead of piping it throughgrep,headortail. Rerun only after changing something. Check a failure in an untouched file once against the base branch, then report it. A live-session test that fails in a full run and passes alone is session noise.When to add a test:
AGENTS.mdnow says a test must catch a regression nothing else would and must fail without the change. Small declarative changes (a menu row, a config value, a string) get no test file of their own. It rules out tests that restate the implementation, test their own stubs or detect unrelated changes, and asks for tests in proportion to the change. This is the author's side of the review skill's test-bloat rubric.docs/testing.mdanddocs/i18n.mddescribe the kept logs, the XDG reset, the background gate and the i18n modes.Verified on this desktop, with windows open and outputs placed away from 0,0. Each previously failing file was run once with its log kept, and then one full
./test/shellrun: 471 files completed without failures, 15 with skipped checks. The two background tests are among the 15. The cursor test also passes with the session's cursor variables unset.🤖 Generated by Opus 5.5 in Claude Code.