From fd7d7387d06cb0f933842f907188349cb2631d5d Mon Sep 17 00:00:00 2001 From: Zoltan Csizmadia Date: Thu, 10 Sep 2026 20:48:14 -0500 Subject: [PATCH] fix: do not tell CI builds they are too old `hawser version --json` reports `0.0.0-ci` on pull-request builds and `0.0.0-dryrun` on a release dry run -- hawser's release workflow stamps those deliberately to mean "not a release". The version check exempted only the literal string `dev`, so both parsed as 0.0.0, compared below every minimum, and anyone testing a CI artifact was warned their hawser was too old when the version only ever meant it was not a release. Replace the `!== 'dev'` test with isRelease(), which also treats a 0.0.0 prefix as not-a-release. Genuinely old releases still warn: 0.2.0 and 0.2.0-9-gabc-dev are unaffected, and a local source build (0.3.0-50-g...-dev) was already quiet because the comparison splits on "-" as well as "." and so reads the extra segments as greater. Found while checking this extension against a freshly built hawser: the CLI contract itself is unchanged (status/version --json fields all still in their declared unions), so this was the only drift. --- src/extension.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 03a2871..1c314df 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -64,8 +64,7 @@ function schedule(): void { async function checkVersion(): Promise { try { const v = await hawser.version(); - // A source build reports "dev"; that is never too old. - if (v.app !== 'dev' && compare(v.app, MIN_HAWSER) < 0) { + if (isRelease(v.app) && compare(v.app, MIN_HAWSER) < 0) { void vscode.window.showWarningMessage( `Hawser ${v.app} found; this extension expects ${MIN_HAWSER} or newer. Some features may not work.`, ); @@ -76,6 +75,20 @@ async function checkVersion(): Promise { } } +/** + * Whether a reported version is a release at all, and so worth comparing + * against MIN_HAWSER. + * + * Two builds are not: a source build reports `dev`, and hawser's release + * workflow stamps `0.0.0-ci` on pull-request builds and `0.0.0-dryrun` on a + * dry run. Those parse as 0.0.0, which is below every minimum, so anyone + * testing a CI artifact was told their hawser was too old when the version + * only ever meant "not a release". + */ +function isRelease(version: string): boolean { + return version !== 'dev' && !version.startsWith('0.0.0'); +} + /** Compares dotted versions; non-numeric segments compare as 0. */ function compare(a: string, b: string): number { const parse = (s: string) => s.split(/[.-]/).map((n) => parseInt(n, 10) || 0);