Skip to content

test(platform): extract Apple perf and Android runtime fixtures - #2253

Merged
thymikee merged 2 commits into
mainfrom
claude/test-fixtures-platform-perf-runtime
Sep 3, 2026
Merged

test(platform): extract Apple perf and Android runtime fixtures#2253
thymikee merged 2 commits into
mainfrom
claude/test-fixtures-platform-perf-runtime

Conversation

@thymikee

@thymikee thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

Extracts duplicated test setup from two platform suites into sibling fixture modules with named exports (AGENTS.md; no barrels).

  • packages/platform-apple/src/core/__tests__/perf.fixtures.ts: mockHostCommands routes runCmd through ordered handlers; bundle writers and ps handlers (macosBundleLookup, iosSimulatorAppContainer, hostPs, simulatorPs, simulatorPsUnavailable) replace the per-test mockImplementation ladders.
  • packages/platform-android/src/runtime.fixtures.ts: ANDROID_EMULATOR, androidRuntimeHost, androidNavigationHost, bindOrdinary replace the repeated host literals and bind({...}) blocks.

Every test keeps its title and its own assertions; nothing deleted, merged, or parametrized. The Maestro replay suite (400 duplicated lines) is left for a follow-up: this PR is at 937 gross diff lines against the 1,000 budget.

Validation

  • jscpd (--min-tokens 80 --min-lines 8) duplicated lines: perf.test.ts 418 → 18; runtime.test.ts 226 → 0.
  • Test counts unchanged: perf.test.ts 24 → 24 (88 assert.); runtime.test.ts 26 → 26 (98 expect().
  • Planted red (all restored; messages in the PR thread if needed):
    • perf.ts drop host-ps fallback → RED sampleAppleMemoryPerf falls back to host ps when simulator ps is unavailable
    • perf.ts skip cleanupLocalArtifact on nonzero leaks → RED captureAppleMemorySnapshot removes partial memgraph when leaks exits nonzero
    • runtime.ts cache probe-failed → RED a failed probe is not cached, so the next inspection asks again
    • runtime.ts admit unsupported → RED refuses both clipboard halves when the build reports no clipboard shell

Coverage-gate fix, at head 9b1034bdadc412b7d72202cdbc4be9e0ac4bab3f (BLOCKED finding 1 — see chore(gates) commit):

  • packages/platform-android/src/runtime.fixtures.ts sat outside any __tests__ dir, so coverage.include picked it up as production source and the changed-line gate scored its 20 unreachable construction lines directly (39.39% < 70%). Added **/*.fixtures.ts to vitest.config.ts's coverage.exclude (repo-wide convention: 40+ fixture modules, all test support).
  • Planted red, targeted run against the real diff and the real model.ts (BEFORE/AFTER, not committed as a new test — the existing "includable source absent from lcov" model test already covers the generic mechanism): file present in lcov, all added lines uncovered → totalLines=110 coveredLines=0 pct=0 passed=false; file absent from lcov (post-fix) → totalLines=0 excludedTotal=99 excludedReason=excluded-path passed=true.
  • Confirmed against a real vitest run --coverage + check:coverage-changed --base origin/main: runtime.fixtures.ts is absent from coverage/lcov.info, and the gate reports PASS with its 99 code-like lines under the non-gating excluded tally (excluded-path).
  • Focused checks at this head: oxlint vitest.config.ts --deny-warnings, pnpm check:coverage-changed:test (20/20 green) — both green.

Full affected gate: green at full sha 9b1034bdadc412b7d72202cdbc4be9e0ac4bab3f (pnpm check:affected --run; gates run: format, lint, typecheck, layering, di-seams, fallow, mcp-metadata, build, package, integration-node, macos-coverage, vitest-related, integration-progress, replay-compat, daemon-wire-compat, affected-selector, gate-manifest, gate-manifest-model, depgraph, tmpdir-leaks, tmpdir-leaks-model, coverage-model, wire-compat-model, production-exports, bundle-owner-files, fixture-cache, fixture-fallback, command-docs, agent-guidance, xctest-selection, maestro-conformance, mutation-model; rest are GitHub-authoritative/parked and skipped locally by design)

Tradeoffs / follow-ups

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.58 MB 2.58 MB 0 B
JS gzip 869.6 kB 869.6 kB 0 B
npm bundled raw 2.58 MB 2.58 MB 0 B
npm bundled gzip 869.6 kB 869.6 kB 0 B
npm tarball 1.02 MB 1.02 MB -7 B
npm unpacked 3.46 MB 3.46 MB 0 B
npm clean-installed 3.46 MB 3.46 MB 0 B

npm unpacked components

Component Base Current Diff
JS / dist source 2.74 MB 2.74 MB 0 B
Apple runner source/project 544.4 kB 544.4 kB 0 B
Apple snapshot presentation source 33.8 kB 33.8 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 43.3 kB 43.3 kB 0 B
Other package files 46.3 kB 46.3 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.9 ms 29.6 ms +0.6 ms
CLI --help 77.7 ms 78.2 ms +0.5 ms

Top changed chunks: no changes in the largest emitted chunks.

Top changed packed files

No changed packed files.

@thymikee thymikee changed the title test(platform): extract shared fixtures from the Apple perf, Android runtime, and Maestro replay suites test(platform): extract Apple perf and Android runtime fixtures Sep 2, 2026
@thymikee

thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

BLOCKED at 42a148eba008cbc1cac1ec17817ae82be7b23ee8.

  1. Coverage is an owner-action failure: 13/33 changed lines (39.39%) versus the 70% gate. All 20 uncovered lines are in newly extracted packages/platform-android/src/runtime.fixtures.ts. Cover the host facets/builders or reshape the extraction so non-production test fixture code is classified appropriately.

  2. Validation still says pnpm check:affected --run is pending despite the repository before-push requirement. Provide exact-head evidence.

Regression assertions remain meaningful, all other CI is green, package size is unchanged, and no device proof is owed. The title has been corrected to the actual Apple perf + Android runtime scope.

…id runtime suites

Move the duplicated host-command routing, app-bundle writers, and ps
handlers behind packages/platform-apple/src/core/__tests__/perf.fixtures.ts,
and the Android runtime host, device, and ordinary-bind builders behind
packages/platform-android/src/runtime.fixtures.ts. Every test keeps its
title and its own assertions; test and assertion counts are unchanged.
runtime.fixtures.ts (packages/platform-android/src) sits outside any
__tests__ dir, so vitest's coverage.include picked it up as production
source and the changed-line gate scored its 20 unreachable construction
lines directly, failing at 39.39% against the 70% threshold.

Add '**/*.fixtures.ts' to coverage.exclude (repo-wide convention:
40+ fixture modules, all test support, never production). The file
disappears from lcov and scripts/coverage-changed/model.ts's existing
excluded-path fallback reports it non-gating instead, with no
duplicate classifier needed there.

Planted red (targeted run against the real diff/model, not committed):
BEFORE (file present in lcov, all added lines uncovered): totalLines=110
coveredLines=0 pct=0 passed=false. AFTER (file absent from lcov post-fix):
totalLines=0 excludedTotal=99 excludedReason=excluded-path passed=true.
Confirmed against a real `vitest run --coverage` + `check:coverage-changed`
pass: runtime.fixtures.ts absent from coverage/lcov.info, gate PASS,
99 lines reported under excluded/excluded-path.
@thymikee
thymikee force-pushed the claude/test-fixtures-platform-perf-runtime branch from 42a148e to 9b1034b Compare September 3, 2026 07:28
@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Addressed both findings at head 9b1034bdadc412b7d72202cdbc4be9e0ac4bab3f.

  1. Coverage: runtime.fixtures.ts sat outside any __tests__ dir, so coverage.include scored it as production and the gate failed on its 20 unreachable construction lines. Added **/*.fixtures.ts to vitest.config.ts's coverage.exclude (repo-wide convention: 40+ existing fixture modules, all test support) in a chore(gates) commit — no duplicate classifier needed in scripts/coverage-changed/model.ts, which already treats an lcov-absent path as non-gating. Verified with a real vitest run --coverage + check:coverage-changed: the file is absent from coverage/lcov.info, gate reports PASS, its 99 code-like lines land in the non-gating excluded tally. Targeted-run before/after numbers are in the PR body.

  2. Validation section rewritten with the focused checks actually run at this head and the head SHA; the literal pending line for the full affected gate is preserved — the exact-head gate result follows from the serialized gate stage.

@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

BLOCKED at 9b1034bdadc412b7d72202cdbc4be9e0ac4bab3f. No code finding remains: the *.fixtures.ts exclusion is consistent with this repository's test-support fixture classification. The sole blocker is exact-head iOS Smoke, likely unrelated runner/private-AX instability (Xcode launch timeout with repeated private-AX application-match failures). Obtain a passing rerun or same-head/main baseline-control evidence.

@thymikee
thymikee merged commit 3726f02 into main Sep 3, 2026
18 of 20 checks passed
@thymikee
thymikee deleted the claude/test-fixtures-platform-perf-runtime branch September 3, 2026 13:58
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-03 13:59 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant