Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4d5dbc6
docs: fix pack v2 format - the contract for Diagnose rules
I4cTime Nov 17, 2026
03dcc89
docs: fix pack - bound the cost of a log expression
I4cTime Nov 17, 2026
1430b6a
docs: fix pack - log_also, for lines that only mean trouble together
I4cTime Nov 17, 2026
673c7d2
feat(core): system checks and the snapshot store behind Undo
I4cTime Nov 17, 2026
ba1fd0c
Merge piece 2: system checks and snapshots
I4cTime Nov 17, 2026
558a0ae
docs: fix pack - write down the loader's strictness
I4cTime Nov 17, 2026
19577b4
docs: fix pack - literal run and empty-when wording match the loader
I4cTime Nov 17, 2026
4f0a54b
feat(core): fix pack v2 loader and validator
I4cTime Nov 17, 2026
4f89e5e
Merge piece 1: fix pack loader
I4cTime Nov 17, 2026
dfd68f0
fix(core): Steam's real names for its own Proton builds
I4cTime Nov 17, 2026
af623eb
test: system checks pass on Python 3.11 and 3.12
I4cTime Nov 17, 2026
533b13f
feat(core): the Diagnose engine
I4cTime Nov 17, 2026
d57fc82
Merge piece 3: Diagnose engine
I4cTime Nov 17, 2026
b25bf86
feat(core): the first fix pack - 26 rules, each checked against its s…
I4cTime Nov 17, 2026
8127f9d
Merge piece 5: the first fix pack
I4cTime Nov 17, 2026
fe7f49c
docs: fix pack - log_none, so one failure gives one finding
I4cTime Nov 17, 2026
43fe59e
feat(core): fix pack log_none, and two warnings stop overclaiming
I4cTime Nov 17, 2026
8f9c8f7
Merge: fix pack log_none
I4cTime Nov 17, 2026
24af389
feat: Diagnose - one list of what is wrong with a game, with fixes yo…
I4cTime Nov 17, 2026
f1d641e
Merge piece 4: Diagnose controller and dialog
I4cTime Nov 17, 2026
cd235a8
fix: Diagnose wording - old build names, a shorter log row, evidence …
I4cTime Nov 17, 2026
37c3e31
fix: a Proton build name Steam never had is not called "gone"
I4cTime Nov 17, 2026
d67d16e
docs: Diagnose in the changelog, README, architecture and store descr…
I4cTime Nov 17, 2026
809b615
docs: CLAUDE.md - the fix pack limits and the snapshot id are securit…
I4cTime Nov 17, 2026
56d2145
Merge remote-tracking branch 'origin/main' into feat/diagnose
I4cTime Nov 17, 2026
e6893f7
docs: fix pack - three limits the code review showed were too loose o…
I4cTime Nov 17, 2026
91ceb64
fix: Diagnose - the ten findings from the code review of #93
I4cTime Nov 17, 2026
135b576
Merge: code review fixes
I4cTime Nov 17, 2026
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
61 changes: 55 additions & 6 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,21 @@ Roughly one module per integration or feature:
- **Config editors**: `gamescope.py` (command building), `mangohud.py`,
`scopebuddy.py`, `env_vars.py`, `vdf_config.py` (Steam launch options),
`launch_merge.py` (places a snippet around `%command%` instead of
appending it).
appending it, plus the single edits a Diagnose fix makes: set or unset a
variable, add a game argument, remove a wrapper word).
- **System**: `display.py` (xrandr/wlr-randr/kscreen-doctor), `gpu.py`
(nvidia-smi/sysfs + power profiles), `input_devices.py` (gamepad detection,
SDL mapping, force-feedback rumble via raw `ioctl`/`struct` packing),
`host.py` (host command execution, see "Flatpak sandboxing" below).
- **Game maintenance**: `shader_cache.py`, `saves.py` (backup/restore),
`prefix.py`, `protontricks.py`, `fixes.py` (known-fixes DB, backed by
`core/data/known_fixes.json`), `launch_presets.py`, `profiles_storage.py`,
`compat_tool.py`, `launch_check.py` (why a game won't start; pure, fed by
its controller), `proton_log.py` (tail of `steam-<appid>.log`).
`prefix.py`, `protontricks.py`, `fixes.py` (the user's own fixes),
`launch_presets.py`, `profiles_storage.py`, `compat_tool.py`,
`proton_log.py` (tail of `steam-<appid>.log`).
- **Diagnose**: `diagnose.py` (one ranked list of findings; `collect` reads,
the rest is pure), fed by `launch_check.py`, `proton_log.py`, `fix_pack.py`
(the bundled `core/data/fix_pack.json` plus the user's fixes) and
`system_checks.py`; `fix_apply.py` plans, applies and undoes a fix, with
`snapshots.py` keeping what Undo needs.
- **The app itself**: `appearance.py` (styles, mode, accent), `sounds.py`
(sound sets and stored settings), `updates.py` (manual update check).
- **Shared low-level helpers**: `fsutil.py` (atomic writes, dir sizing),
Expand Down Expand Up @@ -97,6 +102,47 @@ example):
exception-routing behavior is covered by a plain pytest test with no Qt
runtime involved.

### Diagnose flow

`DiagnoseController` follows the same pattern, with the reading and the
writing kept apart:

1. **Collect on a worker.** `run` starts `diagnose.collect`, which reads
Steam's config, the Proton log tail, the system checks (host commands go
through `host_run`), the bundled fix pack and the user's fixes, and passes
a `Facts` to the pure `diagnose()`, which ranks the findings. Each run
carries a token; a result from an older run or another game is dropped.
2. **Plan, pure.** "Fix this" calls `fix_apply.plan(actions, state, user=...)`
on the GUI thread (`user` for the user's own fixes, which may set any
variable, single-quoted; everything else is held to the pack's limits).
It reads nothing and returns the before and after `GameState`
(launch options and compatibility tool), which the dialog shows.
3. **Snapshot, then write.** Apply plans again on a worker and calls
`apply_change`, which re-reads Steam's files and refuses if they no longer
match the plan's `before`, records a snapshot
(`~/.config/protonshift/snapshots/<appid>.json`, last 20 per game) and
writes nothing if that fails, then writes `localconfig.vdf` and
`config.vdf`, putting the first back if the second write fails. The
snapshot is dropped after a failed write only when the files read back as
`before`; otherwise it stays for Undo.
4. **Undo.** `undo_latest` writes the latest snapshot's `before` back and
drops it once the files read back as `before`. If a setting is neither
that snapshot's `before` nor its `after`, someone changed it since, and it
refuses unless forced. Snapshots are on disk, so Undo survives a restart.

After a write, `settingsWritten` makes `app.py` refresh the launch options
editor (its text only when the launch options on disk changed or nothing is
unsaved) and the diagnosis runs again. Non-Steam shortcuts get findings but no
apply: there is no writer for the binary `shortcuts.vdf`.

The fix pack (`core/data/fix_pack.json`) is data, not code. Its actions are
a closed set (set or unset one variable, add one game argument, remove one
wrapper word, use Steam's default Proton, or an instruction for the user),
so no rule can put free text into launch options, which Steam hands to a
shell. The format, the loader's limits and how to add a rule are in
[docs/fix-pack.md](docs/fix-pack.md); `tests/test_fix_pack.py` enforces them
for the bundled pack.

## `qml/` - pages and design system

`qml/App/` is a local QML module (see `qmldir`) providing:
Expand Down Expand Up @@ -159,7 +205,10 @@ runtime:

- `test_core_safety.py` - path-traversal, command-injection, tolerant-decoding,
and fail-closed-write regressions across `shader_cache`, `scopebuddy`,
`heroic_config`, `saves`, `vdf_config`.
`heroic_config`, `saves`, `vdf_config`, and the fix pack's action limits.
- `test_fix_pack.py` and `test_fix_pack_rules.py` - the pack loader against
[docs/fix-pack.md](docs/fix-pack.md), and a real sample line for every log
rule plus lines from healthy runs that no rule may match.
- `test_input_devices_structs.py` - pins the 64-bit kernel force-feedback ABI
(`struct ff_effect` layout, `input_event` size) that `input_devices.py`
packs by hand.
Expand Down
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- **Diagnose** (Library, Per-game tools). One list of what is wrong with a
game, ranked as "Stops the game from starting", "Probably the cause",
"Worth trying", "For context" and "Checked and fine". It looks at the
game's launch options, its Proton build, its install folder, the end of its
Proton log, this PC (a working Vulkan driver, a 32-bit Vulkan driver, free
space on the drives holding the game and its prefix) and a pack of 26 rules
that ships with the app: 18 recognise a line in the Proton log, 6 look at
launch options, and 2 are tweaks for one game. Each finding shows the log
line or the setting it is based on, and a rule from the pack links to where
its knowledge comes from. A check that could not run says so instead of
reporting the PC as fine. With no Proton log, Diagnose offers to turn
logging on. It reads files and settings only and never starts the game.
- **Fix this, and Undo.** "Fix this" shows the launch options and Proton
build before and after, then applies the change in one click. A snapshot is
saved first, and if that fails nothing is written. Undo puts back the last
fix, also after restarting the app, and asks before overwriting changes
made since. Diagnose warns when Steam is running, because Steam rewrites
its settings when it closes and a fix applied now can be lost, and when the
launch options editor has unsaved changes.
- Diagnose works for Steam games and Non-Steam shortcuts. For a shortcut it
shows the findings and a "Copy new launch options" button but cannot apply
a fix, because ProtonShift cannot write Steam's shortcuts file. Heroic and
Lutris games are not covered yet, and the rule pack does not update by
itself yet; new rules arrive with app updates.

### Changed
- The game pane's "Launch check" and "Known fixes…" buttons are replaced by
the one "Diagnose" button. Every check Launch check made is now a finding in
Diagnose. "Proton log…" stays, and Diagnose has an "Open log" button.
- Your own fixes under `~/.config/protonshift/fixes/` still load. They show
in Diagnose under "Worth trying", marked "yours".

### Removed
- **The 14 built-in known fixes**, because on checking, none was both
sourced and still correct: several had no source, some used variable
names Proton does not document or no longer reads, two put a game argument
in front of `%command%`, and one turned on BattlEye for a game that does
not use it. Cyberpunk 2077 and Elden Ring get a sourced tweak in the new
rule pack instead.
- The five switches the old Known fixes dialog listed for every game
(disable esync, disable fsync, Proton log, WineD3D, NVAPI), because they
are not fixes for anything Diagnose can detect. Proton logging is still a
launch-option preset, and Diagnose offers it when there is no log.

### Fixed
- **The Proton version picker used names Steam does not know.** It offered
Valve's builds as `proton_9_0`, `proton_8_0` and `proton_7_0`, but Steam
calls them `proton_9`, `proton_8` and `proton_7`. Choosing one wrote a
build Steam did not recognise, and Launch check called a game on a real
Valve build "gone". The picker now lists Steam's own names, including
Proton 10, Proton 11 and Proton Hotfix. A game still set to an old name
gets a finding in Diagnose with a one-click fix back to Steam's default.

## [1.3.2] - 2026-10-13

### Fixed
Expand Down
19 changes: 17 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,23 @@ is conventions and constraints only.
unvalidated key would be persistent command injection into that shell.
`write_scb_conf` raises before writing a byte if any key fails this
check. Keep it that way.
- If you touch either regex, add/update the corresponding case in
`tests/test_core_safety.py` in the same change.
- `core/fix_pack.py`'s action limits (`_KEY_RE`, `_ENV_VALUE_RE`,
`_GAME_ARG_RE`, `_WORD_RE`, the forbidden-variable list) are load-bearing:
Diagnose writes a rule's actions into Steam launch options, and Steam hands
those to a shell at every launch, so a looser pattern is command injection
by data file. A pack may only set variables from a short list of name
families; the user's own fixes may set any variable, and `core/fix_apply`
writes their values single-quoted and refuses what quoting cannot make
safe. `docs/fix-pack.md` is the contract for the format; change it first,
in its own commit, then the code.
- `core/snapshots.py`'s `app_id` check (decimal digits only, plus
`validate_within`) is the same kind of boundary as the shader cache's: the
id becomes a file name. Entries holding a newline or NUL are dropped on
read as well as refused on write, because Undo writes them into Steam's
config.
- If you touch any of these, add/update the corresponding case in
`tests/test_core_safety.py` (`tests/test_snapshots.py` for the snapshot
store) in the same change.

## Conventions

Expand Down
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ locally from the manifest; full variants and options are in

## Features

### Diagnose

One button per game that lists what is wrong with it, most serious first:
"Stops the game from starting", "Probably the cause", "Worth trying", "For
context" and "Checked and fine". It looks at the game's launch options,
Proton build and install folder, the end of its Proton log, this PC (Vulkan,
a 32-bit Vulkan driver, free disk space) and a bundled pack of 26 rules, each
linked to where its knowledge comes from. Every finding shows the log line or
setting behind it. "Fix this" shows the launch options and Proton build
before and after, saves a snapshot, then applies the change; Undo puts it
back, also after a restart. Diagnose reads files and settings only and never
starts the game. It covers Steam games and Non-Steam shortcuts; for a
shortcut it copies the new launch options instead of writing them. The rule
format is in [docs/fix-pack.md](docs/fix-pack.md).

### Your entire library, unified

Pulls games from **Steam** (including Non-Steam shortcuts you added by hand),
Expand All @@ -83,14 +98,6 @@ if the underlying tool isn't found. Snippets are placed around `%command%`
for you, so a preset never ends up as a stray game argument, and switching
games with unsaved edits asks before dropping them.

### Launch check

One button per game that lists the usual reasons it won't start, each with
what to do about it: launch options with no `%command%` (or two), wrapper
tools that aren't installed, a Proton build that was removed, a missing
anti-cheat runtime, a missing install folder, and ProtonDB's rating as
context. It reads files and settings only; it never starts the game.

### Proton log viewer

Turn on Proton's debug log for a game and read it in the app: the end of
Expand Down Expand Up @@ -174,21 +181,16 @@ a different one. Export all profiles (or one) to a JSON bundle and import it
on another machine; imports are validated entry by entry and never overwrite
an existing profile unless you ask.

### Game-specific fixes database

A built-in, extensible database of known fixes (environment variables and/or
launch arguments) matched per App ID or applied universally, with one-click
apply. User-contributed fixes live under `~/.config/protonshift/fixes/`.

### Protontricks

Run Protontricks without leaving the app - open its GUI for a game, or
quick-run common verbs. Supports native and Flatpak Protontricks installs.

### System info & display management

GPU detection (NVIDIA via `nvidia-smi`, AMD/Intel via sysfs) with live temps,
power-profile switching (`system76-power`, `power-profiles-daemon`), and
GPU detection, read when the app starts and on Refresh (NVIDIA via
`nvidia-smi` with name, driver, VRAM and temperature; AMD/Intel via sysfs
with the kernel driver and temperature), power-profile switching (`system76-power`, `power-profiles-daemon`), and
per-monitor resolution/refresh-rate control over `xrandr`, `hyprctl`,
`wlr-randr`, or `kscreen-doctor`, depending on your session. A mode change
asks "keep it?" and goes back on its own after 15 seconds if you don't.
Expand Down
Loading
Loading