Skip to content

refactor(android): take the host in JADX configuration, doctor and workspace roots - #11086

Merged
morluto merged 3 commits into
mainfrom
refactor/host-platform-android
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
refactor/host-platform-android

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

HostPlatform migration (W8), src/android. JADX configuration, the JADX doctor probe and the workspace root take the host as a parameter instead of reading process.platform/process.arch, so tests select another host by passing it rather than redefining global process properties.

Also carries #11102 (collapsed): a counted test-host-platform-stub architecture guard against tests that redefine process.platform/process.arch (baseline may only shrink; each module migration switches its tests to injection).

Problem and expected behavior

requireSupportedHost, resolveJava and createJadxWorkspaceRoot read the ambient platform and architecture, and systemWindowsNativeAuthority read them too. Tests for unsupported hosts and Windows native admission (jadxDoctor, JadxWorkspaceRoot, androidGuardianObservation) redefined process.platform/process.arch; with a frozen HOST_PLATFORM that only works while these modules keep ambient reads, and the redefined win32 result was also cached by systemWindowsNativeAuthority for the rest of the worker. Expected: the host flows from the caller, and tests inject it.

Change and scope

  • inspectJadxAvailability options gain a required host: HostPlatform; resolveJadxConfigurationInputs(environment, operation, host, signal?); inspectJadxProvider(environment, resourceOwner, host, signal?); createJadxWorkspaceRoot(platform).
  • JadxProvider takes an optional host constructor argument defaulting to HOST_PLATFORM (composition is unchanged) and uses it for environment snapshots, admission and the workspace root. doctorRuntime passes HOST_PLATFORM to the doctor probe.
  • systemWindowsNativeAuthority(host = HOST_PLATFORM): only this host's result is cached; another host's admission loads the packaged artifact uncached (test seam), so an injected win32 run no longer poisons the cache. Callers pass the same HOST_PLATFORM object in production, so caching is unchanged.
  • Tests: the unsupported-host and Windows-native doctor tests pass { platform, architecture }; JadxWorkspaceRoot.test.ts passes "win32"; verifyWindowsGuardianIsolation(platform = process.platform) in scripts/verify/android/windows-guardian-isolation.mjs lets androidGuardianObservation pass "win32". No test in these files redefines process.platform any more.
  • Baseline: 11 ambient-host-platform and 4 ambient-host-architecture reads removed from src/android; src/windows/WindowsNativeLoader.ts's platform/arch reads are gone too.
  • Not included: other folders (separate PRs).
  • Scope: internal refactor; no target execution, injection, mutation or protection recovery.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/platform/HostPlatform; consumers are JADX admission, doctor and workspace root, and the Windows native loader.
  • Contribution scope fit and linked maintainer decision: not applicable (approved cleanup plan, W8).
  • CLI and MCP/tool-catalog contract: unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests updated: tests/boundary/android/jadxDoctor.test.ts (unsupported host, two Windows native admission cases), src/android/JadxWorkspaceRoot.test.ts, tests/boundary/process/androidGuardianObservation.test.ts, plus callers in jadxConfiguration, jadxArchiveLifecycle and jadxJavaLifecycle tests.
  • Base reproduction or other evidence: with the host threaded through JADX but systemWindowsNativeAuthority still reading process.platform, the two injected Windows doctor tests failed (unsupported_host instead of runtime_missing), which shows the tests now exercise the injected host rather than the global.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: Windows not run locally.

Validation performed

  • npx tsc --noEmit -p . — passed.
  • node scripts/verify/architecture-guards.mjs --shrink-baselines — passed; baseline lowered.
  • npm run test:focused -- src/android/JadxWorkspaceRoot.test.ts tests/boundary/android/jadxDoctor.test.ts tests/boundary/android/jadxConfiguration.test.ts tests/boundary/android/jadxArchiveLifecycle.test.ts tests/boundary/process/jadxJavaLifecycle.test.ts tests/boundary/process/androidGuardianObservation.test.ts src/windows/WindowsNativeLoader.test.ts tests/process-global/windowsNativeControlCapability.test.ts tests/process-global/windowsRuntimeAdmission.test.ts tests/composition/reverseProviderLaunchErrors.test.ts tests/boundary/process/jadxIntegration.test.ts — 10 files passed; windowsNativeControlCapability.test.ts failed, and it fails the same way on current main sources (it redefines process.platform, which src/process no longer reads since refactor(process): take the host from HOST_PLATFORM and require the platform in process helpers #11038); fixed in test(windows): select the Windows host through HOST_PLATFORM in the native-control capability test #11088.
  • npm run check:fast — passed.
  • Review fixes (5eda839): npm run test:focused -- src/windows/WindowsNativeLoader.test.ts tests/boundary/android/jadxDoctor.test.ts tests/boundary/android/jadxConfiguration.test.ts — 69 passed; the two new cache cases fail (2 failed / 26 passed) with the host bypass removed. Verifier scripts (scripts/verify/android/*.mjs) now pass HOST_PLATFORM; npm run verify:android not run (needs the real JADX lane).
  • Rebased onto main a8e4729 (0ce677b): node scripts/verify/architecture-guards.mjs --shrink-baselines lowered the stub baseline for windowsNativeControlCapability.test.ts (main already moved it to injection); guards passed; pre-push check:fast passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none (internal API).
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change to admission rules; Windows native caching unchanged for the running host.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T12:03:15.092570Z
We couldn’t complete this review. Comment @codex review to try again.
be4954f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] The reviewed changes appear safe to merge; no new actionable issue was found.

Summary

JADX configuration, doctor checks, and workspace creation now receive the host explicitly.

  • Android JADX now follows the host passed in by its caller.
  • Injected Windows hosts no longer replace the running host’s cached authority.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  H["HOST_PLATFORM"] --> P["JadxProvider"]
  H --> D["createSystemDoctorHost"]
  D --> J["inspectJadxProvider"]
  P --> C["JadxConfiguration"]
  J --> C
  C --> A["Host admission and Java selection"]
  A --> N["systemWindowsNativeAuthority"]
  N --> Q{"Same HOST_PLATFORM object?"}
  Q -->|Yes| K["Reuse stable cached result"]
  Q -->|No| U["Load without changing cache"]
  P --> W["createJadxWorkspaceRoot"]
  W --> R{"Windows?"}
  R -->|Yes| G["Detached workspace guardian"]
  R -->|No| X["PrivateRuntimeRoot"]
Loading

Reviews (4) · Last reviewed commit: "test(platform): count tests that redefin..." · Reviewed by Greptile

Comment thread src/android/JadxConfiguration.ts Resolved
Comment thread src/android/JadxConfiguration.ts Resolved
Comment thread src/windows/WindowsNativeLoader.ts Resolved
….arch (#11102)

Tests select a host by injection. A redefined process.platform stops exercising its branch once the module under test reads HOST_PLATFORM, and still passes. A counted baseline (105 sites in 20 files) may only shrink; each module migration switches its tests to injection.
@morluto
morluto force-pushed the refactor/host-platform-android branch from 662dbf1 to 0ce677b Compare November 15, 2026 12:49
@morluto
morluto merged commit 5d4e9b8 into main Nov 15, 2026
6 of 8 checks passed
@morluto
morluto deleted the refactor/host-platform-android branch November 15, 2026 12:53
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration provider: jadx Analysis provider / engine: jadx labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration provider: jadx Analysis provider / engine: jadx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant