Skip to content

fix(emulator): wait for complete scrcpy server downloads - #35503

Merged
OrcaWin merged 1 commit into
mainfrom
audit/scrcpy-jar-atomic-publication
Oct 29, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
audit/scrcpy-jar-atomic-publication

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5

LoC: +135/-10

Keep a partially downloaded scrcpy JAR out of the ready cache. Starting another Android screen stream after the first10KB arrived previously handed its device the unfinished JAR. Download to a unique sibling file, validate the completed transfer, then rename it into the cache; remove staging on failures.

Validation:20 configured tests/2 suites,2 expected baseline regressions with3 controls,strict focused TypeScript and all5 normal hook tasks pass. Actual committed production code through real Node HTTP/filesystem and AndroidStreamController:9 groups per arm. At1/10 later device starts, baseline hands off16KB partial files; final starts0 until all64KB arrive. Same-device dedupe, interrupted-transfer rejection and full-byte retry, cached reuse, undersized/status/redirect outcomes and resource cleanup are preserved. HTTPS requests are mapped to an owned loopback HTTP server; the device-start seam reads actual bytes but launches no ADB/device process.

Required aggregate queued after #35496; no aggregate pass or Claude takeover claimed.16 production/caller blobs equal mainb2feed0e924c36d4d1610df6c47ab50c29b60cec. No dependency, UI, wire or path-policy change. Actual runtime: Node26.8.1 (corrects the sealed report’s Node24.22 label; raw sealed JSON records v26.8.1). Actual Android/ADB, native Electron UI, live GitHub/TLS,macOS/Windows,CPU/RAM/latency and process-crash recovery were not tested. Existing minimum-size validation remains; this does not repair older truncated caches already over10KB. Nearby #35490/#9950 are distinct and must survive rebase.

Frozen head 9c72740f20e6dba7643e721f7d34bc581ffdb5d4, base 79dbada2c873bef3584a0c53b23ae98f2a84e536. Evidence /home/neil/.local/state/orca-electron-audit/scrcpy-jar-atomic-publication/report.md;48-payload seal 8e163f1766af6eeeb813334fb8b200bf5f29796180418b73853c07a70f60e14d.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The download writes to a staging path, validates its size, and renames valid data to the final path. It removes the staging file after success or failure and preserves an existing final file when a download fails. New tests cover concurrent callers, partial downloads, cleanup, and retry.

Priority: Normal

Merge Risk: Minimal · up to 5e569

The change makes the scrcpy server JAR appear in the cache only after its download completes, which removes the chance of starting a stream from a partial file. Tests cover concurrent callers and interrupted transfers. I found no established defect that should block merging. The only open question is a narrow multi-process cache-sharing scenario, which is unlikely given the per-profile instance lock.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, implementation, validation scope, and known limitations. However, it does not follow the required template and omits or leaves incomplete required items, includin… Rewrite the description using all required template headings. Add an actual linked issue, provide a brief ELI5 explanation, state the before-and-after behavior and rationale, mark Visual Proof as N/A with a reason if applicable, record test…
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing consumers from using incomplete scrcpy server downloads.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, implementation, validation scope, and known limitations. However, it does not follow the required template and omits or leaves incomplete required items, including the ELI5, What Changed, Why, Linked Issue with an actual issue reference, Visual Proof or N/A statement, Testing checkboxes, AI Disclosure, Review, Notes, and Checklist sections.

Resolution

Rewrite the description using all required template headings. Add an actual linked issue, provide a brief ELI5 explanation, state the before-and-after behavior and rationale, mark Visual Proof as N/A with a reason if applicable, record testing and platform coverage, complete applicable checklist items, and include AI Disclosure if required.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Keeps unfinished scrcpy downloads out of the ready cache.

  • Android stream starts wait for the complete scrcpy JAR.

No actionable issues found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Request server JAR] --> B{Cached JAR ready?}
  B -->|Yes| C[Return cached path]
  B -->|No| D[Share pending download]
  D --> E[Download to staging file]
  E --> F{Transfer succeeds and size passes?}
  F -->|Yes| G[Rename into cache]
  G --> C
  F -->|No| H[Remove staging file and reject]
Loading

Reviews (4) · Last reviewed commit: "fix(emulator): publish scrcpy JAR only a..." · Reviewed by Greptile

@OrcaWin
OrcaWin force-pushed the audit/scrcpy-jar-atomic-publication branch 2 times, most recently from 963d118 to 0c543a1 Compare October 29, 2026 21:18
@OrcaWin
OrcaWin force-pushed the audit/scrcpy-jar-atomic-publication branch from 0c543a1 to 5e56955 Compare October 29, 2026 21:44
@OrcaWin
OrcaWin merged commit 895fd43 into main Oct 29, 2026
41 checks passed
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