Skip to content

test(platform): count tests that redefine process.platform or process.arch - #11102

Merged
morluto merged 1 commit into
refactor/host-platform-androidfrom
test/host-platform-stub-guard
Nov 15, 2026
Merged

morluto merged 1 commit into
refactor/host-platform-androidfrom
test/host-platform-stub-guard

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a counted architecture guard against tests that redefine process.platform or process.arch. Part of the HostPlatform migration (W8). Stacked on #11086.

Problem and expected behavior

Production modules now take the host from src/platform/HostPlatform (or a parameter). A test that redefines process.platform keeps passing after its module migrates but stops exercising the branch it was written for; windowsNativeControlCapability.test.ts did this until #11088. Tests should inject the platform (parameter, host option, or a mock of HostPlatform).

Change and scope

  • scripts/verify/architecture-guards.mjs: a test-host-platform-stub counted guard over test, spec and fixture files in src/ and every .ts file under tests/, matching defineProperty(process, "platform"|"arch" and spyOn(process, "platform"|"arch" (also on globalThis.process).
  • Baseline: 105 sites in 20 files (as of refactor(android): take the host in JADX configuration, doctor and workspace roots #11086, which already moves the JADX tests to injection). It may only shrink; each module migration switches its tests to injection and lowers it with --shrink-baselines.
  • Not included: migrating any of the 20 files. Sites inside spawned child scripts (nativeUiVerifierActions, debuggerOneShotExit) are counted too; they go when their verifier or module takes an injected host.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/platform/HostPlatform stays the single host reader; this guards the test side.
  • Contribution scope fit and linked maintainer decision: W8 plan step (coordinator decision to add the guard now).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; 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.

  • 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 added or updated: the guard itself.
  • Base reproduction or other evidence: a probe file src/zzGuardProbe.test.ts containing Object.defineProperty(process, "arch", { value: "x64" }); made the guard fail with src/zzGuardProbe.test.ts: 1 (baseline 0); probe removed.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: the pattern does not catch indirect forms (a descriptor name held in a variable, vi.stubGlobal("process", ...)); none redefine platform or arch today.

Validation performed

  • node scripts/verify/architecture-guards.mjs — passed (2839 source files).
  • Probe above — guard failed as expected.
  • Pre-push hook (check:fast) — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

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.

….arch

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.
@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:29:59.345010Z
We couldn’t complete this review. Comment @codex review to try again.
9116992 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

[Low impact] The PR appears safe to merge.

Summary

Adds test-host-platform-stub to the counted architecture guards, with 105 existing matches across 20 files.

  • The architecture check tracks direct host stubs in tests.

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

@morluto
morluto merged commit 662dbf1 into refactor/host-platform-android Nov 15, 2026
1 check passed
@morluto
morluto deleted the test/host-platform-stub-guard branch November 15, 2026 12:32
morluto added a commit that referenced this pull request Nov 15, 2026
….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 added a commit that referenced this pull request Nov 15, 2026
…rkspace roots (#11086)

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

* fix(android): pass the host in verifiers, follow it for JAVA_HOME, and test the native cache split

* test(platform): count tests that redefine process.platform or process.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 added the area: tests Test suite and verification label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant