Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

tech(M6): Release-Pipeline testet, taggt und prüft ehrlich — vier Löcher zu

David6a472f16496e
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7700e575..b0917c98 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,6 +5,19 @@ on:
branches: [master]
pull_request:
branches: [master]
+ # release.yml calls this same workflow as its gate, so the release is held to
+ # exactly the checks master is held to — one definition, no drift between
+ # "what CI runs" and "what a release had to pass".
+ workflow_call:
+ inputs:
+ ref:
+ description: >-
+ Commit-ish to check out. Empty (push/pull_request) keeps actions/checkout's
+ default, which is the commit that triggered the run. release.yml passes the
+ release tag, so the gate reads the same bytes the installer is built from.
+ required: false
+ type: string
+ default: ''
# Third-party actions are pinned to a full commit SHA (not a moving tag) so a
# compromised or retagged upstream release can't silently run in our CI with
@@ -17,6 +30,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+ with:
+ # Empty on push/pull_request (checkout falls back to the triggering
+ # commit); the release tag when release.yml calls this workflow.
+ ref: ${{ inputs.ref }}
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
@@ -50,6 +67,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+ with:
+ # Empty on push/pull_request (checkout falls back to the triggering
+ # commit); the release tag when release.yml calls this workflow.
+ ref: ${{ inputs.ref }}
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
@@ -77,9 +98,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+ with:
+ # Empty on push/pull_request (checkout falls back to the triggering
+ # commit); the release tag when release.yml calls this workflow.
+ ref: ${{ inputs.ref }}
- name: Install Rust stable
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
+ with:
+ components: clippy
- name: Rust cache
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
@@ -109,6 +136,11 @@ jobs:
# externalBin file is missing — cargo check needs the sidecar file to
# EXIST, not to work. Stub it so the check doesn't pay a 20-min llama
# build; the real binaries are built in release.yml + sidecar-windows.yml.
+ #
+ # The same empty file is enough for `cargo test` and `cargo clippy`: they
+ # run the identical build.rs, and no test executes the sidecar. The few
+ # tests that need a live inference server are already #[ignore]d for
+ # exactly that reason (see commands/remote.rs, commands/install.rs).
- name: Stub llama-server sidecar for cargo check
shell: bash
run: |
@@ -123,3 +155,24 @@ jobs:
- name: Cargo check
working-directory: src-tauri
run: cargo check
+
+ # 539 Rust tests lived in the tree while CI only ever type-checked them.
+ # They are unit tests over pure logic and short-lived child processes —
+ # the whole suite runs in seconds once the crate is built, so there is no
+ # cost argument for leaving them out.
+ - name: Cargo test
+ working-directory: src-tauri
+ run: cargo test
+
+ # Non-gating for now, on purpose. Today's baseline (stable 1.95) is ~65
+ # warnings plus ONE deny-by-default error: `absurd_extreme_comparisons`
+ # at src/commands/secret.rs:108, where MAX_UNITS is usize::MAX on every
+ # non-Windows target, so `count() <= MAX_UNITS` is always true. That
+ # single line makes `cargo clippy` exit non-zero on the ubuntu lane even
+ # WITHOUT -D warnings, so gating it here would turn CI red on arrival for
+ # a debt this job did not create. Keep the list visible, pay it down, then
+ # drop continue-on-error and add `-- -D warnings`.
+ - name: Clippy (non-gating — pre-existing debt)
+ working-directory: src-tauri
+ run: cargo clippy --all-targets
+ continue-on-error: true
diff --git a/.github/workflows/discord-announce.yml b/.github/workflows/discord-announce.yml
index 02a1e19e..811c218e 100644
--- a/.github/workflows/discord-announce.yml
+++ b/.github/workflows/discord-announce.yml
@@ -33,24 +33,63 @@ jobs:
# matches our normal build time (~11 min for Windows + Linux parallel).
runs-on: ubuntu-latest
steps:
- - name: Wait for tauri artifacts
+ - name: Wait for tauri artifacts from THIS run
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
+ EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
- echo "Waiting for $TAG installers to appear on the release…"
+ # Counting asset FILENAMES was never a check that the binaries exist —
+ # only that four files with the right suffixes are attached, no matter
+ # who put them there or when. On 2026-08-15 the Linux lane hung for six
+ # hours and was killed, so that run attached Windows assets only; the
+ # AppImage/.deb from the previous run were still hanging on the release,
+ # the count reached 4, and the announcement went out for installers that
+ # did not contain the code it was announcing. Assets therefore have to
+ # be tied to THIS run: only ones uploaded after the cutoff below count.
+ #
+ # Read through the REST API rather than `gh release view`: the asset
+ # objects there are documented to carry created_at/updated_at, which is
+ # the whole basis of the check.
+ if [ "$EVENT_NAME" = "release" ]; then
+ # The release publish is what started this run, so the installers are
+ # still being built — everything already attached predates this run.
+ CUTOFF=$(date -u +%s)
+ else
+ # Manual announce of a release that is already built: nothing new will
+ # be uploaded, so the bar is "uploaded for this release at all", which
+ # still rejects files carried over from an earlier release.
+ published=$(gh api "repos/$GH_REPO/releases/tags/$TAG" --jq '.published_at // .created_at')
+ CUTOFF=$(date -u -d "$published" +%s)
+ fi
+ echo "Counting only installers uploaded at/after $(date -u -d "@$CUTOFF" +%Y-%m-%dT%H:%M:%SZ)."
+
+ rel_json="$RUNNER_TEMP/release.json"
for i in $(seq 1 72); do
- count=$(gh release view "$TAG" --json assets --jq '[.assets[] | select(.name | test("setup\\.exe$|\\.msi$|\\.AppImage$|\\.deb$|\\.rpm$"))] | length')
- if [ "$count" -ge 4 ]; then
- echo "Found $count installer artifacts — proceeding."
+ gh api "repos/$GH_REPO/releases/tags/$TAG" > "$rel_json"
+ fresh=$(jq --argjson cutoff "$CUTOFF" '
+ [ .assets[]
+ | select(.name | test("setup\\.exe$|\\.msi$|\\.AppImage$|\\.deb$|\\.rpm$"))
+ | select(.state == "uploaded")
+ | select(((.created_at // .updated_at // "1970-01-01T00:00:00Z") | fromdateiso8601) >= $cutoff)
+ ] | length' "$rel_json")
+ if [ "$fresh" -ge 4 ]; then
+ echo "Found $fresh installer assets from this run — proceeding."
exit 0
fi
- echo " ($i/72) only $count so far, sleeping 10s…"
+ echo " ($i/72) $fresh installers from this run so far, sleeping 10s…"
sleep 10
done
- echo "Timeout waiting for artifacts — announcing anyway."
+
+ # Deliberately NOT "announcing anyway": announcing regardless is what
+ # turned a half-failed build into a public post about binaries nobody
+ # had built. A late announcement costs nothing; a wrong one is shipped.
+ echo "Assets currently on $TAG:"
+ jq -r '.assets[] | " \(.name) state=\(.state) created_at=\(.created_at)"' "$rel_json" || true
+ echo "::error::$TAG has no 4 installers from this run after 12 minutes — refusing to announce."
+ exit 1
announce:
needs: wait-for-build
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e9d6ba42..7541bd4a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,7 +30,22 @@ env:
VULKAN_SDK_VERSION: '1.4.313.2'
jobs:
+ # A build is not a decision — and neither is a green master. Until this job
+ # existed, `release.yml` typechecked nothing, ran no test and no lint: any
+ # commit that happened to sit on master when someone clicked "Publish release"
+ # became a signed installer, and the updater handed it to every install.
+ #
+ # Reusing ci.yml instead of restating its steps is deliberate: the release is
+ # then held to EXACTLY the checks master is held to, and a check added to CI
+ # can never silently skip the release path. `ref` pins the gate to the tagged
+ # commit, so what is verified and what is built are the same bytes.
+ gate:
+ uses: ./.github/workflows/ci.yml
+ with:
+ ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
+
build-tauri:
+ needs: gate
strategy:
fail-fast: false
matrix:
@@ -53,10 +68,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
- # Build from the release's target branch (master) instead of the tag ref.
- # Prevents shipping a stale snapshot when fixes land after tag creation
- # but before the release is published.
- ref: ${{ github.event.release.target_commitish || 'master' }}
+ # The tag, and only the tag. `target_commitish` is a BRANCH name, so
+ # the old value built whatever master happened to point at when the
+ # runner started — the tag then named one commit while the signed
+ # installer contained another, and nothing recorded which. That breaks
+ # the one thing a release tag is for (and AGPL-3.0 §6: the
+ # "corresponding source" must be the source the binary was made from).
+ # If fixes land after tagging, move the tag; do not silently ship past it.
+ ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
@@ -218,4 +237,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
+ # Set only when a release publish started this run. Empty on
+ # workflow_dispatch, where the Latest flag is a human's verdict and
+ # must survive. See scripts/release-rules.mjs.
+ PUBLISHED_TAG: ${{ github.event.release.tag_name }}
run: node scripts/enforce-prerelease.mjs
diff --git a/scripts/enforce-prerelease.mjs b/scripts/enforce-prerelease.mjs
index 1b11c001..fe670065 100644
--- a/scripts/enforce-prerelease.mjs
+++ b/scripts/enforce-prerelease.mjs
@@ -12,10 +12,16 @@
* within minutes. That is exactly the 2026-08-10 incident the comment in
* release.yml describes as fixed.
*
- * Idempotent, and it can never undo a deliberate flip: the release that IS
- * Latest is left alone.
+ * Idempotent, and it can never undo a deliberate flip. Note that "deliberate"
+ * cannot be read off the Latest flag alone: GitHub points Latest at any full
+ * release the moment it is published, so inside the run that published it, the
+ * flag means nothing. PUBLISHED_TAG carries the tag from this run's
+ * `release: published` event; when it names the release we are looking at, the
+ * release was published seconds ago and cannot have been verified, so it goes
+ * back to prerelease. Outside that case the Latest flag is a human's verdict
+ * and is left alone.
*
- * Usage: TAG=v2.6.5 node scripts/enforce-prerelease.mjs
+ * Usage: TAG=v2.6.5 [PUBLISHED_TAG=v2.6.5] node scripts/enforce-prerelease.mjs
*/
import { shouldForcePrerelease } from './release-rules.mjs'
@@ -50,8 +56,16 @@ const rel = await api(`/releases/tags/${tag}`)
// A repo whose only release is this one has no `latest` to compare against.
const latest = await api('/releases/latest').catch(() => null)
-if (!shouldForcePrerelease(rel, latest)) {
- console.log(`${tag} needs nothing: prerelease=${rel.prerelease}, draft=${rel.draft}, isLatest=${rel.id === latest?.id}`)
+// Empty unless a `release: published` event started this run, and then it is
+// that release's tag — the one thing that distinguishes "GitHub flagged this
+// Latest by itself, just now" from "a human flipped it after checking it".
+const publishedByThisRun = !!process.env.PUBLISHED_TAG && process.env.PUBLISHED_TAG === tag
+
+if (!shouldForcePrerelease(rel, latest, { publishedByThisRun })) {
+ console.log(
+ `${tag} needs nothing: prerelease=${rel.prerelease}, draft=${rel.draft}, ` +
+ `isLatest=${rel.id === latest?.id}, publishedByThisRun=${publishedByThisRun}`,
+ )
process.exit(0)
}
diff --git a/scripts/release-rules.d.mts b/scripts/release-rules.d.mts
index 4e1d97f4..7f4b1d8d 100644
--- a/scripts/release-rules.d.mts
+++ b/scripts/release-rules.d.mts
@@ -20,7 +20,14 @@ export declare function shouldCarryBanner(
latest: GitHubRelease | null | undefined,
): boolean
+export interface ForcePrereleaseContext {
+ /** True when this run's own `release: published` event named this release —
+ * it was published seconds ago, so it cannot have been verified yet. */
+ publishedByThisRun?: boolean
+}
+
export declare function shouldForcePrerelease(
rel: GitHubRelease | null | undefined,
latest: GitHubRelease | null | undefined,
+ ctx?: ForcePrereleaseContext,
): boolean
diff --git a/scripts/release-rules.mjs b/scripts/release-rules.mjs
index 99553781..87065a69 100644
--- a/scripts/release-rules.mjs
+++ b/scripts/release-rules.mjs
@@ -60,13 +60,33 @@ export function shouldCarryBanner(rel, latest) {
* Latest with the download routes and every updater following within minutes.
* That is the 2026-08-10 incident the comment says was fixed.
*
- * The rule is the same one the banner uses, from the other side: a release
- * that is not the flagged Latest has not been verified yet, so it belongs in
- * prerelease. The deliberate flip to Latest is what takes it out, and this
- * must never undo that flip.
+ * The question this answers is "has a human verified this release?", NOT "is it
+ * already Latest". Those look the same and are not: GitHub moves the Latest
+ * pointer to any published full release BY ITSELF, immediately, with nobody
+ * deciding anything. So the first version of this rule — `rel.id === latest.id
+ * -> leave it alone` — was a guaranteed no-op in exactly the case it was
+ * written for: a release published as a full release IS already Latest by the
+ * time this job runs, the guard fired, and the release nobody had opened kept
+ * the Latest flag and the updater traffic that comes with it.
+ *
+ * Verification happens on a real machine AFTER this build produced installers,
+ * so nothing this run publishes can be verified yet: `publishedByThisRun` (the
+ * `release: published` event that started this run names this same release)
+ * means force it back, whatever the Latest pointer says.
+ *
+ * The deliberate flip stays safe: on a manual re-run over some older tag no
+ * release event named it, `publishedByThisRun` is false, and a release that is
+ * the flagged Latest is left alone — that flag is then a human's verdict.
+ *
+ * @param {object|null|undefined} rel the release this build belongs to
+ * @param {object|null|undefined} latest `/releases/latest`, or null if none
+ * @param {{publishedByThisRun?: boolean}} [ctx] run context, see above
*/
-export function shouldForcePrerelease(rel, latest) {
+export function shouldForcePrerelease(rel, latest, ctx = {}) {
if (!rel || rel.prerelease === true || rel.draft === true) return false
+ // Published by the event that started this run: not verified, by definition.
+ if (ctx.publishedByThisRun === true) return true
+ // Otherwise the Latest flag is somebody's deliberate choice — never undo it.
if (latest && rel.id === latest.id) return false
return true
}
diff --git a/src/lib/__tests__/release-rules.test.ts b/src/lib/__tests__/release-rules.test.ts
index 74d0de97..dbe6e043 100644
--- a/src/lib/__tests__/release-rules.test.ts
+++ b/src/lib/__tests__/release-rules.test.ts
@@ -105,9 +105,41 @@ describe('a build is not a decision, on every trigger', () => {
})
it('the release that IS Latest is never touched, or the flip would undo itself', () => {
+ // No release event named it: this is a manual re-run over a tag somebody
+ // already verified and flipped, and that flag is their verdict.
expect(shouldForcePrerelease(latest, latest)).toBe(false)
})
+ // THE case the job exists for, and the one the first version of the rule could
+ // never reach. Publishing a release as a full release makes GitHub point
+ // Latest at it immediately and by itself — so by the time this job runs,
+ // `rel.id === latest.id` is already true and the old `isLatest -> leave it
+ // alone` guard fired every single time. The check was a guaranteed no-op in
+ // its own core case: the release nobody had opened kept Latest, the download
+ // routes and every updater followed it, which is the 2026-08-10 incident.
+ it('a full release that this run just published is forced back EVEN THOUGH GitHub already made it Latest', () => {
+ const justPublished = rel({ id: 42, tag_name: 'v2.6.5', prerelease: false })
+ // `/releases/latest` answers with this very release — automatically.
+ expect(shouldForcePrerelease(justPublished, justPublished, { publishedByThisRun: true })).toBe(true)
+ })
+
+ it('the same release, seen by a later manual re-run, is left alone', () => {
+ // Same inputs minus the release event: now being Latest means a human
+ // verified it, and demoting it would undo their flip.
+ const verified = rel({ id: 42, tag_name: 'v2.6.5', prerelease: false })
+ expect(shouldForcePrerelease(verified, verified, { publishedByThisRun: false })).toBe(false)
+ })
+
+ it('a prerelease this run published is already where it belongs', () => {
+ const fresh = rel({ id: 43, prerelease: true })
+ expect(shouldForcePrerelease(fresh, latest, { publishedByThisRun: true })).toBe(false)
+ })
+
+ it('a draft this run published is still left alone', () => {
+ const draft = rel({ id: 44, draft: true })
+ expect(shouldForcePrerelease(draft, latest, { publishedByThisRun: true })).toBe(false)
+ })
+
it('a release already marked prerelease needs nothing', () => {
expect(shouldForcePrerelease(rel({ id: 4, prerelease: true }), latest)).toBe(false)
})
@@ -141,4 +173,49 @@ describe('the workflow actually calls it', () => {
const job = wf.slice(wf.indexOf('enforce-prerelease:'))
expect(job).toContain('if: always()')
})
+
+ it('and knows whether a release event started the run', () => {
+ // Without this the job cannot tell GitHub's automatic Latest pointer from
+ // a human's deliberate flip, and falls back to doing nothing.
+ expect(wf).toContain('PUBLISHED_TAG: ${{ github.event.release.tag_name }}')
+ })
+})
+
+// The release path used to run no check at all: no tsc, no vitest, no cargo —
+// whatever sat on master when someone clicked Publish became a signed installer.
+describe('nothing is built before it is checked', () => {
+ const wf = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../../.github/workflows/release.yml'), 'utf8',
+ )
+
+ it('the gate is CI itself, so a check added to CI cannot skip the release', () => {
+ expect(wf).toContain('uses: ./.github/workflows/ci.yml')
+ })
+
+ it('and the build waits for it', () => {
+ const job = wf.slice(wf.indexOf('build-tauri:'))
+ expect(job).toContain('needs: gate')
+ })
+
+ it('the gate reads the tagged commit, not whatever the branch points at', () => {
+ expect(wf).toContain("ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}")
+ // target_commitish is a BRANCH name: building it means the tag names one
+ // commit and the signed installer contains another (AGPL-3.0 §6 as well).
+ expect(wf).not.toContain('github.event.release.target_commitish')
+ })
+})
+
+// The Rust suite existed for months while CI only type-checked it.
+describe('CI runs the Rust tests it has', () => {
+ const ci = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../../.github/workflows/ci.yml'), 'utf8',
+ )
+
+ it('cargo test, not just cargo check', () => {
+ expect(ci).toContain('run: cargo test')
+ })
+
+ it('and is callable as a gate', () => {
+ expect(ci).toContain('workflow_call:')
+ })
})