Skip to content

Architecture checks: no title IDs in the host, build IDs only in its per-build tables - #422

Closed
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:arch-checks
Closed

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:arch-checks

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

Part of #313 ("Rules that enforce themselves": architecture checks as ordinary tests).

Problem

AGENTS.md asks for per-game values in the profile, not in code, and for host behaviour that depends on a game build to check module_t.build_id. Today the code follows both rules:

  • the C and Objective-C sources of dm/host and dm/gfx (tests and third-party code left out) name no game by its title ID in code;
  • the 32-digit build IDs appear only in hle_fpslock.c and hle_uemalloc.c, the two tables keyed by build.

Nothing keeps it that way, though. A quick if (title_id == 0x0100…) in the core would pass review unnoticed in a 10,000-line file.

Change

dm/tools/tests/test_architecture.py:

  • No title IDs in the core: a base game's or an update's title ID, with or without 0x, an integer suffix (ull) or quotes, fails. Comments that cite a source are left out, like hle_fpslock.c's path to masagrator's FPSLocker config.
  • Build IDs only in the build tables: a quoted 32–64-digit build ID outside hle_fpslock.c / hle_uemalloc.c fails. The 16-digit shader keys in nvn_builtin.h aren't build IDs and aren't matched.
  • The failure message says where the value goes instead: the profile (game.tsv, read as a DM_GAME_ macro), a table row, or the profile's patches.py. Your agents run these tests, so they get that hint on their own.

When the per-build tables become profile rows (the #313 item), BUILD_TABLES shrinks with them.

Not in this PR: file sizes

The roadmap also names file size limits. I measured before adding one:

file lines now 3 days ago growth
nvn_mtl.m 10,866 8,645 +2,221
shader_split.py 2,277 1,415 +862
build_ipa_from_nsp.py 2,177 1,748 +429
hle_nvn.c 2,532 2,342 +190

A cap on today's sizes would stop your own commits within a day, so I left it out. Two options if you want one:

  1. No new file above ~3,000 lines. Existing files are exempt, so it only prevents new monoliths.
  2. A cap on nvn_mtl.m after it's split (Split nvn_mtl.m into topic parts (mechanical, identical machine code) #133, mechanical, identical object code), so each part stays reviewable.

Your call. Either is one more small test.

Checked

  • Passes on main, and on every open branch that changes host code: UE3 support, Arkham Knight, pool peak, launcher schema, sanitizers, dmsh_abi.h, input remap, the adjustable clock.
  • Fails on 0x0100F2C0115B6000ull, an update's 0x…6800 and a quoted title ID added to hle_os.c, and on a quoted build ID added to hle_nvn.c.
  • Lint ratchet 0 new; test_docs OK.

…per-build tables

AGENTS.md asks for per-game values in the profile, not in code, and host
behaviour that depends on a game build to check module_t.build_id. Both
hold today: the C and Objective-C sources of dm/host and dm/gfx (tests and
third-party code left out) name no game by its title ID in code, and the
32-digit build IDs appear only in hle_fpslock.c and hle_uemalloc.c, the
tables keyed by build that seedds#313 wants the profiles to take over. Nothing
kept it that way.

test_architecture.py fails on a title ID in code (a base game's or an
update's, with or without 0x, an integer suffix or quotes; comments that
cite a source, like hle_fpslock.c's FPSLocker config path, are left out)
and on a quoted build ID outside the two tables. The message says where the
value goes instead: the profile, a table row, or the profile's patches.py.

Checked: it passes on main and on the open branches that change host code
(UE3 support, Arkham Knight, pool peak, launcher schema, sanitizers,
dmsh_abi.h, input remap, the adjustable clock); it fails on
0x0100F2C0115B6000ull, an update's 0x...800 and a quoted title ID in
hle_os.c, and on a quoted build ID in hle_nvn.c.
@github-actions github-actions Bot added the tools Tools and scripts (dm/tools, scripts) label Nov 3, 2026
seedds added a commit that referenced this pull request Nov 4, 2026
…nd the build-ID scan reads .inc files

test_architecture.py fails on a title ID in the host's code: Switch or Switch 2, a base game, its update or another program of the game, as digits or an integer. Comments and firmware IDs (0100000000000xxx) are left out. The pattern must match every ID the profiles name, so a new family of IDs fails the test instead of passing unseen.

docs_patches.host_files() is now the one list of host sources for both checks. It adds .inc, where a build ID was not seen until now. The PR's own build-ID test is left out: test_docs already stops on a host row docs_patches.py cannot classify.

Co-authored-by: v0lumehi <[email protected]>
@seedds

seedds commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Landed as c7da003, with you as co-author. Thanks. main had moved on by 441 commits, so it landed reworked:

  • Kept: the title-ID check, the structure of the test and the comment handling.
  • Widened: the pattern missed IDs that are on main now: the 04… Switch 2 profiles, other programs of one game (Super Mario 3D All-Stars' …6001), and integers written without the leading zero. It now also has to match every ID the profiles name, so a new family of IDs fails the test instead of passing unseen.
  • Dropped: the build-ID test. Since Patch design: bind every patch as loosely as what it depends on (host, sdk, engine, game, build) #635, docs_patches.py scans the host for build IDs and test_docs stops on a row it cannot classify. The one thing your test still added was .inc files, so that scan reads them now, and both checks share one list of host sources (docs_patches.host_files(), which also takes in dm/ios).

File size limits stay undecided in #313.

@seedds seedds closed this Nov 4, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…), and the build-ID scan reads .inc files

test_architecture.py fails on a title ID in the host's code: Switch or Switch 2, a base game, its update or another program of the game, as digits or an integer. Comments and firmware IDs (0100000000000xxx) are left out. The pattern must match every ID the profiles name, so a new family of IDs fails the test instead of passing unseen.

docs_patches.host_files() is now the one list of host sources for both checks. It adds .inc, where a build ID was not seen until now. The PR's own build-ID test is left out: test_docs already stops on a host row docs_patches.py cannot classify.

Co-authored-by: v0lumehi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants