From ac0cbe5135cca88ab1d6fbaa795e8e9117a17209 Mon Sep 17 00:00:00 2001 From: RetroGameDeveloper <40120498+RetroGameDeveloper@users.noreply.github.com> Date: Sun, 8 Nov 2026 15:52:12 +0000 Subject: [PATCH 1/2] fix: isolate fork projects from upstream data by default --- CONTRIBUTING.md | 10 ++++----- README.md | 33 ++++++++++++++-------------- ROADMAP.md | 4 ++++ docs/CONVENTIONS.md | 11 ++++++---- site/public/index.html | 5 +++-- site/public/install.sh | 2 +- src/decompnet/app/cli.py | 2 +- src/decompnet/app/edition.py | 17 +++++++++----- src/decompnet/app/routes/__init__.py | 2 +- src/decompnet/app/source_runtime.py | 2 +- src/decompnet/app/static/js/pages.js | 4 ++-- tests/test_edition.py | 26 ++++++++++++++++++++-- tests/test_source_runtime.py | 21 ++++++++++++++++++ 13 files changed, 97 insertions(+), 42 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dc1d39227..649ccd9c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ executables, and no code, assembly or assets taken from them. That includes the the game, and it belongs to you and the game's owner, not to this repository. Sam's request from decomp.wtf still stands: only use decompdecomp on games you own, and respect the rules of the decomp projects you work with. -Before you attach a log (`~/Decomp/.decomp/logs/decomp.log`), read it, and cut out any code or assembly. +Before you attach a log (`~/Decomp-RetroReversing/.decomp/logs/decomp.log`), read it, and cut out any code or assembly. ## Reporting a bug @@ -26,14 +26,14 @@ decompdecomp is Python 3.12+, managed with [uv](https://docs.astral.sh/uv/). ```bash git clone https://github.com/n-delic/decompdecomp && cd decompdecomp uv sync -uv run decomp # the development copy, in its own window (projects in ~/Decomp-dev, or $DECOMP_HOME) +uv run decomp # the development copy, in its own window (projects in ~/Decomp-RetroReversing-dev, or $DECOMP_HOME) uv run pytest -q # the tests uv run pytest tests/test_ps2.py -q # one file uv run ruff check src tests projects # the linter ``` -A checkout is a separate app, "decompdecomp dev": its own folder (`~/Decomp-dev`), port and window. It never -replaces the decompdecomp you have installed, and never touches its projects in `~/Decomp`. For an experiment, give +A checkout is a separate app, "decompdecomp dev": its own folder (`~/Decomp-RetroReversing-dev`), port and window. It never +replaces the decompdecomp you have installed, and never touches its projects in `~/Decomp-RetroReversing`. For an experiment, give it a scratch folder: `DECOMP_HOME=/some/scratch/folder DECOMP_TRAY=0 uv run decomp`. The tests already use a folder of their own. @@ -61,7 +61,7 @@ Some things we won't merge: the pinned ones. - Letting agents edit a project's build setup. They're limited to source and header files on purpose. - Links to the decomp.wtf website. That domain isn't ours. Keep the internal names (`decomp`, `decompnet`, - `~/Decomp`, `.decomp.wtf.json`): existing installs depend on them. + `.decomp.wtf.json`): existing installs depend on them. Not sure what to work on? [ROADMAP.md](ROADMAP.md) lists what's planned and why, and has a table of which feature works on which platform: every — in it is a gap to fill. diff --git a/README.md b/README.md index f00fce0b7..962853b70 100644 --- a/README.md +++ b/README.md @@ -608,7 +608,7 @@ Changing or clearing the trusted remote address revokes browser sessions. Disabl browser access even if the Tailscale proxy remains configured. Use `tailscale serve --https=443 off` to stop that proxy. Remote addresses must be set from the native app; remote browsers cannot authorize a new destination. -`serve` uses the usual home (`~/Decomp` for an installed copy; `~/Decomp-dev` from a checkout). If an app is already +`serve` uses the usual home (`~/Decomp-RetroReversing` for an installed copy; `~/Decomp-RetroReversing-dev` from a checkout). If an app is already running for that home, it refuses to replace it. Stop that app deliberately with `decomp stop`, or choose another home and port, for example `DECOMP_HOME=/path/to/server-projects decomp serve --port 6484`. A checkout can use `uv run decomp serve --port 6474`. Stop the server with Ctrl-C or `decomp stop` using the same home. Updates preserve @@ -654,7 +654,7 @@ decomp ``` The app opens in a native Windows window. Its shortcuts appear on the desktop and in Start, and its tray icon -brings back a window closed while helpers work. Free tools use Windows builds where available. Projects stay in your Windows `Decomp` folder. +brings back a window closed while helpers work. Free tools use Windows builds where available. Projects stay in your Windows `Decomp-RetroReversing` folder. > [!IMPORTANT] > **PS1, PS2 and most N64 games need WSL 2 on Windows.** Their period compilers (GCC for PlayStation, EE-GCC and @@ -685,7 +685,7 @@ bash site/public/install.sh ``` The installer uses uv and Python 3.12, installs the Cocoa/WebKit bridge, gets the free tools, and creates -`~/Applications/decompdecomp.app`. Open it from Finder or run `decomp`. Projects stay in `~/Decomp`; +`~/Applications/decompdecomp.app`. Open it from Finder or run `decomp`. Projects stay in `~/Decomp-RetroReversing`; toolchains live in `~/Library/Application Support/decompnet/toolchains`. Xcode Command Line Tools (`xcode-select --install`) are needed on Intel Macs for N64's MIPS binutils, and on both Mac architectures to build PS1 GCC 2.6.0, 2.6.3 and 2.8.0 from pinned source on first use. The ready-made 2.7.2 (PSX and CDK) and 2.8.1 compiler binaries are for @@ -726,11 +726,11 @@ When launched from a terminal, quitting reports each shutdown stage and the proj Stages taking more than five seconds print elapsed-time updates. Closing just the window while keeping work running is reported explicitly; it does not mean the app has quit. -For development: `uv sync`, `uv run decomp` (separate `~/Decomp-dev` state), and `uv run pytest -q`. +For development: `uv sync`, `uv run decomp` (separate `~/Decomp-RetroReversing-dev` state), and `uv run pytest -q`. To avoid rebuilding a packaged app for each code update, open Settings → Run from Git / update when idle. Choose a clean `main` checkout from the configured update repository (Git and uv required). -Choose separate `~/Decomp-dev` data, or explicitly keep this app's current projects/settings. This +Choose separate `~/Decomp-RetroReversing-dev` data, or explicitly keep this app's current projects/settings. This replaces the current process when keeping current data. Separate development data launches another app and leaves this one running. Neither copies/migrates data nor alters the installed app bundle. New managed agent sessions and jobs are held until existing work finishes. Continuous background @@ -894,18 +894,17 @@ and reports when a size or depth limit means you should scan a smaller folder. When you close the window while agents work, decompdecomp asks you: stop them and quit, or keep them working. **Quit** ends the app and everything it started. -## Coming from decomp.wtf or an older version (1.0.x) +## Trying this fork alongside upstream -Your projects stay, decomp.wtf's too: decompdecomp continues decomp.wtf and reads the same folder and database. On -Linux, the new version opens the same `~/Decomp` folder, with every match, name and note in it. -The old Windows installer kept its projects inside a WSL distribution. The Windows app now runs natively and uses -`%USERPROFILE%\Decomp`; it uses WSL for some Linux-only compilers, but doesn't scan WSL for projects automatically. +The RetroReversing fork uses `~/Decomp-RetroReversing` by default on macOS and Linux, +and `%USERPROFILE%\Decomp-RetroReversing` on Windows. Source checkouts use +`~/Decomp-RetroReversing-dev`. Upstream's `~/Decomp` and `~/Decomp-dev` folders are left alone. +The fork's database format differs, so it does not automatically open or migrate upstream projects. +Start a new fork project from your own game, or use **Open a saved project** with a compatible save. -To move projects from the old Windows install, close its app, then copy the whole `Decomp` folder from -`\\wsl.localhost\decomp-wtf\home\decomp\Decomp` to `%USERPROFILE%\Decomp`. Include the hidden `.decomp` folder -inside it: that holds the project database and saved matches. The app reconnects projects to their copied folders. -Did you keep a project outside the `Decomp` folder, in `Documents` for example? Move that project's folder into -`%USERPROFILE%\Decomp` too, and keep its folder name: the app finds a moved project by its name there. +`DECOMP_HOME` still selects an explicit data folder. Existing fork users who deliberately used another +folder can keep that setting; without it, the new default starts with separate projects and settings. +Keep an upstream database separate instead of pointing both apps at the same home. Saved-project verification uses a private compiler queue (up to four workers, within the global compiler limit), reuses each worker's header staging, and publishes exact checks in order. The restore dialog shows verified/total @@ -944,7 +943,7 @@ so you can keep it in a git repository. You can edit these files or pull another `progress/`; decompdecomp reads them on the next project action and checks the saved functions again. GameCube, Wii and PC projects and community decomps are git repositories already: push them. -The simplest way is to copy your whole `~/Decomp` folder to the same place on the new computer. Copy the hidden +The simplest way is to copy your whole `~/Decomp-RetroReversing` folder to the same place on the new computer. Copy the hidden `.decomp` folder in it too: it holds the matches of every project. decompdecomp then finds every project. To take a single N64, PlayStation or PlayStation 2 project, or to keep it in git: @@ -952,7 +951,7 @@ single N64, PlayStation or PlayStation 2 project, or to keep it in git: game's code is its rights holder's: keep it to yourself. ``` -~/Decomp// +~/Decomp-RetroReversing// ├── progress/ your work: share this, commit this │ ├── src/ each matched function's C │ ├── best/ the closest attempt at each function that doesn't match yet diff --git a/ROADMAP.md b/ROADMAP.md index b2250f4e2..6169e3d82 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -868,6 +868,10 @@ similar C through objdiff. Other processors need an instruction reader for this ## Recently done +- **Separate fork data.** Installed copies default to `Decomp-RetroReversing` in the user home; + checkouts and separate source handoffs use `Decomp-RetroReversing-dev`. Explicit `DECOMP_HOME` + overrides still work. Upstream data is never selected or migrated automatically. + - **RetroReversing fork releases.** Tags and app versions use `X.Y.Z-rr.N`; Python packages use `X.Y.Z+rr.N`. Updater ordering preserves fork revision numbers across Windows, macOS and Linux. diff --git a/docs/CONVENTIONS.md b/docs/CONVENTIONS.md index ae84a3e74..3e390af08 100644 --- a/docs/CONVENTIONS.md +++ b/docs/CONVENTIONS.md @@ -57,8 +57,11 @@ the feature easy to move. ## 2. Names +This fork defaults to `~/Decomp-RetroReversing` (checkouts: `~/Decomp-RetroReversing-dev`) +to keep its database separate from upstream. Explicit `DECOMP_HOME` settings remain supported. + - The project is **decompdecomp** in everything users read. Internal names stay as decomp.wtf left them, because - existing installs depend on them: the `decomp` command, the `decompnet` package, `~/Decomp`, `.decomp.wtf.json`, + existing installs depend on them: the `decomp` command, the `decompnet` package, `.decomp.wtf.json`, `.decomp-wtf/`, the `decomp-wtf` branch. The decomp.wtf domain isn't ours: nothing points at it. - Python: `snake_case` for functions and variables, `CapWords` for classes, `UPPER_CASE` for module constants (`STALL_BUDGET`, `MAX_FLAG_VARIANTS`), a leading underscore for what's private to its module or class. The engine's @@ -203,13 +206,13 @@ try { People working on decompdecomp usually have it running too, with agents working in it. A test or an experiment must not touch it. -- A checkout is a separate app, "decompdecomp dev" (`app/edition.py`): its own home `~/Decomp-dev`, port 6474 and +- A checkout is a separate app, "decompdecomp dev" (`app/edition.py`): its own home `~/Decomp-RetroReversing-dev`, port 6474 and window class. A newer `decomp` that finds an older one running in the same home quits it and takes its place - (`app/cli.py`), so never point a checkout at your real `~/Decomp`. For an experiment, use a throwaway home: + (`app/cli.py`), so never point a checkout at your real `~/Decomp-RetroReversing`. For an experiment, use a throwaway home: `DECOMP_HOME= DECOMP_TRAY=0 uv run decomp`, with a PATH without agent CLIs. - If your app runs from the checkout's `.venv`, run the tests in another environment, so uv doesn't rebuild the one your app uses: `UV_PROJECT_ENVIRONMENT= uv run pytest -q`. -- To try a change on a real project, use a copy: `sqlite3 "file:$HOME/Decomp/.decomp/decomp.db?mode=ro" ".backup +- To try a change on a real project, use a copy: `sqlite3 "file:$HOME/Decomp-RetroReversing/.decomp/decomp.db?mode=ro" ".backup /.decomp/decomp.db"`, copy the project's folder, and point `projects.root` in the copy at it. Read a live database only with `?mode=ro`. diff --git a/site/public/index.html b/site/public/index.html index 0611aa51c..6f96de078 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -256,13 +256,14 @@

Start.

1 · Install

-

curl -fsSL https://decomp.ndelic.com/install.sh | bash

+

curl -fsSL https://raw.githubusercontent.com/RetroReversing/decompdecomp/main/site/public/install.sh | bash

Without a desktop window: run decomp serve --port 6464, open http://127.0.0.1:6464/, and use the sign-in code printed in the terminal. The same agents and compilers run on that computer; the server binds to localhost only.

Linux: run it in your terminal. It installs the app and compilers, then opens the app in its own window. There's also a .deb, an .rpm and an AppImage on the releases page.

+

Projects and settings use ~/Decomp-RetroReversing (%USERPROFILE%\Decomp-RetroReversing on Windows), separate from upstream. Existing DECOMP_HOME overrides are respected; upstream databases are not migrated automatically.

Fork releases use vX.Y.Z-rr.N and include Windows installers and macOS apps for Apple Silicon and Intel.

Windows 10 and 11: download and open decompdecomp-<version>-windows-x64-setup.exe from the latest release. The app opens in a native Windows window, with desktop and Start shortcuts and a tray icon. PS1, PS2 and most N64 games also need WSL 2 for their period compilers: run wsl --install in an administrator PowerShell, restart if asked, then open Ubuntu once. GameCube, Wii, DS and Windows PC games, and N64 games built with IDO, don't.

Frequent source updates: Settings → Run from Git can prepare main updates in a separate runtime while agents keep working. Enable automatic updates there; a restart check holds new sessions for at most 15 seconds, then releases them and retries later if active work needs longer. Agents resume with saved usage limits. No app rebuild is needed.

-

curl -fsSL https://decomp.ndelic.com/install.sh | bash -s -- --source branch:main

+

curl -fsSL https://raw.githubusercontent.com/RetroReversing/decompdecomp/main/site/public/install.sh | bash -s -- --source branch:main

macOS 12+ on Intel and Apple Silicon: installs the current source and a Finder app in ~/Applications. Apple Silicon needs Rosetta for the Intel N64 KMC compiler and binutils. PS2 Sony EE-GCC needs the optional local Linux runner: install brew install colima docker, then choose Prepare Linux runner in Compilers & tools. SN Systems EE-GCC 2.95.2/2.95.3 and CodeWarrior PS2 2.3.3/3.0.1 use wibo. Install wibo under Compilers & tools → Tools; existing compiler packs show Install missing tools when a runtime needs repair. Pinned SN packs handle install paths containing spaces automatically; CodeWarrior requires license acceptance in Setup. macOS has no menu bar tray icon yet.

There's also a downloadable macOS app on the latest release: download macos_arm64 for Apple Silicon or macos_x86_64 for Intel, unzip it, move decompdecomp.app to Applications, and open it from Finder. It isn't signed, so macOS may ask you to approve its first launch in Privacy & Security.

The update dialog also offers a Git source download into a new folder: use Browse to choose its parent folder, then download. It includes Git/uv setup links and commands to run a separate development copy. It follows your configured update repository and branch.

diff --git a/site/public/install.sh b/site/public/install.sh index c2f86b3b3..f86caeb57 100644 --- a/site/public/install.sh +++ b/site/public/install.sh @@ -11,7 +11,7 @@ # 4. downloads the free compilers and the m2c draft decompiler (pinned and checksum-verified) # 5. adds decompdecomp to your apps menu (replacing an older .deb or .rpm of it) and opens it # -# Your projects go to ~/Decomp. Nothing is sent anywhere. +# Your projects go to ~/Decomp-RetroReversing. Nothing is sent anywhere. # Uninstall: uv tool uninstall decompnet # # Options: diff --git a/src/decompnet/app/cli.py b/src/decompnet/app/cli.py index 7fca74f55..b7a4d2c88 100644 --- a/src/decompnet/app/cli.py +++ b/src/decompnet/app/cli.py @@ -94,7 +94,7 @@ def _state(state_file: Path) -> dict | None: def replace_older(state_file: Path, log=print) -> dict | None: """The running app's {port, secret} when it's this version or newer. An older one (still running after an upgrade) is stopped, so the new version starts in its place: returns None then, and when nothing runs. One - instance is one per home: a development copy (~/Decomp-dev) never meets the installed app (~/Decomp).""" + instance is one per home: a development copy (~/Decomp-RetroReversing-dev) never meets the installed app (~/Decomp-RetroReversing).""" prev = _state(state_file) if prev is None: return None diff --git a/src/decompnet/app/edition.py b/src/decompnet/app/edition.py index a47e7a3a3..e8a932a75 100644 --- a/src/decompnet/app/edition.py +++ b/src/decompnet/app/edition.py @@ -1,9 +1,9 @@ """Which decompdecomp this is: the release people install, or a development copy run from a git checkout. -The two are separate apps that never touch each other. A development copy has its own home (~/Decomp-dev), its own +The two are separate apps that never touch each other. A development copy has its own home (~/Decomp-RetroReversing-dev), its own first port, its own name and window class, and a highlighter of another colour in its icon. Until the rewrite they -shared everything, and a test run from the checkout quit the owner's running app with agents at work on GTA San -Andreas: a newer copy finding an older one running replaces it (cli.replace_older), within one home. +shared everything, and a test run from the checkout quit the owner's running app with agents at work on a large +game: a newer copy finding an older one running replaces it (cli.replace_older), within one home. """ from __future__ import annotations @@ -25,10 +25,15 @@ HIGHLIGHT = DEV_HIGHLIGHT if DEV else RELEASE_HIGHLIGHT +def default_home(*, dev: bool | None = None) -> Path: + """Keep this fork's incompatible database apart from upstream, including source handoffs.""" + development = DEV if dev is None else dev + return Path.home() / ("Decomp-RetroReversing-dev" if development else "Decomp-RetroReversing") + + def home_dir() -> Path: - """Where projects and the app's own state live: DECOMP_HOME, else ~/Decomp (a development copy: ~/Decomp-dev).""" - default = Path.home() / ("Decomp-dev" if DEV else "Decomp") - return Path(os.environ.get("DECOMP_HOME") or default).expanduser() + """Use an explicit DECOMP_HOME, otherwise this fork's own installed or development home.""" + return Path(os.environ.get("DECOMP_HOME") or default_home()).expanduser() def icon_svg() -> str: diff --git a/src/decompnet/app/routes/__init__.py b/src/decompnet/app/routes/__init__.py index e01eaa6f2..f4a1dc582 100644 --- a/src/decompnet/app/routes/__init__.py +++ b/src/decompnet/app/routes/__init__.py @@ -34,7 +34,7 @@ class App: """What every route module gets from server.build().""" net: RomNetwork # the engine: projects, functions, the judge mcp: MCPServer # routes are added to its web app (mcp.custom_route) - home: Path # decompdecomp's own folder (~/Decomp/.decomp) + home: Path # decompdecomp's own folder (~/Decomp-RetroReversing/.decomp) port: int secret: str # the GUI's per-launch secret mcp_url: str diff --git a/src/decompnet/app/source_runtime.py b/src/decompnet/app/source_runtime.py index 829bc3b82..6f574390c 100644 --- a/src/decompnet/app/source_runtime.py +++ b/src/decompnet/app/source_runtime.py @@ -203,7 +203,7 @@ def start(self,path,data_mode): uv=find_uv() if not uv: raise ValueError('Install uv, then reopen this dialog to run the checkout.') - target=self.app.home.parent if data_mode=='current' else Path.home()/'Decomp-dev' + target=self.app.home.parent if data_mode=='current' else edition.default_home(dev=True) if target.resolve()!=self.app.home.parent.resolve(): if edition.DEV and folder == edition.CHECKOUT_ROOT.resolve(): raise ValueError('This app already runs from that checkout. Keep current data, or choose a different checkout for a separate development app.') diff --git a/src/decompnet/app/static/js/pages.js b/src/decompnet/app/static/js/pages.js index 805801fcd..751dbfcc7 100644 --- a/src/decompnet/app/static/js/pages.js +++ b/src/decompnet/app/static/js/pages.js @@ -486,7 +486,7 @@ async function sourceCheckoutPanel(body) {

+

Opens a separate development app using ~/Decomp-RetroReversing-dev. To refresh it later, run git pull --ff-only in this folder, then run these commands again.

Requirements & manual setup

Install Git to download source and uv to run it.

  1. To download manually, run the command below in Terminal or PowerShell. Replace NEW_FOLDER with your destination path in quotes.
@@ -700,7 +700,7 @@ async function sourceRuntimeDialog() { const body = dialog("Run decompdecomp from Git", `

Run directly from a checkout so future updates do not need a rebuilt app.

Use a clean main checkout from your configured update repository. Git and uv must be installed. Download a new checkout below if needed, then select its folder above.

- +

diff --git a/tests/test_edition.py b/tests/test_edition.py index 9783c07f4..81ca851ab 100644 --- a/tests/test_edition.py +++ b/tests/test_edition.py @@ -13,9 +13,9 @@ def test_a_development_copy_lives_apart_from_the_installed_app(monkeypatch, tmp_ monkeypatch.delenv("DECOMP_HOME", raising=False) monkeypatch.setattr(edition.Path, "home", lambda: tmp_path) monkeypatch.setattr(edition, "DEV", True) - assert edition.home_dir() == tmp_path / "Decomp-dev" + assert edition.home_dir() == tmp_path / "Decomp-RetroReversing-dev" monkeypatch.setattr(edition, "DEV", False) - assert edition.home_dir() == tmp_path / "Decomp" + assert edition.home_dir() == tmp_path / "Decomp-RetroReversing" monkeypatch.setenv("DECOMP_HOME", str(tmp_path / "elsewhere")) assert edition.home_dir() == tmp_path / "elsewhere" assert edition.DEV_PORT != edition.RELEASE_PORT and edition.DEV_HIGHLIGHT != edition.RELEASE_HIGHLIGHT @@ -124,3 +124,25 @@ def test_the_packages_menu_entry_runs_the_packages_own_decomp(): entry = subprocess.run(["sed", command.group(1), str(packaging / "decompdecomp.desktop")], capture_output=True, text=True, check=True).stdout assert "Exec=/usr/bin/decomp\n" in entry + + +@pytest.mark.parametrize('dev', [False, True]) +def test_default_home_never_selects_or_migrates_upstream_data(monkeypatch, tmp_path, dev): + monkeypatch.delenv('DECOMP_HOME', raising=False) + monkeypatch.setattr(edition.Path, 'home', lambda: tmp_path) + monkeypatch.setattr(edition, 'DEV', dev) + for name in ('Decomp', 'Decomp-dev'): + internal = tmp_path / name / '.decomp' + internal.mkdir(parents=True) + (internal / 'decomp.db').write_bytes(b'upstream database must remain untouched') + (internal / 'server.json').write_text('upstream instance') + selected = edition.home_dir() + assert selected.name == ('Decomp-RetroReversing-dev' if dev else 'Decomp-RetroReversing') + assert not selected.exists() + for name in ('Decomp', 'Decomp-dev'): + assert (tmp_path / name / '.decomp/decomp.db').read_bytes() == b'upstream database must remain untouched' + assert (tmp_path / name / '.decomp/server.json').read_text() == 'upstream instance' + monkeypatch.setenv('HOME', str(tmp_path)) + monkeypatch.setenv('USERPROFILE', str(tmp_path)) + monkeypatch.setenv('DECOMP_HOME', '~/my-existing-fork') + assert edition.home_dir() == tmp_path / 'my-existing-fork' diff --git a/tests/test_source_runtime.py b/tests/test_source_runtime.py index 62653ca7f..43bb4cc9f 100644 --- a/tests/test_source_runtime.py +++ b/tests/test_source_runtime.py @@ -378,3 +378,24 @@ def command(argv, cwd): assert len(commands) == 1 and commands[0][1] == 'clone' assert r.job['state'] == 'cancelled' assert not app.manager.source_update_pending + + +@pytest.mark.parametrize('mode', ['development', 'current']) +def test_source_handoff_uses_the_fork_default_or_explicit_current_home(tmp_path, monkeypatch, mode): + from decompnet.app import cli, updates + + app = make_app(tmp_path) + app.updater.job = {'state': 'idle'} + app.settings.save = lambda: None + manager = runtime.Runtime(app) + monkeypatch.setattr(runtime.Path, 'home', lambda: tmp_path / 'user') + monkeypatch.setattr(runtime, 'validate', lambda *args: (tmp_path / 'checkout', 'git')) + monkeypatch.setattr(runtime, 'find_uv', lambda: 'uv') + monkeypatch.setattr(runtime.edition, 'DEV', False) + monkeypatch.setattr(updates, 'installed', lambda: {'repo': 'RetroReversing/decompdecomp'}) + monkeypatch.setattr(cli, '_state', lambda path: None) + queued = [] + monkeypatch.setattr(runtime.threading, 'Thread', lambda **kwargs: NS(start=lambda: queued.append(kwargs))) + manager.start(str(tmp_path / 'checkout'), mode) + expected = tmp_path if mode == 'current' else tmp_path / 'user/Decomp-RetroReversing-dev' + assert queued[0]['args'][3] == expected From 69c8f643943df1893355d5579b337dc41aeeec62 Mon Sep 17 00:00:00 2001 From: RetroGameDeveloper <40120498+RetroGameDeveloper@users.noreply.github.com> Date: Sun, 8 Nov 2026 15:53:49 +0000 Subject: [PATCH 2/2] docs: record fork data isolation in contributor instructions --- AGENTS.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b1e3c87df..0fcb49b6b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,17 +10,20 @@ archived at 0.10.6): `origin` is n-delic/decompdecomp, `upstream` the archived o Naming: the project is **decompdecomp** in everything users read. Internal names stay as decomp.wtf left them, so existing installs and projects keep working: the `decomp` command, the `decompnet` package and data folder, -`~/Decomp`, `.decomp.wtf.json` manifests, `.decomp-wtf/` state, the `decomp-wtf` git branch. Installs and updates +`.decomp.wtf.json` manifests, `.decomp-wtf/` state, the `decomp-wtf` git branch. Installs and updates come from GitHub (`REPO` in app/updates.py and install.sh); the decomp.wtf domain isn't ours, so nothing may point at it. `site/` is the website (decomp.ndelic.com, published to GitHub Pages by `.github/workflows/site.yml` on every push to main that changes `site/public/`); `site/public/` also holds the installer, `install.sh`, which updates read from GitHub. `main` is what users update from. +This fork defaults to `~/Decomp-RetroReversing` (checkouts: `~/Decomp-RetroReversing-dev`), +separate from upstream databases. Respect explicit `DECOMP_HOME` settings; do not auto-migrate old data. + ## Commands ```bash uv sync -uv run decomp # the development copy of the app, in its own window; projects in ~/Decomp-dev +uv run decomp # the development copy of the app, in its own window; projects in ~/Decomp-RetroReversing-dev uv run pytest -q # the test suite; many tests skip when a compiler or tool isn't installed uv run pytest tests/test_forks.py -q # one file uv run ruff check src tests projects # the linter (CI runs it and the tests) @@ -28,11 +31,11 @@ uv run ruff check src tests projects # the linter (CI runs it and the tests) ## Never disturb the user's own decompdecomp -The user usually has decompdecomp running (installed, port 6464, projects in `~/Decomp`) with agents working in it. +The user usually has decompdecomp running (installed, port 6464, in its configured data home) with agents working in it. Testing a change must not touch it: -- A checkout is "decompdecomp dev" (app/edition.py): its own home `~/Decomp-dev`, port 6474, its own window class, - no launcher. One instance is one per home, so it never replaces the installed app. Never point it at `~/Decomp` - (`DECOMP_HOME`). For experiments, give it a throwaway home: `DECOMP_HOME= DECOMP_TRAY=0 uv run decomp` +- A checkout is "decompdecomp dev" (app/edition.py): its own home `~/Decomp-RetroReversing-dev`, port 6474, its own window class, + no launcher. One instance is one per home, so it never replaces the installed app. Never point it at the live app's data home + (`DECOMP_HOME`), or at upstream's `~/Decomp`. For experiments, give it a throwaway home: `DECOMP_HOME= DECOMP_TRAY=0 uv run decomp` (`DECOMP_WINDOW=0`: no window). - The agent CLIs the app lists (`agy models` above all) start the MCP servers in their own settings. The app finds them outside PATH too (`~/.local/bin`, `~/.opencode/bin`, ...), so a running experiment also needs a scratch `HOME` @@ -40,7 +43,7 @@ Testing a change must not touch it: - Tests already run with a throwaway `DECOMP_HOME` and no window (tests/conftest.py). When the user's app runs from this checkout's `.venv`, run them in another environment so uv doesn't rebuild it underneath: `UV_PROJECT_ENVIRONMENT= uv run pytest -q`. -- To try a change on a real project, work on a copy: `sqlite3 "file:$HOME/Decomp/.decomp/decomp.db?mode=ro" +- To try a change on a real project, work on a copy: `sqlite3 "file:$HOME/Decomp-RetroReversing/.decomp/decomp.db?mode=ro" ".backup /.decomp/decomp.db"`, copy the project folder, point `projects.root` in the copy at it. Read the live database only with `?mode=ro`. - Don't restart, update or quit the user's app, and don't change its projects, without asking.