From 656dd1e68f02a8acc8d7a6eca41e13ffecd3b032 Mon Sep 17 00:00:00 2001 From: Daniel Petro <45949032+WellDunDun@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:23:11 +0300 Subject: [PATCH 1/3] chore: export from selftune-cloud-app --- .changeset/changed-only-metric-rollups.md | 5 + .changeset/stable-installed-mac-service.md | 5 + .github/release-notes.json | 18 ++++ apps/desktop/package.json | 2 +- .../src/main/background-service.test.ts | 33 +++++- apps/desktop/src/main/background-service.ts | 12 +++ apps/desktop/src/main/desktop-runtime-live.ts | 8 +- bun.lock | 8 +- package.json | 2 +- packages/observability/src/duckdb-node-api.ts | 3 +- packages/observability/src/duckdb-store.ts | 48 ++------- .../src/historical-rollup-sql.ts | 30 ++++++ skill/SKILL.md | 2 +- .../rollup-write-amplification.test.ts | 100 ++++++++++++++++++ .../observability/storage-inspection.test.ts | 8 +- 15 files changed, 234 insertions(+), 50 deletions(-) create mode 100644 .changeset/changed-only-metric-rollups.md create mode 100644 .changeset/stable-installed-mac-service.md create mode 100644 packages/observability/src/historical-rollup-sql.ts create mode 100644 tests/observability/rollup-write-amplification.test.ts diff --git a/.changeset/changed-only-metric-rollups.md b/.changeset/changed-only-metric-rollups.md new file mode 100644 index 00000000..a5ba16e9 --- /dev/null +++ b/.changeset/changed-only-metric-rollups.md @@ -0,0 +1,5 @@ +--- +"@selftune/desktop": patch +--- + +Preserve unchanged historical metric rollups during source revisions instead of deleting and reinserting the same values and indexes. Keep changed-value corrections, removed points, surviving older observations, and unrelated retained history correct. diff --git a/.changeset/stable-installed-mac-service.md b/.changeset/stable-installed-mac-service.md new file mode 100644 index 00000000..077b7b9a --- /dev/null +++ b/.changeset/stable-installed-mac-service.md @@ -0,0 +1,5 @@ +--- +"@selftune/desktop": patch +--- + +Register the macOS background service from the signed app bundle when SelfTune is installed in Applications. Updating the app no longer moves that service to a new version-specific executable path. Temporary Mac app copies, Windows, and Linux retain the extracted runtime. diff --git a/.github/release-notes.json b/.github/release-notes.json index 3861f631..56319779 100644 --- a/.github/release-notes.json +++ b/.github/release-notes.json @@ -3,6 +3,24 @@ "generatedFrom": "sites/docs/changelog.mdx", "docsUrl": "https://docs.selftune.dev/changelog", "entries": [ + { + "label": "2026-10-24", + "description": "v0.5.3", + "tags": ["Desktop", "CLI"], + "rss": { + "title": null, + "description": null + }, + "bullets": [ + "Replace only changed or removed summaries, preserving unrelated history and raw evidence.", + "Report the highest numeric migration version in read-only storage inspection, so schema 12 is not misreported as schema 9.", + "Keep the macOS background service inside the signed app bundle when SelfTune is installed in Applications, avoiding version-specific service paths on update." + ], + "versionRange": { + "from": "0.5.3", + "to": "0.5.3" + } + }, { "label": "2026-10-21", "description": "Desktop update runtime", diff --git a/apps/desktop/package.json b/apps/desktop/package.json index e0d05998..83cb64e7 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@selftune/desktop", - "version": "0.5.1", + "version": "0.5.2", "private": true, "description": "Native desktop control plane for SelfTune skill observability and improvement", "homepage": "https://selftune.dev", diff --git a/apps/desktop/src/main/background-service.test.ts b/apps/desktop/src/main/background-service.test.ts index 7c20fbd1..37c1a5a4 100644 --- a/apps/desktop/src/main/background-service.test.ts +++ b/apps/desktop/src/main/background-service.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { buildBackgroundServiceArgs, parseBackgroundServiceResponse } from "./background-service"; +import { + backgroundServiceResourceDirectory, + buildBackgroundServiceArgs, + parseBackgroundServiceResponse, +} from "./background-service"; const options = { executablePath: "/Applications/SelfTune.app/Contents/Resources/selftune/selftune", @@ -10,6 +14,33 @@ const options = { }; describe("background service CLI adapter", () => { + const directories = { + resourcesPath: "/Applications/SelfTune.app/Contents/Resources", + installedRuntimeDirectory: "/Users/test/Library/Application Support/SelfTune/runtime/0.5.3", + }; + + it("keeps an installed macOS service inside its signed app bundle across updates", () => { + expect( + backgroundServiceResourceDirectory({ + ...directories, + platform: "darwin", + inApplicationsFolder: true, + }), + ).toBe("/Applications/SelfTune.app/Contents/Resources/selftune"); + }); + + it("retains extracted runtimes for temporary Mac apps and other platforms", () => { + for (const platform of ["darwin", "linux", "win32"] satisfies NodeJS.Platform[]) { + expect( + backgroundServiceResourceDirectory({ + ...directories, + platform, + inApplicationsFolder: false, + }), + ).toBe(directories.installedRuntimeDirectory); + } + }); + it("delegates installation to the single bundled SelfTune runtime", () => { expect(buildBackgroundServiceArgs(options, "install")).toEqual([ "service", diff --git a/apps/desktop/src/main/background-service.ts b/apps/desktop/src/main/background-service.ts index 06b6fc44..4acc9a78 100644 --- a/apps/desktop/src/main/background-service.ts +++ b/apps/desktop/src/main/background-service.ts @@ -1,4 +1,5 @@ import { execFile } from "node:child_process"; +import { join } from "node:path"; import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; @@ -22,6 +23,17 @@ export interface BackgroundServiceOptions { readonly version: string; } +export function backgroundServiceResourceDirectory(options: { + readonly platform: NodeJS.Platform; + readonly inApplicationsFolder: boolean; + readonly resourcesPath: string; + readonly installedRuntimeDirectory: string; +}): string { + return options.platform === "darwin" && options.inApplicationsFolder + ? join(options.resourcesPath, "selftune") + : options.installedRuntimeDirectory; +} + type BackgroundServiceAction = "install" | "restart" | "start" | "status" | "stop" | "uninstall"; export class BackgroundServiceFailure extends Schema.TaggedError()( diff --git a/apps/desktop/src/main/desktop-runtime-live.ts b/apps/desktop/src/main/desktop-runtime-live.ts index 61840b41..43ebc29d 100644 --- a/apps/desktop/src/main/desktop-runtime-live.ts +++ b/apps/desktop/src/main/desktop-runtime-live.ts @@ -5,6 +5,7 @@ import { join } from "node:path"; import { app, dialog } from "electron"; import * as Schema from "effect/Schema"; import { + backgroundServiceResourceDirectory, getBackgroundServiceStatus, installBackgroundService, restartBackgroundService, @@ -59,7 +60,12 @@ function writeBackgroundPreference(configDir: string, enabled: boolean): void { } function backgroundServiceOptions(configDir: string): BackgroundServiceOptions { - const resourceDir = installedRuntimeRoot(); + const resourceDir = backgroundServiceResourceDirectory({ + platform: process.platform, + inApplicationsFolder: process.platform === "darwin" && app.isInApplicationsFolder(), + resourcesPath: process.resourcesPath, + installedRuntimeDirectory: installedRuntimeRoot(), + }); const executable = process.platform === "win32" ? "selftune.exe" : "selftune"; return { executablePath: join(resourceDir, executable), diff --git a/bun.lock b/bun.lock index 9745abba..e56c78c6 100644 --- a/bun.lock +++ b/bun.lock @@ -85,7 +85,7 @@ }, "apps/desktop": { "name": "@selftune/desktop", - "version": "0.5.1", + "version": "0.5.2", "dependencies": { "@selftune/config": "workspace:*", "@sentry/electron": "^7.8.0", @@ -740,7 +740,7 @@ "@effect/vitest": ["@effect/vitest@4.0.0-rc.115", "", { "peerDependencies": { "effect": "^4.0.0-rc.115", "vitest": ">=5.0.0 <6.0.0" } }, "sha512-DJR0hfdr3HNXAkzW8AzfvUz6VmrNFLrKk9tZGDURi33faMyxkc7ZewxELMMZwGpOTGN4mfqYVbX2CXgI+ZJBeQ=="], - "@electron-internal/extract-zip": ["@electron-internal/extract-zip@1.0.5", "", {}, "sha512-+bqFCP98pLI0Tt0XQo1TmlXtwjWchISndDOxCkEcIuUgXWpBnLyRI+2DU+mesvnMMX6L1XDqYNA0lXNDHd/yiA=="], + "@electron-internal/extract-zip": ["@electron-internal/extract-zip@1.0.6", "", {}, "sha512-/aQLgFDdCSnwChfUwqekSmE1q2dCTzhUy5saIHBb5vyYn5LzWaKPaIz1wM0lDMCZYBoIG4svJNvAJb6vkI8BuA=="], "@electron/asar": ["@electron/asar@3.4.1", "", { "dependencies": { "commander": "^5.0.0", "glob": "^7.1.6", "minimatch": "^3.0.4" }, "bin": { "asar": "bin/asar.js" } }, "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA=="], @@ -1148,7 +1148,7 @@ "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], - "@rollup/pluginutils": ["@rollup/pluginutils@5.4.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg=="], + "@rollup/pluginutils": ["@rollup/pluginutils@5.5.1", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-P9ZvnfouRu4MSC+ilERaw6FmZs8zqKhpHxEs4aGDGWQAMzQGXnhvCSvoNwokfNvdt7t3Y5Y4p6gStQgezeIqug=="], "@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="], @@ -3036,8 +3036,6 @@ "storybook/open": ["open@10.2.0", "", { "dependencies": { "default-browser": "^5.2.1", "define-lazy-prop": "^3.0.0", "is-inside-container": "^1.0.0", "wsl-utils": "^0.1.0" } }, "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA=="], - "storybook/ws": ["ws@8.21.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw=="], - "string-width/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], "temp-file/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], diff --git a/package.json b/package.json index ec5e8fbd..f9cef2ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selftune", - "version": "0.5.1", + "version": "0.5.2", "description": "Skill-level observability and self-improvement for AI agents — monitors skill routing, detects missed triggers, and evolves descriptions automatically", "keywords": [ "agent", diff --git a/packages/observability/src/duckdb-node-api.ts b/packages/observability/src/duckdb-node-api.ts index c396e217..d1d35385 100644 --- a/packages/observability/src/duckdb-node-api.ts +++ b/packages/observability/src/duckdb-node-api.ts @@ -314,7 +314,8 @@ export async function inspectAnalyticalStorage(databasePath: string) { ? Schema.decodeUnknownSync(Schema.Array(StoredSchemaVersion))( await ( await connection.run(`SELECT CAST(version AS VARCHAR) AS version - FROM main.observability_schema_migrations ORDER BY version DESC LIMIT 1`) + FROM main.observability_schema_migrations + ORDER BY main.observability_schema_migrations.version DESC LIMIT 1`) ).getRowObjects(), )[0]?.version : undefined; diff --git a/packages/observability/src/duckdb-store.ts b/packages/observability/src/duckdb-store.ts index 88b66ae1..bb35aa5b 100644 --- a/packages/observability/src/duckdb-store.ts +++ b/packages/observability/src/duckdb-store.ts @@ -16,6 +16,7 @@ import { sourceIdentityMigration, } from "./durable-summary-sql.js"; import { SourceIdentities, sourceIdentityKey } from "./source-identity.js"; +import { reconcileRevisedMetricRollups } from "./historical-rollup-sql.js"; import { SourceReconstruction, sourceDigest, @@ -1456,11 +1457,15 @@ const ingestBatch = Effect.fn("DuckDbAnalyticalStore.ingest")(function* ( point.source_reference, ]), ); - // The input schema bounds points at 256 and the reducer only removes rows, - // so normal ingest never reads the unbounded raw-point corpus here. - yield* runStatement( - connection, - `INSERT INTO observability_historical_metric_rollups ( + if (disposition === "revised") { + for (const statement of reconcileRevisedMetricRollups) { + yield* runStatement(connection, statement); + } + } else { + // New batches upsert their at-most-256 latest points without scanning raw history. + yield* runStatement( + connection, + `INSERT INTO observability_historical_metric_rollups ( trace_id, metric_name, metric_id, source_id, observed_at, value, unit, temporality, evidence_quality, source_reference ) @@ -1481,40 +1486,7 @@ const ingestBatch = Effect.fn("DuckDbAnalyticalStore.ingest")(function* ( excluded.observed_at = observability_historical_metric_rollups.observed_at AND excluded.metric_id > observability_historical_metric_rollups.metric_id )`, - ); - if (disposition === "revised") { - // Include both removed and newly introduced keys; never rebuild unrelated history. - yield* runStatement( - connection, - `INSERT INTO observability_revised_metric_keys - SELECT trace_id, metric_name FROM observability_historical_metric_rollup_staging`, - ); - yield* runStatement( - connection, - `DELETE FROM observability_historical_metric_rollups AS rollup - WHERE EXISTS (SELECT 1 FROM observability_revised_metric_keys AS affected - WHERE affected.trace_id = rollup.trace_id AND affected.metric_name = rollup.metric_name)`, - ); - yield* runStatement( - connection, - `INSERT INTO observability_historical_metric_rollups ( - trace_id, metric_name, metric_id, source_id, observed_at, value, unit, - temporality, evidence_quality, source_reference - ) - SELECT trace_id, metric_name, metric_id, source_id, observed_at, value, unit, - temporality, evidence_quality, source_reference - FROM ( - SELECT *, ROW_NUMBER() OVER ( - PARTITION BY trace_id, metric_name - ORDER BY observed_at DESC, metric_id DESC - ) AS point_rank - FROM observability_retained_metric_candidates AS point - WHERE EXISTS (SELECT 1 FROM observability_revised_metric_keys AS affected - WHERE affected.trace_id = point.trace_id AND affected.metric_name = point.metric_name) - ) AS latest - WHERE point_rank = 1`, ); - yield* runStatement(connection, "DROP TABLE observability_revised_metric_keys"); } yield* runStatement(connection, "DELETE FROM observability_historical_metric_rollup_staging"); yield* appendRows( diff --git a/packages/observability/src/historical-rollup-sql.ts b/packages/observability/src/historical-rollup-sql.ts new file mode 100644 index 00000000..b651c3ff --- /dev/null +++ b/packages/observability/src/historical-rollup-sql.ts @@ -0,0 +1,30 @@ +/** Reconcile only changed values for a revised batch's removed and incoming keys. */ +export const reconcileRevisedMetricRollups: ReadonlyArray = [ + `INSERT INTO observability_revised_metric_keys + SELECT trace_id, metric_name FROM observability_historical_metric_rollup_staging`, + `CREATE OR REPLACE TEMP TABLE observability_revised_metric_rollups AS + SELECT trace_id, metric_name, metric_id, source_id, observed_at, value, unit, + temporality, evidence_quality, source_reference + FROM observability_retained_metric_candidates AS point + WHERE EXISTS (SELECT 1 FROM observability_revised_metric_keys AS affected + WHERE affected.trace_id = point.trace_id AND affected.metric_name = point.metric_name) + QUALIFY ROW_NUMBER() OVER ( + PARTITION BY trace_id, metric_name ORDER BY observed_at DESC, metric_id DESC + ) = 1`, + `DELETE FROM observability_historical_metric_rollups AS rollup + WHERE EXISTS (SELECT 1 FROM observability_revised_metric_keys AS affected + WHERE affected.trace_id = rollup.trace_id AND affected.metric_name = rollup.metric_name) + AND NOT EXISTS (SELECT 1 FROM observability_revised_metric_rollups AS latest + WHERE latest.trace_id = rollup.trace_id AND latest.metric_name = rollup.metric_name + AND latest.metric_id = rollup.metric_id AND latest.source_id = rollup.source_id + AND latest.observed_at = rollup.observed_at AND latest.value = rollup.value + AND latest.unit = rollup.unit AND latest.temporality = rollup.temporality + AND latest.evidence_quality = rollup.evidence_quality + AND latest.source_reference = rollup.source_reference)`, + `INSERT INTO observability_historical_metric_rollups + SELECT * FROM observability_revised_metric_rollups AS latest + WHERE NOT EXISTS (SELECT 1 FROM observability_historical_metric_rollups AS current + WHERE current.trace_id = latest.trace_id AND current.metric_name = latest.metric_name)`, + "DROP TABLE observability_revised_metric_rollups", + "DROP TABLE observability_revised_metric_keys", +]; diff --git a/skill/SKILL.md b/skill/SKILL.md index 4df54dbd..79cac294 100644 --- a/skill/SKILL.md +++ b/skill/SKILL.md @@ -14,7 +14,7 @@ description: > they do not name SelfTune explicitly. metadata: author: selftune-dev - version: 0.5.1 + version: 0.5.2 category: developer-tools --- diff --git a/tests/observability/rollup-write-amplification.test.ts b/tests/observability/rollup-write-amplification.test.ts new file mode 100644 index 00000000..afc756f1 --- /dev/null +++ b/tests/observability/rollup-write-amplification.test.ts @@ -0,0 +1,100 @@ +import { expect, test } from "bun:test"; +import { mkdtempSync, rmSync, statSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { DuckDBInstance } from "@duckdb/node-api"; +import { Effect, Schema } from "effect"; +import { + DuckDbAnalyticalStore, + type DuckDbAnalyticalBatch, +} from "@selftune/observability/duckdb-store"; +import { makeDuckDbNodeApiAnalyticalStoreLive } from "@selftune/observability/duckdb-node-api"; + +const batch = { + schema_version: "1.0.0", + batch_id: "revised-source", + source_revision: "r1", + normalizer_version: "fixture-v1", + spans: [], + links: [], + metric_points: [ + { + metric_id: "point", + trace_id: "a".repeat(32), + observed_at: "2026-10-01T00:00:00.000Z", + name: "input_tokens", + value: 100, + unit: "count", + temporality: "cumulative", + evidence_quality: "source_exact", + source_kind: "codex", + source_id: "revised-source", + source_reference: "fixture/source", + }, + ], +} satisfies typeof DuckDbAnalyticalBatch.Encoded; + +const Rows = Schema.Array(Schema.Struct({ row_id: Schema.String, value: Schema.Number })); +const Counts = Schema.Array(Schema.Struct({ rows: Schema.String })); + +test("source-only revisions do not rewrite unchanged rollups beside retained history", async () => { + const directory = mkdtempSync(join(tmpdir(), "selftune-rollup-writes-")); + const path = join(directory, "observability.duckdb"); + const ingest = (input: typeof DuckDbAnalyticalBatch.Encoded) => + Effect.runPromise( + Effect.gen(function* () { + return yield* (yield* DuckDbAnalyticalStore).ingest(input); + }).pipe(Effect.provide(makeDuckDbNodeApiAnalyticalStoreLive(path)), Effect.scoped), + ); + const sql = async (statement: string) => { + const db = await DuckDBInstance.create(path); + const connection = await db.connect(); + try { + return await (await connection.run(statement)).getRowObjects(); + } finally { + connection.closeSync(); + db.closeSync(); + } + }; + const target = async () => + Schema.decodeUnknownSync(Rows)( + await sql( + "SELECT CAST(rowid AS VARCHAR) AS row_id, value FROM observability_historical_metric_rollups WHERE source_id = 'revised-source'", + ), + ); + const count = async () => + Schema.decodeUnknownSync(Counts)( + await sql( + "SELECT CAST(COUNT(*) AS VARCHAR) AS rows FROM observability_historical_metric_rollups", + ), + ); + try { + await ingest(batch); + // Retained summaries may outlive their detail. Revisions must leave them untouched. + await sql(`INSERT INTO observability_historical_metric_rollups + SELECT md5('retained-' || CAST(i AS VARCHAR)), metric_name, metric_id, + 'unrelated', observed_at, value, unit, temporality, evidence_quality, source_reference + FROM observability_historical_metric_rollups CROSS JOIN range(10000) AS neighbors(i)`); + const before = await target(); + expect(before).toHaveLength(1); + expect(await count()).toEqual([{ rows: "10001" }]); + for (let revision = 2; revision <= 21; revision++) { + await ingest({ ...batch, source_revision: `r${revision}` }); + } + // A changed physical row identity would prove delete/reinsert amplification despite equal values. + expect(await target()).toEqual(before); + expect(await count()).toEqual([{ rows: "10001" }]); + expect(statSync(path).size).toBeLessThan(32 * 1024 * 1024); + await ingest({ + ...batch, + source_revision: "changed-value", + metric_points: [{ ...batch.metric_points[0], value: 101 }], + }); + expect((await target())[0]?.value).toBe(101); + await ingest({ ...batch, source_revision: "removed-point", metric_points: [] }); + expect(await target()).toEqual([]); + expect(await count()).toEqual([{ rows: "10000" }]); + } finally { + rmSync(directory, { recursive: true }); + } +}, 30_000); diff --git a/tests/observability/storage-inspection.test.ts b/tests/observability/storage-inspection.test.ts index c35b81eb..77740f15 100644 --- a/tests/observability/storage-inspection.test.ts +++ b/tests/observability/storage-inspection.test.ts @@ -37,7 +37,13 @@ test("catalog diagnostics leave an old schema byte-identical and omit private ro expect(readdirSync(directory)).toEqual(["observability.duckdb"]); }); -test.each([{ versions: [] }, { versions: [1, 8, 9] }, { versions: [1, 42] }])( +test.each([ + { versions: [] }, + { versions: [1, 8, 9] }, + { versions: [1, 42] }, + { versions: [1, 8, 9, 10, 11, 12] }, + { versions: [8, 9, 42] }, +])( "reports the stored migration ledger without upgrading or downgrading it: %j", async ({ versions }) => { const directory = mkdtempSync(join(tmpdir(), "selftune-storage-schema-")); From 15fdd8c18c82c8d8e81cf71d1238c4f0e0cb966b Mon Sep 17 00:00:00 2001 From: Daniel Petro <45949032+WellDunDun@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:29:11 +0300 Subject: [PATCH 2/3] chore: export from selftune-cloud-app --- .changeset/patched-electron-41-runtime.md | 5 +++++ .github/release-notes.json | 3 ++- apps/desktop/package.json | 2 +- bun.lock | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/patched-electron-41-runtime.md diff --git a/.changeset/patched-electron-41-runtime.md b/.changeset/patched-electron-41-runtime.md new file mode 100644 index 00000000..8b8cbab5 --- /dev/null +++ b/.changeset/patched-electron-41-runtime.md @@ -0,0 +1,5 @@ +--- +"@selftune/desktop": patch +--- + +Update the pinned Electron 41 runtime to 41.10.6 for the sandbox, protocol-handler, and webview security fixes identified in the current release review. diff --git a/.github/release-notes.json b/.github/release-notes.json index 56319779..7f160bbc 100644 --- a/.github/release-notes.json +++ b/.github/release-notes.json @@ -14,7 +14,8 @@ "bullets": [ "Replace only changed or removed summaries, preserving unrelated history and raw evidence.", "Report the highest numeric migration version in read-only storage inspection, so schema 12 is not misreported as schema 9.", - "Keep the macOS background service inside the signed app bundle when SelfTune is installed in Applications, avoiding version-specific service paths on update." + "Keep the macOS background service inside the signed app bundle when SelfTune is installed in Applications, avoiding version-specific service paths on update.", + "Update the pinned Electron 41 runtime to 41.10.6 for its sandbox and protocol security fixes." ], "versionRange": { "from": "0.5.3", diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 83cb64e7..4964b36a 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -43,7 +43,7 @@ "@selftune/runtime": "workspace:*", "@types/node": "^20", "bun-types": "^1.3.11", - "electron": "41.10.5", + "electron": "41.10.6", "electron-builder": "^26.0.12", "electron-vite": "^5.0.0", "playwright": "1.61.1", diff --git a/bun.lock b/bun.lock index e56c78c6..c8dc919e 100644 --- a/bun.lock +++ b/bun.lock @@ -100,7 +100,7 @@ "@selftune/runtime": "workspace:*", "@types/node": "^20", "bun-types": "^1.3.11", - "electron": "41.10.5", + "electron": "41.10.6", "electron-builder": "^26.0.12", "electron-vite": "^5.0.0", "playwright": "1.61.1", @@ -1770,7 +1770,7 @@ "ejs": ["ejs@3.1.10", "", { "dependencies": { "jake": "^10.8.5" }, "bin": { "ejs": "bin/cli.js" } }, "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA=="], - "electron": ["electron@41.10.5", "", { "dependencies": { "@electron-internal/extract-zip": "^1.0.1", "@electron/get": "^5.0.0", "@types/node": "^24.9.0" }, "bin": { "electron": "cli.js" } }, "sha512-grSJOhLddanWX1UfE8B4xA2kOOduUCfpYoOQ2D4zEYte8lSQtrd1HYbV4xErsZmm+V+1Q3yzCQLBsCxEIiw/QQ=="], + "electron": ["electron@41.10.6", "", { "dependencies": { "@electron-internal/extract-zip": "^1.0.1", "@electron/get": "^5.0.0", "@types/node": "^24.9.0" }, "bin": { "electron": "cli.js" } }, "sha512-NEB7QnVpT2p8S9U5jOCPAtCyhl1WjRT/ODvJP6ec1/dZRUmf/EjYVOBb/dthCmJh4bISqpAroGJ/xRRxX7VwJw=="], "electron-builder": ["electron-builder@26.15.3", "", { "dependencies": { "app-builder-lib": "26.15.3", "builder-util": "26.15.3", "builder-util-runtime": "9.7.0", "chalk": "^4.1.2", "ci-info": "^4.2.0", "dmg-builder": "26.15.3", "fs-extra": "^10.1.0", "lazy-val": "^1.0.5", "simple-update-notifier": "2.0.0", "yargs": "^17.6.2" }, "bin": { "electron-builder": "./cli.js", "install-app-deps": "./install-app-deps.js" } }, "sha512-a1KM5heqS3gQCZzizXEI8RjJy3QVogULPdeSknt76uLDpBIW/HDGsMg/XgP0riP6PI9COsRvFITKKGDqA8fJxA=="], From 857a9d5a9ba81d693773d5bbe01fd6135c121d16 Mon Sep 17 00:00:00 2001 From: Daniel Petro <45949032+WellDunDun@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:43:51 +0300 Subject: [PATCH 3/3] chore: export from selftune-cloud-app --- apps/desktop/src/main/background-service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/main/background-service.ts b/apps/desktop/src/main/background-service.ts index 4acc9a78..1923b10f 100644 --- a/apps/desktop/src/main/background-service.ts +++ b/apps/desktop/src/main/background-service.ts @@ -1,5 +1,5 @@ import { execFile } from "node:child_process"; -import { join } from "node:path"; +import { posix } from "node:path"; import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; @@ -30,7 +30,7 @@ export function backgroundServiceResourceDirectory(options: { readonly installedRuntimeDirectory: string; }): string { return options.platform === "darwin" && options.inApplicationsFolder - ? join(options.resourcesPath, "selftune") + ? posix.join(options.resourcesPath, "selftune") : options.installedRuntimeDirectory; }