Files
deepseek-harness/apps/desktop/scripts/desktop-build-version.d.mts
T
winewill 1b6451a647 fix(desktop): follow the documented release version rules
Review found that `apps/desktop/README.md#release-versions` and the
2026-09-16 version-derivation note already specify this convention, and
that three of their requirements were reversed without saying so. The
rules themselves are right; what was wrong was leaving them undocumented
and rejecting one of the forms they prescribe.

A stable base takes `-test.YYYYMMDD.index`, which validation refused
because such a version ranks below its base. That ordering is the point:
the form belongs to a test feed that never serves the production
release. Both READMEs, the older note, and a new note now record which
requirements this change reverses and why.

Three defects the review found, each reproducible:

- `afterPack` compared the bundled runtime against the product version,
  which broke installed-update qualification: that flow passes a runtime
  whose version was deliberately rewritten. The expected version is now
  a parameter the preparer supplies, and `verifyDesktopRuntime` says
  "bundled X is not the expected Y" rather than naming Electron.
- Upload could only learn the published version from a shell variable,
  conflicting with "release fields come only from the target file". It
  reads the completion record packaging wrote, and a mismatch now prints
  the version that record holds.
- Automatic numbering read one listing page and one fixed directory. It
  now follows every page, discards a listing it could not finish rather
  than reusing an index that would overwrite a published installer,
  bounds the request through the client's own timeout, and reads the
  directory an unsigned build actually writes.

Also: `npm run` and `yarn run` set `npm_execpath` too, so the pnpm
resolution checks the path names pnpm; the argument separator can arrive
after a run script's preset arguments, not only first; and the toolchain
probe, parser, build commit, and tarball readers now have specs.
2026-09-21 16:04:08 +08:00

26 lines
1.2 KiB
TypeScript

/** Environment variable that carries the build version through one packaging and upload run. */
export const DESKTOP_BUILD_VERSION_ENV: 'DSH_DESKTOP_BUILD_VERSION'
/**
* Validate a build version against the product version it extends.
* @param buildVersion - Version this build publishes.
* @param productVersion - Version the manifests declare.
* @returns The version as semver normalizes it, which is what the artifacts will carry.
*/
export function validateDesktopBuildVersion(buildVersion: string, productVersion: string): string
/**
* Resolve the version a build publishes.
* @param env - Packaging or upload environment.
* @param productVersion - Version the manifests declare.
* @returns The build version when one is present, otherwise the product version.
*/
export function resolveDesktopBuildVersion(env: NodeJS.ProcessEnv, productVersion: string): string
/**
* Everything a build version carries before its date, including the trailing separator.
* @param productVersion - Version the manifests declare.
* @returns The prefix shared by every build version of that product version.
*/
export function desktopBuildVersionPrefix(productVersion: string): string