chore(dev): rebuild client on change for desktop dev on Windows - #4459
chore(dev): rebuild client on change for desktop dev on Windows#4459CN-liuzhiyang wants to merge 1 commit into
Conversation
|
| Filename | Overview |
|---|---|
| packages/desktop/scripts/dev.ps1 | Adds conditional client rebuilding and configurable Metro-port selection; the existing untracked-source and repository-wide-HEAD fingerprint findings remain outstanding. |
| docs/development.md | Documents desktop build and port behavior; the unresolved repository-rule finding about restating implementation remains outstanding. |
| paseo.json | Adds the Windows desktop managed-service command; its previous daemon-port thread was manually resolved. |
| .gitignore | Ignores the machine-specific Lefthook override file. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start[Launch Windows desktop development] --> Main[Build Electron main process]
Main --> Fingerprint[Compute client build fingerprint]
Fingerprint --> Changed{Fingerprint changed?}
Changed -->|Yes| Build[Build protocol and client distributions]
Build --> Save[Save fingerprint]
Changed -->|No| Skip[Reuse existing distributions]
Save --> Port
Skip --> Port{EXPO_PORT preset?}
Port -->|Yes| Preserve[Use configured port]
Port -->|No| Select[Select from 8081 through 8085]
Preserve --> Desktop[Start desktop development]
Select --> Desktop
Reviews (2): Last reviewed commit: "chore(dev): rebuild client on change and..." | Re-trigger Greptile
| ) | ||
| $ClientBuildMarker = "$DesktopDir\.dev\build-client.fingerprint" | ||
| $HeadSha = (git -C $RootDir rev-parse HEAD).Trim() | ||
| $WorkingDiff = git -C $RootDir diff HEAD -- $ClientBuildPaths |
There was a problem hiding this comment.
Untracked Sources Skip Rebuild
The fingerprint uses git diff HEAD, which does not include untracked files. If a developer adds a protocol or client module and imports it from outside these fingerprinted paths, the fingerprint remains unchanged, build:client is skipped, and Metro resolves against stale dist output where the new module does not exist.
| $HeadSha = (git -C $RootDir rev-parse HEAD).Trim() | ||
| $WorkingDiff = git -C $RootDir diff HEAD -- $ClientBuildPaths | ||
| $WorkingDiffHash = if ($WorkingDiff) { ($WorkingDiff -join "`n" | git -C $RootDir hash-object --stdin).Trim() } else { "clean" } | ||
| $CurrentFingerprint = "$HeadSha|$WorkingDiffHash" |
There was a problem hiding this comment.
Unrelated Commits Trigger Rebuilds
The fingerprint includes the repository-wide HEAD SHA, so every commit or branch switch changes it even when protocol and client inputs are identical. Pulling changes limited to the app, server, or documentation therefore reruns the client build, contrary to the stated source-change-only behavior.
| Desktop dev doesn't watch-build `@getpaseo/protocol`/`@getpaseo/client` the way | ||
| `npm run dev` does. `packages/desktop/scripts/dev.ps1` instead fingerprints | ||
| their sources (current `HEAD` plus a hash of the working-tree diff against it) | ||
| against the fingerprint from the last desktop dev build, stored in | ||
| `packages/desktop/.dev/build-client.fingerprint`, and only reruns `build:client` | ||
| when that fingerprint changed — so a `git pull` that touches protocol picks up | ||
| a rebuild automatically, and repeat restarts with no relevant changes skip it. |
There was a problem hiding this comment.
Documentation Restates Implementation
This section records the exact input paths, Git fingerprint construction, marker-file location, and branch condition. That violates the repository directive not to document logic that merely restates code because such prose drifts from the implementation. Keep the user-facing behavior and rationale here, but this repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…top dev on Windows Desktop dev didn't watch-build protocol/client like `npm run dev` does, so stale dist output for those packages went unnoticed. Fingerprint their sources against the last desktop dev build and rebuild only when they changed. Also documents the Windows Hyper-V/WSL reserved-port gotcha and adds a `desktop-win` paseo.json service entry.
caf6886 to
889a7c1
Compare
|
Closing for now: this needs Windows launcher evidence that changed and newly added client/protocol sources reach the running app, and that the new managed service uses its assigned daemon port. Please reopen with that evidence. |
|
Please disregard the earlier invitation to reopen with evidence. This PR remains closed unless I explicitly follow up. You don't need to resubmit this PR or provide further QA evidence. Please read the updated PR policy. For now, I'm automatically closing feature PRs so I can focus more time on bug fixes and core improvements. Focused bug-fix PRs with a clear reproduction and QA are still welcome. The previous guide already asked contributors to submit only if they were comfortable with closure, and explained that unsolicited PRs could be closed without a detailed review. For feature ideas, please start in GitHub Discussions and share your workflow: what you're trying to do, how you do it today, and where Paseo gets in the way. If there's already a discussion about it, join in and share your use case. I'll periodically review discussions for highly requested workflows and use that feedback to shape the roadmap. I'll periodically look through closed PRs and choose which contributions to take forward, whether solicited or unsolicited. I may reopen a PR, including one closed by mistake, or use it as a reference for my own implementation, with attribution either way. There are hundreds of PRs alongside ongoing development. I can't commit to reviewing every submission, providing individual feedback or giving timelines. |
Linked issue
N/A
Type of change
Reasoning
npm run devwatch-builds@getpaseo/protocoland@getpaseo/client, but the Windows desktop dev launcher (packages/desktop/scripts/dev.ps1) never rebuilt them. After agit pullthat touched the protocol, the desktop app ran against staledistoutput and failed in ways that looked like app bugs. Separately, Hyper-V/WSL on Windows reserves TCP port blocks that commonly include 8081, so Metro fell back to a random port on every restart and dev browser storage (hosts, layout) was lost each time.Goals
dev.ps1fingerprints protocol/client sources (HEADplus a hash of the working-tree diff against it) against the last desktop dev build and rerunsbuild:clientonly when that changed.dev.ps1honours a presetEXPO_PORTinstead of always auto-picking from8081-8085.netsh interface ipv4 show excludedportrange protocol=tcp) indocs/development.md.desktop-winservice entry topaseo.jsonso Paseo-managed worktrees can launch Windows desktop dev.lefthook-local.yml(machine-specific hook overrides).Non-goals
dev.shor the POSIX desktop dev flow.QA
npm run dev:win:desktop: first launch rebuildsbuild:clientand writespackages/desktop/.dev/build-client.fingerprint; relaunching with no protocol/client changes prints the skip line; editing a file underpackages/protocol/srctriggers a rebuild on the next launch.setx EXPO_PORT 8181then relaunch: Metro binds 8181 across restarts.npm run typecheckandnpm run lintpass on the rebased branch.npm run format:checkreports onlyAGENTS.md/packages/server/AGENTS.md, which are unformatted onmainand untouched here.Checklist
npm run typecheckpassesnpm run lintpassesnpm run formatpasses (for the files in this PR)