feat(classify): Android modules at any depth, Unity, React Native, Flutter, .NET split #449

Merged
sharang merged 1 commits from feat/mobile-detection into main 2026-10-05 14:02:44 +00:00
Owner

#436 (mobile detection), plus the .NET split, which was agreed with the platform session (#445 does not touch classify/language.rs).

Why

Managed Git (#444) sets the type of its new targets from this classification. The old classifier looked only 2 levels deep:

  • An Android Studio project (app/src/main/AndroidManifest.xml, 3 levels deep) was not recognised.
  • A repository with an Android app plus a Unity project and its generated .csproj/.sln files therefore came out as a desktop app.
  • React Native counted as a web app, because its package.json names react.

Change (compliance-agent/src/classify/language.rs)

  • Depth 6. Build output, dependencies and caches are skipped: build, .gradle, node_modules, Pods, DerivedData, and Unity's Library/Temp/Obj/Logs.
  • Android: a module's src/main/AndroidManifest.xml, or a Gradle file applying com.android.application/library. Every module is recorded as an android_module fact, so phone and tablet apps in one repository are both named.
  • React Native and Flutter: mobile apps with a framework fact; React Native is no longer a web app.
  • Unity (ProjectSettings/ProjectVersion.txt, at any depth):
    • with Android plugins in its Assets → Android app (0.8);
    • beside Android modules → Android app (0.8);
    • otherwise → desktop app (0.6).
    • Its generated .sln/.csproj no longer count.
  • .NET split per project file:
    • WPF/Windows Forms → Desktop. Recognised by UseWPF, UseWindowsForms, PresentationFramework, System.Windows.Forms, or the WPF type GUID 60dc8134….
    • ASP.NET → Backend. Recognised by Microsoft.NET.Sdk.Web, AspNetCore, System.Web.Mvc/Http, a Web.config beside the project, or the type GUID 349c5851….
    • WCF → Backend. Recognised by System.ServiceModel or .svc files.
    • Confidence is 0.55 plus 0.2 × the share of projects, so the majority wins and no .NET verdict beats a clear mobile signal (0.8).
    • Projects of no clear kind (libraries, tools) and native .vcxproj remain a weak desktop verdict (0.55).
  • Paths keep their original case; only the comparison ignores case. A lowercased path was unreadable on Linux, which a test caught.

Tests (6 new, 25 in total for classify)

  • Android repo: a phone and a tablet module plus a Unity subfolder with a generated .csproj → AndroidApp. Both modules are named, there is no desktop verdict, and Unity's Library/PackageCache manifest is ignored.
  • Unity with Assets/Plugins/Android → AndroidApp, with the unity fact.
  • React Native → AndroidApp, not WebApp.
  • Flutter → flutter fact.
  • .NET: a WPF + ASP.NET (Web.config) + WCF (.svc) + library solution → Backend first, Desktop second; a WPF + WinForms solution → Desktop.
  • Markers in node_modules/build are ignored.

Checks

  • fmt, plus clippy with the CI flags on the agent; agent lib tests pass.
  • Local nightly, all targets: no baseline changes from this PR. The only differences were one new OSV advisory (left out) and the semgrep staging race, now fixed in #448.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

#436 (mobile detection), plus the .NET split, which was agreed with the platform session (#445 does not touch `classify/language.rs`). ## Why Managed Git (#444) sets the **type of its new targets from this classification**. The old classifier looked only 2 levels deep: - An Android Studio project (`app/src/main/AndroidManifest.xml`, 3 levels deep) was not recognised. - A repository with an Android app plus a Unity project and its generated `.csproj`/`.sln` files therefore came out as a **desktop app**. - React Native counted as a web app, because its `package.json` names `react`. ## Change (`compliance-agent/src/classify/language.rs`) - **Depth 6.** Build output, dependencies and caches are skipped: `build`, `.gradle`, `node_modules`, `Pods`, `DerivedData`, and Unity's `Library`/`Temp`/`Obj`/`Logs`. - **Android:** a module's `src/main/AndroidManifest.xml`, or a Gradle file applying `com.android.application`/`library`. Every module is recorded as an `android_module` fact, so phone and tablet apps in one repository are both named. - **React Native and Flutter:** mobile apps with a `framework` fact; React Native is no longer a web app. - **Unity** (`ProjectSettings/ProjectVersion.txt`, at any depth): - with Android plugins in its `Assets` → Android app (0.8); - beside Android modules → Android app (0.8); - otherwise → desktop app (0.6). - Its generated `.sln`/`.csproj` no longer count. - **.NET split per project file:** - **WPF/Windows Forms → Desktop.** Recognised by `UseWPF`, `UseWindowsForms`, `PresentationFramework`, `System.Windows.Forms`, or the WPF type GUID `60dc8134…`. - **ASP.NET → Backend.** Recognised by `Microsoft.NET.Sdk.Web`, `AspNetCore`, `System.Web.Mvc/Http`, a `Web.config` beside the project, or the type GUID `349c5851…`. - **WCF → Backend.** Recognised by `System.ServiceModel` or `.svc` files. - Confidence is 0.55 plus 0.2 × the share of projects, so the majority wins and no .NET verdict beats a clear mobile signal (0.8). - Projects of no clear kind (libraries, tools) and native `.vcxproj` remain a weak desktop verdict (0.55). - Paths keep their original case; only the comparison ignores case. A lowercased path was unreadable on Linux, which a test caught. ## Tests (6 new, 25 in total for classify) - **Android repo:** a phone and a tablet module plus a Unity subfolder with a generated `.csproj` → AndroidApp. Both modules are named, there is no desktop verdict, and Unity's `Library/PackageCache` manifest is ignored. - **Unity with `Assets/Plugins/Android`** → AndroidApp, with the `unity` fact. - **React Native** → AndroidApp, not WebApp. - **Flutter** → `flutter` fact. - **.NET:** a WPF + ASP.NET (Web.config) + WCF (.svc) + library solution → Backend first, Desktop second; a WPF + WinForms solution → Desktop. - **Markers in `node_modules`/`build`** are ignored. ## Checks - fmt, plus clippy with the CI flags on the agent; agent lib tests pass. - **Local nightly, all targets:** no baseline changes from this PR. The only differences were one new OSV advisory (left out) and the semgrep staging race, now fixed in #448. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-05 13:38:30 +00:00
feat(classify): Android modules at any depth, Unity, React Native, Flutter, .NET split
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m34s
3282b05fad
The classifier looked two levels deep, so an Android Studio project
(app/src/main/AndroidManifest.xml) was not recognised, and a repository
with an Android app, a Unity project and their generated .csproj files
became a desktop app. Managed Git sets the type of its new targets from
this classification, so that mattered.

- Markers are collected to depth 6, skipping build output, dependencies
  and caches (build, .gradle, node_modules, Pods, Unity Library/Temp/Obj).
- Android: a module's src/main/AndroidManifest.xml or a Gradle file
  applying com.android.application/library; every module is a fact
  (phone and tablet apps in one repository are both named).
- React Native (package.json names react-native) and Flutter (sdk:
  flutter) are mobile apps, no longer web apps.
- Unity (ProjectSettings/ProjectVersion.txt): an Android app when it has
  Android plugins or sits beside Android modules, otherwise a desktop app;
  its generated .sln/.csproj no longer count.
- .NET projects are split: WPF/Windows Forms (UseWPF, UseWindowsForms,
  PresentationFramework, System.Windows.Forms, the WPF project type GUID)
  -> desktop; ASP.NET (Microsoft.NET.Sdk.Web, AspNetCore, System.Web,
  Web.config beside the project, the web project type GUID) and WCF
  (System.ServiceModel, .svc) -> backend. The kind with more projects
  ranks higher, and no .NET verdict outranks a clear mobile one.

Refs #436.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit e92c395e50 into main 2026-10-05 14:02:44 +00:00
Sign in to join this conversation.