Skip to content

Patch queue on a pinned upstream replaces the anchor-based sync (part of #123) - #124

Merged
v0lumehi merged 5 commits into
LNPANDY:mainfrom
v0lumehi:patch-queue
Oct 28, 2026
Merged

v0lumehi merged 5 commits into
LNPANDY:mainfrom
v0lumehi:patch-queue

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #123. The mechanism, the migration and the workflows are here, and the series is derived from the pin main took in #130 (seedds 062cd06), after #137 and #138; two patches conflict with today's seedds main (below), so this does not say "Fixes".

The model

The vendored paths (dm/ scripts/ docs/ ref/ AGENTS.md) are no longer synced by text anchors. They are seedds/nxnative at the commit in .upstream-ref plus the patches in patches/, applied in the order of patches/series with git am -3: a real three-way merge, as Electron does with its Chromium patches and Debian does with debian/patches. Each patch is a git format-patch file with Upstream-Status, Reason and Issue in its message; scripts/patches.py has apply, bump, export, status and check (see patches/README.md for the walk-through, including how to carry a quick fix and send it upstream). A bump drops the patches that come out empty and reports them; a conflict stops it and names the patch, its Reason and its Upstream-Status. Nightly, the sync opens a PR on sync/upstream (or an issue naming the patch) instead of pushing to main.

Also in this PR, from the follow-up on #123: a patch policy (patches/README.md), check/export reject a patch that touches the shader chain or tool pins (the paths are read from AGENTS.md; no existing fork change touched them), and every build records the patches it carries (dm/fork_patches.txt written by patches.py, DMForkPatches in Info.plist, first line of the log fork patches: ... on Mac and iOS; the issue forms ask for it).

What changed

  • scripts/patches.py and scripts/tests/test_patches.py (24 tests on a fixture repository: apply reproduces the tree, an empty patch drops on a bump, a conflict names its patch and changes nothing, export writes the header, a chain-touching patch is rejected, the generated list, the generated indexes).
  • patches/: 19 patches (table below), derived from the diff between seedds 062cd06 and main's vendored tree. patches.py check passes: the series on 062cd06 gives the committed vendored tree byte for byte (2142 files). That tree differs from main's only by what the migration retires (next section) and by the stamp patch.
  • Workflows: sync-upstream.yml (bump, check, PR or issue; optional SYNC_TOKEN secret so the PR starts tests.yml, because a PR opened with GITHUB_TOKEN does not), daily-health.yml and the tests.yml job patch-queue (check plus a report-only dry bump to seedds main), pr-scope.yml runs check. All use -R ${{ github.repository }}.
  • Retired: scripts/sync_upstream.py (14 patchers, OURS, MARKERS, check_unprotected) and scripts/tests/test_sync_patchers.py. CONTRIBUTING.md, the PR template, CLAUDE.md and both READMEs describe the new model. AGENTS.md does not mention the sync, so it is untouched.

Generated files

dm/tools/docs_patches.py and docs_symptoms.py write docs/agents/game-patches.md and symptoms.md; upstream's test_docs.py requires them to equal that output, and the patched tree differs from upstream's (c7eca13 is the same fix in the old sync). apply, bump and check now run both tools on the patched tree and commit the result in the scratch worktree; check and export keep patches away from those two files. docs/badges/*.json stay static in fork-docs (open: they come from the README's table, outside the vendored paths).

The patches (19)

patch Upstream-Status Reason
runtime-profile pending (design note seedds/nxnative#492) One host binary for every game: the profile constants are read at run time (DM_PROFILE, dm_profile()), not only as compile-time macros; the launcher needs it
romfsarc fork-only Legacy ROMFSARC shard archives (Tears of the Kingdom, 300k files) that players already made; upstream reads DMROMFS1 images instead. Kept so existing archives keep loadin...
ios-game-data-folder pending Several games in one app, game data on an external drive: Documents/games//{romfs.img,romfs,msl,save,temp} and a Files-app pick of the data folder (needs the runtime ...
ios-slim-ipa fork-only (upstream has the opt-in DM_COPY_ROMFS=NO since 32ae3b1; the fork's slim default differs) Default slim IPA: the RomFS and aoc/ stay out unless DM_FULL_ROMFS=1 (a full package of a large game is many GB and iOS refuses it). Upstream took the opt-out DM_COPY_ROM...
nsp-dotnet-home pending A GUI launch can hand the build an empty HOME, and .NET first-run configure dies on it; telemetry and the banner are off for the build
nsp-chain-changed-note fork-only (seedds/nxnative#490 is the event form, not this text note) The front ends turn the [NOTE] chain-changed marker into a notice when cached shader libraries are from an older chain; upstream will have a shaders_stale event (seedds/n...
nsp-work-dir forwarded seedds/nxnative#475 The front end keeps each game build in its own folder: --work-dir sets the build folder and the default IPA location
bc-cpu-decode fork-only (declined seedds/nxnative#488) BC textures on GPUs without BC support (A15/A16 and older iPhones), outside upstream's supported devices; gated by supportsBCTextureCompression and the profile key tex_bc...
mac-keymap forwarded seedds/nxnative#386 The launcher's Controls page: DM_KEYMAP and DM_PAD_MAP move buttons to other keys and controller buttons (open upstream, #386)
mac-library-folder pending (seedds/nxnative#460 is the upstream design: a dataFolder key) Saves and log follow the game library folder (<folder of the .app>/.nx2apple-library marker); replaced by the dataFolder pref once #460 merges
hades2-update-profile forwarded seedds/nxnative#485 Hades II 1.0.137848 update: build rows, shader_versions v0 v1 and the NVN segment keys
env-switches-verify pending env_switches.py --verify checks a draft for DM_* names that are not real switches; the agent guide says to run it
touchpad-geometry fork-only Virtual-pad geometry used by tests only; a fork experiment without a hook in the host
ios-probe fork-only dlopen probe app (an experiment) and its write-up; not upstream material
fork-docs fork-only The fork's own planning and release documents and its README badges
ref-hle-hid-d2r fork-only Reference copy of the d2r-mobile HID layer
fork-patches-stamp fork-only Route bug reports: a build beyond upstream's support matrix names the patches it carries
nsp-dotnet-root-verify pending configure_dotnet takes the first listed root without checking that the shader translator runs with it; the build stops at the iOS shader step with an empty fingerprint (f...
nsp-prune-intermediate-extracts pending Disk space: every intermediate extraction is a full copy of the game and the next build re-extracts them anyway when its inputs change. Fork commit 1887fe9; not sent to ...

Statuses checked against gh on seedds/nxnative today: #386, #475, #485, #490, #460 and #492 are open, #488 and #478 are closed.

Dropped as upstream has it at the pin (verified)

dropped patch upstream
ios-entitlements build_ipa.sh carries the ad-hoc entitlement block at the pin (32ae3b1); the fork's dm/ios/ENTITLEMENTS.md moves to fork-docs
nsp-exfat-appledouble the rmtree hook and the AppleDouble skip (a0b8bdb, #476); main's only remaining difference was Python 3.9 compatibility, below the script's 3.12 floor
nsp-early-checks iOS SDK, Rosetta and glslang checks (c464cb2, #477, #487); the fork's duplicates (check_glslang, a second Rosetta check, the check_glslang mock in test_xcode_workflow.py) go
nro-code-start code_start and code_ranges in patch_nso.py (3e77816)
hle-time-adjustable-clock hle_time.c and t_time.c (4d2dc7d, #385)

All five commits are ancestors of the pin. Also not carried: dm/games/0100A00019DE0000/game.fork.tsv (a copy the Hades patcher kept; as in the first version of this PR).

New knowledge from main carried into the series

Bump against today's seedds main (7a3a875), dry run

  • Applied cleanly (17): runtime-profile, romfsarc, ios-game-data-folder, ios-slim-ipa, nsp-dotnet-home, nsp-chain-changed-note, nsp-work-dir, bc-cpu-decode, mac-library-folder, hades2-update-profile, env-switches-verify, ios-probe, fork-docs, ref-hle-hid-d2r, fork-patches-stamp, nsp-dotnet-root-verify, nsp-prune-intermediate-extracts.
  • Landed upstream, dropped automatically: none.
  • Conflicts (2, each independent): mac-keymap (docs/development.md, docs/env_switches.tsv) and touchpad-geometry (dm/host/tests/Makefile). Down from 12.

Checks run here

patches.py check ok; python3 -m unittest discover scripts/tests (24 tests) and dm/tools/tests/test_docs.py pass; make -C dm/host GAME=010015100B514000 builds.

What did not fit the model

  • Patches that depend on each other (ios-game-data-folder needs runtime-profile; the stamp patch needs ios-game-data-folder and mac-library-folder) are ordered by the series, not declared.
  • A backport patch does not drop on its own when upstream took the change in another form; there are none left in the series.
  • The old sync also regenerated the README's game table, its banners and the badge counts; those are outside the vendored paths and nothing refreshes them now (open).
  • check compares the working tree, so an uncommitted vendored edit fails it too, which is what the fork wants.

@v0lumehi
v0lumehi force-pushed the patch-queue branch 2 times, most recently from 3150476 to 4b5cb02 Compare October 28, 2026 13:50
@LNPANDY

LNPANDY commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Approved — go ahead. The model is right (a real three-way merge instead of text anchors; today's sync needed five integration fixes that a patch series would have surfaced as one conflict).

Two conditions for the switch, both already in your plan: keep the anchor-based sync working until the patch queue passes check on the current seedds main, and refresh the 12 conflicting patches against it in this PR rather than after. When the nightly workflow flips, do it in the same merge so there is one switch, not two models running side by side.

Take the 48h as already served — this is the owner's approval.

…ch queue

The vendored paths become upstream at the commit in .upstream-ref plus the git format-patch files in patches/, applied with
git am -3 in a scratch worktree. bump moves the pin, drops patches that come out empty and stops at a conflict naming the
patch, its Reason and its Upstream-Status; export turns commits into patches with the header template; check verifies the
headers, rejects patches that touch the shader chain (the paths are read from AGENTS.md) and compares the series applied to
the pin with the vendored tree. scripts/tests/test_patches.py covers them on a fixture repository.

Part of LNPANDY#123
…xnative 75065df

patches/ holds one patch per logical change, each with Upstream-Status, Reason and Issue; the vendored tree is
unchanged except for what the migration retires: scripts/sync_upstream.py and its test (the anchor patchers, OURS and
MARKERS), dm/games/0100A00019DE0000/game.fork.tsv (a copy the Hades patcher restored; the profile change is a patch now)
and the nso_code.py data_blocks(lo=) edit (nothing passes lo). New: the patch fork-patches-stamp, so a build records the
patches it carries (DMForkPatches in Info.plist, first line of the log), and dm/fork_patches.txt, which patches.py writes.

Part of LNPANDY#123
… queue

sync-upstream.yml bumps the pin and opens or updates a PR on sync/upstream (an issue naming the patch on a conflict) instead of
pushing to main. daily-health.yml and tests.yml run patches.py check and a dry bump against seedds main. pr-scope runs check.
The game and build issue forms ask for the fork patches line of the log. CONTRIBUTING, the PR template, CLAUDE.md and the READMEs
describe the model; patches/README.md has the walk-through and the patch policy.

Part of LNPANDY#123
…so the patch is fork-only for its default, not declined
, LNPANDY#137, LNPANDY#138)

The pin is the one main took in LNPANDY#130. Every patch is re-derived from the diff between that commit's tree and main's vendored tree, one per logical change, 19 patches (was 22).

Dropped, because upstream has it at the pin:
- ios-entitlements: build_ipa.sh has the ad-hoc entitlement block (32ae3b1); the fork's ENTITLEMENTS.md moves to fork-docs.
- nsp-exfat-appledouble: the rmtree hook and the AppleDouble skip are upstream (a0b8bdb); main's remaining difference was Python 3.9 compatibility, below the script's 3.12 floor.
- nsp-early-checks: the iOS SDK, Rosetta and glslang checks are upstream (c464cb2); the fork's duplicates (check_glslang, a second Rosetta check) go.
- nro-code-start: patch_nso.py has code_start (3e77816).
- hle-time-adjustable-clock: hle_time.c has it (4d2dc7d).

Carried from main's newer knowledge: the unsigned-IPA test adaptation (LNPANDY#137) joins ios-slim-ipa; the DOTNET_ROOT check and the pruning of intermediate extractions, which the old series did not carry, are patches of their own; romfsarc takes main's handle-shift fix in hle_fs.c.

patches.py: apply, bump and check regenerate docs/agents/game-patches.md and symptoms.md on the patched tree (upstream's test_docs.py requires them to equal their tools' output), and check/export keep patches away from them. Tests for it. The vendored tree differs from main's only by what is retired (sync_upstream.py and its test, game.fork.tsv, the dropped duplicates) and by the stamp patch.
@v0lumehi
v0lumehi requested a balanced review from Copilot October 28, 2026 15:36
@v0lumehi
v0lumehi merged commit 10c70ad into LNPANDY:main Oct 28, 2026
8 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

LNPANDY added a commit that referenced this pull request Oct 28, 2026
#124 replaced the anchor-based sync with the patch queue on a pinned
upstream: dm/, scripts/ and docs/ are generated from .upstream-ref plus
patches/, so a fork document must arrive as a patch. This branch's
registration in scripts/sync_upstream.py no longer has a file to change.

Two patches, both generated with scripts/patches.py export:

  0020-launcher-c-plan.patch      docs/launcher-c-plan.md (the M1-M5 plan)
  0021-probe-dlopen-result.patch  the #139 result: docs/probe-dlopen.md and
                                  the WORK-IN-PROGRESS row that names it

0021 also repairs main: #139 edited those two docs directly, so
`scripts/patches.py check` failed on main ("differs (content):
docs/WORK-IN-PROGRESS.md, docs/probe-dlopen.md") and the next bump would
have reverted the probe result.

Verified: scripts/patches.py check -> ok, 21 patches on upstream 062cd06;
python3 -m unittest discover -s scripts/tests -> 24 tests OK.
@v0lumehi
v0lumehi deleted the patch-queue branch November 1, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants