* reland(sidecar): converge product clients after weekly release
Restore the sidecar convergence from #7244 after the release-scheduling revert in #7634. This tree matches the previously reviewed and cross-platform QA-accepted implementation at d83d4e032f.
* fix(sidecar): clarify identity and cache witnesses
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(packaged): probe cross-source desktop owners
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(sidecar): preserve cross-source launch ownership
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* test(pack): assert cross-source Windows launch ownership
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(sidecar): align HyperFrames with client boundary
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(e2e): keep HyperFrames fixture in helper lane
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* docs(sidecar): restore review and handoff contracts
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(sidecar): restore cache and daemon boundaries
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(pack): restore sourcemaps and Linux smoke discovery
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(sidecar): make payload handoff generation-atomic
* fix(sidecar): preserve packaged action and mode parity
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* test(pack): align Linux cleanup resource count
Generated-By: looper 0.11.2 (runner=fixer, agent=codex)
* fix(packaged): preserve headless sidecar mode
* test: normalize source line endings
* fix(daemon): launch Codex cmd shims on Windows
---------
Co-authored-by: Looper <looper@noreply.github.com>
19 KiB
tools/pack
Follow the root AGENTS.md and tools/AGENTS.md first. This tool owns the repo-external packaged build/start/stop/logs command surface.
Read tools/pack/CACHE.md before changing any build-cache node key, adding a cache node, or changing what a cached node reads or writes. It is the source of truth for the build-graph cache under --cache-dir: determinant rules, materialization-time parameters, the signing boundary, and confidence grading.
Owns
- Local packaging orchestration for packaged Open Design artifacts.
- mac build/install/start/stop/logs/uninstall/cleanup smoke commands.
- Windows NSIS build/install/start/stop/logs/uninstall/cleanup/list/reset smoke commands.
- Windows registry observation/cleanup must go through
reg.exeand stay scoped to entries matching the namespace install/uninstaller paths. - Windows lifecycle logs must expose NSIS automation logs/markers/timings in addition to app runtime logs.
- Linux AppImage build/install/start/stop/logs/uninstall/cleanup smoke commands.
- Linux headless (no-Electron) install/start/stop via
--headlessflag oninstall,start, andstop. - Linux containerized builds via
electronuserland/builderDocker image for distro-agnostic glibc compat. - Consuming sidecar/process/path primitives from
@open-design/sidecar-proto,@open-design/sidecar, and@open-design/platform.
Does not own
- Product business logic.
- Sidecar protocol definitions.
- A second process identity model.
- Product/business update runtime integration.
Rules
- Keep cross-platform source responsibilities in named directories such as
cache/,config/,launcher/,resources/,updates/, andversioning/; keep platform-owned behavior belowmac/orwin/. Mirror those responsibilities intests/when a test set has the same ownership. A new root-levelsrc/*.tsfile is intentionally treated as unclassified by CI and pays the conservative Windows payload fallback until it is placed in an owned source unit. - Tests import source modules through the test-only
@/*alias. Tests that intentionally inspect source text use the same alias with Vitest's?rawsuffix; do not reintroduce directory-depth-dependent../src/imports or file URLs. - Do not hand-build stamp argv, IPC paths, or process matching; use
@open-design/sidecarlaunch/discovery/invoke/stop atomics. - Do not use port numbers in data/log/runtime/cache path decisions. Namespace decides paths; ports are only transient transports.
- Public release artifacts must use channel-specific app identity: stable uses
Open Design, beta usesOpen Design Beta, prerelease usesOpen Design Prerelease, and preview usesOpen Design Preview. Local tools-pack installs may still use namespace-scoped install paths only as a developer multi-instance validation convention. - Do not let namespace-named
.appinstalls change data/log/runtime/cache path conventions. --dircontrols tools-pack output/runtime/install validation roots only. It must not be treated as the cache root. The default workspace tools-pack cache is the hot path.--cache-diris a special-case escape hatch for cache isolation or cold-cache validation, not a routine QA/build parameter.- Use
--portablefor public/release artifacts so packaged config does not bake local tools-pack runtime roots from the build machine. - Pack resource files used by electron-builder belong under
tools/pack/resources/; do not point pack logic at Downloads, web public assets, docs assets, or other app-owned resource paths. - For ordinary Windows NSIS smoke tests, use short namespaces such as
rg,smoke, ornsis-a. NSIS extracts deeply nested Next.js standalone files under the namespace-scoped install directory; long namespaces can push installed paths past the traditional Windows 260-character limit even when builderwin-unpackedoutput is correct. During merge regression, namespaceregression-merge-nsisproduced an installed path length of 264 characters and missednext/dist/server/route-matcher-providers/helpers/cached-route-matcher-provider.jsin the installed directory, while the same NSIS smoke passed with namespacerg. Use long namespaces only when intentionally testing installer path-length behavior.
Packaged auto-update architecture and harness
Read this section before changing packaged auto-update behavior. The updater crosses package, desktop, web UI, release-feed, and installer surfaces, so bugs often hide between otherwise-green package tests.
Architecture map
apps/desktop/src/main/updater.tsowns updater state, release metadata parsing, artifact selection, checksum verification, download-store ownership, progress events, and opening the downloaded installer. It is pure main-process logic and is tested underapps/desktop/tests/main/updater.test.ts.apps/desktop/src/main/runtime.tsexposes updater IPC to the renderer throughod:update:status|check|download|install|quitand emitsod:update:status-changed. Keep installer launch separate from process shutdown; quit is an explicit post-installer action.apps/desktop/src/main/index.tswires the scheduler and the packaged macOS app-menu update item. The native item mirrors updater state and opens the renderer-owned update dialog; it must not create a second updater or a native result dialog. Windows and Linux menus do not expose update actions.apps/web/src/lib/updater.tsnormalizes host updater snapshots into UI-ready state.apps/web/src/components/UpdaterPopup.tsxremains the ready-update surface in the left rail.apps/web/src/components/UpdateDialog.tsxowns the explicit macOS app-menu check flow. All visible copy and native menu labels must go throughapps/web/src/i18n.packages/launcher-protoowns launcher pointer, attempt, and desktop-handoff journal shapes plus payload selection.runtime.jsontogether withattempt.jsonis the only payload-version state machine.apps/packaged/src/index.tsdelegates to the selected payload desktop before initializing the outer Electron runtime, then passes packagedappVersionand namespace-scopedupdateRootinto desktop main only when the outer itself must run.apps/daemon/src/sidecar/payload-desktop-handoff.tsowns the historical-outer bridge. It uses the daemon'sSidecarFactoryclient to confirm and shut down the exact outer desktop, thenspawnSidecarto launch the payload generation while preserving the true previous launcher pointer across theprepared→armed→confirmedjournal lifecycle.install.jsoncontinues to identify the physically installed outer executable for recovery. Payload activation or handoff must not rewrite it to a versioned payload executable.tools/serveowns deterministic local updater fixtures only. It must not contain product updater runtime logic.tools/packowns packaged build/install/start/inspect/logs/uninstall/cleanup and the platform installer harness, including Windows NSIS registry observation and cleanup.
Release metadata shape
The runtime updater reads https://releases.open-design.ai/<channel>/latest/metadata.json unless OD_UPDATE_METADATA_URL overrides it. For package-launcher updates:
- A valid packaged-launcher context prefers
platforms.<platform>.artifacts.payload; the platform installer (dmgon macOS orinstalleron Windows) remains the recovery/fallback path. - The artifact must have a checksum, preferably
sha256Url; the updater verifies bytes before exposing an install action. OD_UPDATE_CURRENT_VERSIONmay override the packaged version for tests, but user-flow package validation should prefer building the package with the intended--app-version.- Release metadata may include
releaseNote.content, with adefaultLocaleand locale descriptors containingurl,mediaType,sha256, andsize. The updater does not currently consume this block;tools-releaseowns its publication and verification independently from updater UI behavior. - Release metadata may include
control.launcher.version.{min, url}— the installer-reinstall floor. The updater comparesminagainst the physically installed outer package version (read at check time from the outer bundle'sopen-design-config.jsonvia the launcher launch path;OD_UPDATE_INSTALLED_VERSIONoverrides it for tests), NOT the running payload version — payload updates never touch the outer bundle, so a broken outer generation must reach the installer path even when its payload is current. When the floor trips (orminis set but the outer version is unreadable — conservative), the updater selects the installer artifact and, when no newer release exists, offers a same-version installer reinstall; snapshot fieldreinstallcarries{reason, installedVersion, minVersion, url}and the web UI presents the optional operatorurlas a jump link with default i18n copy as fallback. Publication: channel policy is managed as one repo-vars pair per channel —RELEASE_LAUNCHER_VERSION_MIN_<CHANNEL>+RELEASE_LAUNCHER_VERSION_MIN_URL_<CHANNEL>— passed through workflows verbatim (no YAML fallback expressions) and resolved by the shared resolver intools/release/src/storage/launcher-version-floor.ts: a non-stable channel whose own pair is unset falls back to the STABLE pair as a unit, and format/https/floor validation is applied at that single point.publish-metadatahard-fails whenminexceeds the release version — a floor this release cannot satisfy would make the same-version reinstall offer nag forever.verify-metadatare-resolves the same channel policy and checks the published block against it;summary-metadatasurfaces the floor in the step summary. - The updater exposes a manual disaster-recovery
clear-cacheaction (od:update:clear-cacheIPC, sidecar actionclear-cache, Settings → About "Clear update cache" row with a two-stage inline confirm). It resets one-shot update state (downloaded release, install freeze) back toidle, purgesreleases/,staging/,downloads/, and.back/, removes a stale launcherattempt.jsonplus any non-confirmeddesktop-handoff journal, and deletes non-retained launcher payload versions. Runtimeactive/lastSuccessfulversions, explicitretainedcleanup entries,install.json, and aconfirmedhandoff journal are never touched; locked files defer through the existing cleanup.json retry machinery. An installer helper already spawned by a prior install action is not cancelled. - Release-note source lives at
docs/CHANGELOG/v<full-releaseVersion>/<locale>.md. All channels use the same publication pipeline, while stable additionally requiresenandzh-CNbefore platform builds proceed. - Post-update "what's new" highlights are NOT carried in release
metadata.json. The daemon's/api/whats-newfetches a single hand-curated document on a dedicated R2 bucket (https://whatsnew.open-design.ai/whats-new.json, overridable withOD_WHATS_NEW_URL); the web home surface shows a one-time card driven by that document'sid, not the running version. Operators edit that one file after a release — there is no per-version publish tooling.
Channel identity rules
Channel identity must be stable across install, update install, shortcuts, registry entries, and app data:
- Stable:
Open Design, namespacedefaultor stable release namespace. - Beta Windows:
Open Design Beta, namespacerelease-beta-win, uninstall keyOpen Design-release-beta-win. - Prerelease Windows:
Open Design Prerelease, namespacerelease-prerelease-win, uninstall keyOpen Design-release-prerelease-win. - Preview Windows:
Open Design Preview, namespacerelease-preview-win, uninstall keyOpen Design-release-preview-win. - Beta-like ad hoc namespaces such as
beta-local-floware test namespaces, not the beta channel. They must not be used for user-flow beta validation because they create a different registry key while sharing a confusing display name/path.
If a local release-channel package is meant to be updated by a real feed, build it with the matching release namespace and an older matching --app-version such as --namespace release-beta-win --app-version 0.10.0-beta.1 or --namespace release-prerelease-win --app-version 0.10.0-prerelease.1. Otherwise the installed package and the downloaded package can appear as separate registry entries even though they target the same display name.
Deterministic fixture harness
Use tools-serve start updater for fast, deterministic tests and e2e automation where network release state is not the thing under test. Fixture flow:
pnpm tools-serve start updater --json --channel beta --version 99.0.0-beta.1 --platform win
Then launch packaged desktop with:
OD_UPDATE_ENABLED=1
OD_UPDATE_METADATA_URL=<fixture metadataUrl>
OD_UPDATE_CURRENT_VERSION=99.0.0-beta.0
OD_UPDATE_OPEN_DRY_RUN=1
OD_UPDATE_AUTO_CHECK=1
This harness is appropriate for asserting IPC, popup rendering, progress, checksum/download-store behavior, and dry-run installer opening. It is not a full user-view validation because it replaces the public release feed and uses synthetic artifact bytes.
High-confidence local user-flow acceptance
Use this when validating release-channel behavior before handing a Windows beta build to a human tester. This path intentionally avoids mock services and exercises the selected real beta feed. For the self-hosted release-beta-s lane, the real feed is the Nexu S3 origin configured by release_public_origin, currently https://s3.nexu.space/od-releases.
- Confirm the latest beta metadata first:
curl.exe --ssl-no-revoke -fsSL https://releases.open-design.ai/beta/latest/metadata.json
For release-beta-s, check the internal feed instead:
curl.exe --ssl-no-revoke -fsSL https://s3.nexu.space/od-releases/betas/latest/metadata.json
- Build a non-portable Windows beta package with the real beta namespace and a version lower than latest:
pnpm tools-pack win build --dir C:\odtp-beta-release-fixed --namespace release-beta-win --to nsis --app-version 0.8.0-beta.5 --json
- Give the tester the generated installer:
C:\odtp-beta-release-fixed\out\win\namespaces\release-beta-win\builder\Open Design-release-beta-win-setup.exe
- Expected user flow:
- User installs
0.8.0-beta.5through the NSIS UI. - User launches
Open Design Beta. - App auto-checks the real beta feed and selects the latest Windows launcher payload when the package-launcher context is valid. The installer is the fallback path when the payload artifact or launcher context is unavailable.
- For the payload path, the app downloads
platforms.win.artifacts.payload, verifies sha256, prepares the payload under%APPDATA%\Open Design\launcher\channels\beta\namespaces\release-beta-win\versions\<version>\payload, and shows the web updater popup. - The native Windows File menu must not expose update actions. On macOS, the app menu exposes the state-aware update item and opens the renderer update dialog without making background checks intrusive.
- The updater popup uses i18n strings and download progress must not flash to 100% before real bytes arrive.
- Applying the payload update should quit and relaunch the exact executable under the prepared version's
payloaddirectory, then mark launcheractiveandlastSuccessfulto that version and clearattempt.json. - For a historical outer, the handoff must retain the true previous launcher pointer for fail-closed recovery and terminate with
desktop-handoff.jsonabsent orconfirmed;preparedandarmedare not successful terminal states. - After a full stop, launching the installed shortcut/outer again must still converge on the same active payload desktop and preserve daemon/API behavior, including a real PPTX export.
- If the updater falls back to the installer path, clicking
Open installeropens the real downloaded beta installer. Installing it should overwrite the sameOpen Design-release-beta-winregistry key, not create a second beta key.
- Registry and launcher sanity check after beta.6 update:
Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like 'Open Design*' } |
Select-Object PSChildName,DisplayName,DisplayVersion,InstallLocation
Get-Content "$env:APPDATA\Open Design\launcher\channels\beta\namespaces\release-beta-win\runtime.json"
For a clean beta channel result, expect one beta entry with PSChildName Open Design-release-beta-win and the latest DisplayVersion.
For the payload path, also expect launcher active.version and lastSuccessful.version to match the latest beta version, attempt.json to be absent, and the running desktop executable to resolve below that version's payload directory. desktop-handoff.json may be absent for a current outer or confirmed for a historical outer; prepared and armed are not successful terminal states.
Windows Settings > Apps may cache uninstall metadata within the current view. If Settings still shows the previous beta version after the registry query is correct, switch away from the Apps view and back, or reopen Settings, before treating it as an installer failure. The registry query above is the source of truth for this harness.
- Avoid leaving validation residue. Stop running app processes first, then use tools-pack uninstall/cleanup for tool-managed namespaces. Only delete explicit temp roots after verifying the resolved path is exactly the intended directory.
--diris an output/runtime root, not the default cache root. Do not add--cache-dirto routine validation; it is an escape hatch for cache isolation or cold-cache validation only.
pnpm tools-pack win stop --dir C:\odtp-beta-release-fixed --namespace release-beta-win --json
pnpm tools-pack win uninstall --dir C:\odtp-beta-release-fixed --namespace release-beta-win --remove-product-user-data --remove-data --remove-logs --remove-sidecars --json
pnpm tools-pack win cleanup --dir C:\odtp-beta-release-fixed --namespace release-beta-win --remove-product-user-data --remove-data --remove-logs --remove-sidecars --json
Validation matrix for updater changes
docs/testing/updater-lifecycle.md is the full lifecycle-to-test coverage map (including deliberate manual-only nodes); consult it to find the owning tests for the node you touched, then run the narrow tests plus the repo checks:
pnpm --filter @open-design/desktop test -- tests/main/updater.test.ts tests/main/updater-host-boundary.test.ts tests/main/preload-host-boundary.test.ts
pnpm --filter @open-design/web test -- tests/components/UpdaterPopup.test.tsx tests/lib/updater.test.ts
pnpm --filter @open-design/tools-serve test
pnpm --filter @open-design/tools-pack test -- tests/win-identity.test.ts tests/win-app.test.ts tests/win-builder.test.ts
pnpm --filter @open-design/desktop typecheck
pnpm --filter @open-design/web typecheck
pnpm --filter @open-design/tools-pack typecheck
pnpm --filter @open-design/tools-serve typecheck
git diff --check
pnpm guard
pnpm typecheck
Run the high-confidence local user-flow acceptance whenever a change touches real release feed selection, channel identity, Windows registry/install behavior, installer opening, or visible updater UI behavior.
For launcher payload or handoff changes, also run the platform full spec. The full profile must validate exact desktop executable identity, a real PPTX response, a complete stop followed by an installed-outer cold start, and the same checks again after restart. Windows beta full validation must use release-beta-win; a beta-like local namespace is not equivalent delivery evidence.