Repository navigation
feat(desktop): suggest managed members for Unity script assemblies - #5511
Conversation
…semblies Unity Mono triage listed only inspect_managed_artifact probes, mostly for engine and framework assemblies. Assembly-CSharp.dll and Assembly-CSharp-firstpass.dll directly in a managed directory with a UnityEngine reference witness now get an inspect_managed_members probe, ordered before every managed artifact probe.
Unity IL2CPP builds write <Product>_BackUpThisFolder_ButDontShipItWithYourGame next to the player. When shipped, its Managed/ holds pre-IL2CPP assemblies. A path convention now records the folder on Assembly-CSharp*.dll directly in its Managed/, including when the admitted root is the folder itself, and triage offers inspect_managed_members for those files. Correspondence to the shipped native code stays unknown.
…embly-probes # Conflicts: # docs/desktop-applications.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryAdds
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Recorded managed PE header"] --> B{"Predefined assembly in a Unity managed folder with a reference witness?"}
B -->|Yes| C["Add member inspection suggestion"]
B -->|No| D{"Recorded IL2CPP backup convention?"}
D -->|Yes| C
D -->|No| E["Keep existing probes"]
C --> F["List member suggestions before existing probes"]
Reviews (2) · Last reviewed commit: "test(desktop): check the IL2CPP backup c..." · Reviewed by Greptile |
CassieFox23
left a comment
There was a problem hiding this comment.
TL;DR: Main still never suggests inspect_managed_members for a Unity game's own code. This PR adds that suggestion for Assembly-CSharp.dll and Assembly-CSharp-firstpass.dll, the logic reads tight, and CI is green on this head. The body swaps the repo template for its own headings.
Findings
Should fix
- The body does not keep the repo template as written. Please move the content under the template headings. The material is mostly there in your own words. What changed:
- Present: Summary and Author readiness, with all three boxes checked.
- Some parts were swapped out. Three template parts are gone. They are Problem, Change and scope, and Compatibility. In their place are "Behavior and boundaries" and "Coverage limits". And it uses "Executed validation" in place of "Validation performed".
- The body has no "Problem and expected behavior" part. It has no "Change and scope" part either, so the "Follow the contribution scope" paragraph is gone too.
- Missing: the seven lines of "Contract and boundary impact". The body does say
next_probes[].operationgains an additive value. That belongs on the CLI and MCP/tool-catalog line. - Missing: the eight "Expected effects" boxes. The "Read existing files or captured data" box looks like the one that applies.
- Missing: four labels and three boxes. They sit under "Evidence and regression coverage".
- Missing: four labels. They sit under "Compatibility, safety, and release".
- Missing: the eight "Before merge" boxes.
Worth a look
- The macOS bundle layout has no committed positive test. The member-probe tests use
Game_Data/Managedin the ordering test. TheContents/Resources/Data/Managedlayout appears only in the no-witness test, where no probe is expected. The body reports macOS probe counts, but a counts table is not a regression test. The existingit.eachat line 297 already runs both layouts for the Unity-reference rule. Its result there is negative. - The two member probes leave different traces. The backup-folder probe comes from a recorded file fact,
unity-il2cpp-backup-convention(reader lines 416 to 426). The Mono probe re-reads the file path inside the projection and records no fact. A reader offiles[]can see why the backup probe exists but not the Mono one. Is that intended? Deriving it from the existingunity-assembly-referencefact plus the path is a fair design. I just want the choice to be deliberate. - A root that is a Unity data folder gets no Mono probe. The Mono rule needs at least three path segments (
nativeConvention.tsline 64). So pointing the tool atGame_Dataor atManagedfinds no managed directory. The PR does make a root that is itself the backup folder work (lines 81 to 96). I read this in the code and did not run it. The limit exists on main already. A line in the docs saying "point at the game folder" would cover it. - The new probe exists only for a DLL the scan actually read. It needs the
pe-cli-directoryfact, and files past the probe byte budget get none (reader lines 252 to 258; default 8 MiB atdesktopApplication.tsline 23). The ordinary managed probes have the same limit. I did not measure how often a large game hits it. - The Codex review on this head failed to complete. Its summary comment says it “couldn’t complete this review”. So no Codex findings exist for this head. A maintainer can ask it to retry. Greptile scored it 5/5 with no actionable issues.
- The branch is far behind main. Since the merge base, main changed four files this PR also changes:
docs/desktop-applications.md,DesktopApplicationReader.ts,desktopApplication.tsand the test file. Two examples are 79b3f46 and 992e930. The first is about GameMaker data filenames. The second one is about the coverage of unsupported filenames. GitHub now reports the PR as conflicting with main, so it needs a rebase. The body's CI evidence is from before those commits. - The body's
npm testrun had 9 failures on the author's macOS host, and the body says they were not measured on main. CI on this head is the better signal here:CI required,Portable testsand all eight test shards passed.
Nits
nativeConvention.tslines 57 and 58 stack two/** */blocks over one function. One block is enough.- The docs fix for IL2CPP metadata versions 24 and 27 is a second outcome beside the title. It is separate in commit 2e4e51d, so it is easy to read on its own. It is also right (see below), and Greptile already noted it.
Looks good
- Main (7fd722e) still lacks the feature. A search of
desktopApplicationProjection.ts,desktopApplication.tsanddocs/desktop-applications.mdon main finds noinspect_managed_members. - The Mono rule is narrow on purpose. The probe needs three things. One is the CLI-directory fact. Another is a Unity witness in the same managed directory. The last is a predefined name directly inside it (
unityPredefinedAssembly). The ordering test adds look-alikes that must not match. One is a nested copy (too deep). One is a copy in a second_Datafolder with no witness. One is underPlugins/, which is not a managed directory. - I traced the root-is-backup case. With
rootNameprefixed, the shift is 1 and the backup index is -1. That matches only a path of exactly two segments withmanagedfirst, such asManaged/Assembly-CSharp.dll. The root test checks that and the"."directory value. The backup test checks look-alikes too. They are an empty product prefix, a missing suffix, a nested copy, and the wrong depth. - "Listed first" is real.
next_probesis built from aMapin insertion order, and the member probes are added before the ordinary ones (lines 64 to 89). The ordering test asserts the first two rows. - No new authority. The probes are suggestions with
confidence: "inferred". The new fact is a path convention withoffset: null. The backup rationale says the match to the shipped native code is unknown. The docs paragraph at lines 112 to 117 says the same. - The docs fix is accurate:
IL2CPP_METADATA_VERSIONSis[24, 27, 29, 31, 39]on main. Main has since made the same docs fix in 866c72c. So this hunk can drop when you rebase. - The body is open about gaps. The backup folder was checked only on macOS builds. Agent tool choice after the change is unmeasured.
- No competing PR. Searches on #3607 and on the new operation found this PR. They also found #5785, which I did not read. It has the same author and is about il2cpp generic instances. The #3607 thread has the author's list of related PRs.
Not run
- No checkout, no build, no tests, no formatter.
- I did not run the tool on any Unity sample. I did not check the layout of a real Unity backup folder, and I did not measure the body's probe counts or response sizes.
- I did not read
desktopApplicationView.tsbeyond the probe-grouping loop, and I did not try a merge with main.
Thanks, 8rulerstar, for the careful scope notes. Thanks too for the look-alike tests and the honest coverage limits.
Test setup
🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊
…ssembly-probes # Conflicts: # docs/desktop-applications.md
74619f4 to
964cd7f
Compare
|
@codex review |
|
Ready for another look. Head is 3ecaab0. I merged main into the branch and GitHub no longer reports a conflict. CI on this head passed ( Pending
Should fix
Worth a look
Validation
Nits
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…ssembly-probes Resolve the DesktopApplicationReader conflict by keeping main's pathConventions, which reserves every path-convention fact before the row is retained, and moving the IL2CPP backup fact and the admitted root name into it.
Summary
For a Unity Mono player,
inspect_desktop_applicationsuggestsinspect_managed_artifactfor every managed DLL (90 probes on a Unity 2022.3.62f3 Win64 sample, almost allUnityEngine.*,System.*,Mono.*) and neverinspect_managed_members. This adds oneinspect_managed_membersprobe for each Unity predefined script assembly (Assembly-CSharp.dll,Assembly-CSharp-firstpass.dll), listed first, and the same probe for those assemblies in an IL2CPP build's<Product>_BackUpThisFolder_ButDontShipItWithYourGame/Managed/. Related: #3607 (not a fix for it, so not linked with "Fixes").Problem and expected behavior
Use case: an agent triaging a Unity game wants the game's own code first. Today the probe list is dominated by engine and BCL assemblies, and the member-level operation that answers "what does this game's code contain" is never suggested.
Expected: when a managed directory has a
unity-assembly-referencewitness,Assembly-CSharp.dllandAssembly-CSharp-firstpass.dlldirectly in that directory get aninspect_managed_membersprobe ahead of everyinspect_managed_artifactprobe. The same applies to those names inManaged/of an IL2CPP backup folder, with a rationale stating that correspondence to the shipped native code is unknown. All other probes stay identical and in the same order.Change and scope
desktopPathConventions(src/domain/nativeConvention.ts), which already owns the Unity managed directory rule, also owns the predefined assembly name rule and the backup folder suffix rule (case-folded, non-empty product prefix). The admitted root name is passed in so the root itself can be the backup folder.pe-cli-directoryfact, sits directly in a managed directory that already has aunity-assembly-referencewitness, and has a predefined name. The Mono probe is derived from that existing witness fact plus the path, so it records no new fact; the backup probe has no comparable witness, so it recordsunity-il2cpp-backup-convention. This asymmetry is deliberate.unity-il2cpp-backup-convention(offset: null,backup_directory) is a path convention only. Nounity-monolabel is added from it.<Product>_DataorManagedfolder itself (an existing limit on main, now documented: point the scan at the game folder); DLLs past the probe byte budget, which get nope-cli-directoryfact, same as the ordinary managed probes.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Maintainer scope decision: not applicable (additive probe suggestion within the existing desktop triage boundary; no new provider or capability).
Contract and boundary impact
desktopPathConventionsinsrc/domain/nativeConvention.ts; projection insrc/domain/desktopApplicationProjection.ts.next_probes[].operationgains the additive valueinspect_managed_members; new additive fact kindunity-il2cpp-backup-conventioninfiles[].facts.offset: null; probe rationale states IL correspondence to shipped IL2CPP code is unknown.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated:
tests/boundary/filesystem/desktopApplication.test.tscovers probe ordering for predefined assemblies inGame_Data/Managed; positive member probe in a macOS bundleContents/Resources/Data/Managed; no member probe when the root isGame_DataorGame_Data/Manageditself; no member probes without a Unity reference witness; backup folder probes (including the backup folder as root, case folding, and non-matching names).src/domain/desktopApplicationProjection.test.tsaddsunity-il2cpp-backup-conventionto the fact list that main's probe fan-out test checks againstDESKTOP_PROBES_PER_FACT.Base reproduction or other evidence: executed, on self-built samples at
2e4e51d87, before the main merges. Counts were not re-measured after merging main; the member-probe ordering is covered by committed tests, while "other probes identical" rests on these pre-merge runs only.Build/with backup folder (2022.3 / 2020.3)User-visible CLI/MCP output (if applicable): first two
next_probesrows for aGame_Data/Managedfixture withAssembly-CSharp.dll(Unity reference) andUnityEngine.CoreModule.dll, captured by running the boundary test'sinspecthelper on that fixture on Windows 11 (ids shortened with …, local root replaced by<root>, path separators shown as/):[ { "probe_id": "dsp_aa7219f7…", "operation": "inspect_managed_members", "path": "<root>/Game_Data/Managed/Assembly-CSharp.dll", "file_id": "dsf_22ced2df…", "rationale": "Inventory types, members and user strings of this Unity predefined script assembly; its references and contents are unverified. Start with detail \"summary\" and page rows through inspect_analysis_view.", "confidence": "inferred" }, { "probe_id": "dsp_664cd29a…", "operation": "inspect_managed_artifact", "path": "<root>/Game_Data/Managed/Assembly-CSharp.dll", "file_id": "dsf_22ced2df…", "rationale": "Inspect the declared managed metadata and references.", "confidence": "inferred" } ]Response size on the Win64 sample:
inspect_managed_artifact12,977 B,inspect_managed_members104,955 B default, 12,805 B withdetail: "summary"; the rationale points to summary first.Remaining proof gaps: backup folders checked only on macOS builds, not Windows or Linux layouts or a shipped game. No sample contains
Assembly-CSharp-firstpass.dll(test only). Not run on Unity 6, Linux players, 32-bit Windows or commercial games. Agent tool selection after the change is unmeasured. How often large games exceed the probe byte budget is unmeasured.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
Not applicable: this is a feature, not a boundary fix. The new behavior is covered by the boundary tests listed above.
For evidence-bearing changes:
Validation performed
At
5716a2429(merge of maind48e472fais967903f80), Windows 11, Node 24.19.0, below theenginesfloor 24.22.1 (dependencies installed with--engine-strict=false):npm run check:fast(typecheck and lint): passed.node scripts/run-exact-tests.mjs run tests/boundary/filesystem/desktopApplication.test.ts src/domain/desktopApplicationProjection.test.ts: 91 passed, 3 skipped, 1 failed:does not promote filenames, arbitrary pak files or symlink targets into byte factsfails withEPERMcreating a symlink (Windows without symlink privilege). That test already exists on main and is not touched by this PR.npm run test:focusedstops before running any test on this machine because its build step needs the Windows native build output (native/windows/build/manifest.json), so the CLI and MCP desktop tests were left to CI.npm run docs:checkwas not run locally.CI on
5716a2429:CI required,Build package,Documentation,Portable testsand all eight test shards passed.Compatibility, safety, and release
Author readiness
Human owner: @8rulerstar
Before merge
type(scope): outcome.