experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(tile-manifest): delete dead convertV1ToV2 function and its tests

The v1 manifest format is gone — convertV1ToV2 had no live callers,
only its own unit tests. Removed the function from tile-manifest.ts
and the corresponding describe('convertV1ToV2') block plus the import
from tile-manifest.test.ts. VALID_V1_MANIFEST stays — still used by
detectManifestVersion and parseManifestJSON tests.

-91
-47
backend/electron/tile-manifest.test.ts
··· 10 10 validateTileManifest, 11 11 parseManifestJSON, 12 12 resolveCapabilities, 13 - convertV1ToV2, 14 13 type TileCapabilities, 15 14 } from './tile-manifest.js'; 16 15 ··· 395 394 }); 396 395 }); 397 396 398 - // ─── V1 to V2 Conversion ──────────────────────────────────────────── 399 - 400 - describe('convertV1ToV2', () => { 401 - it('should convert basic v1 manifest', () => { 402 - const v2 = convertV1ToV2(VALID_V1_MANIFEST as Record<string, unknown>); 403 - assert.strictEqual(v2.manifestVersion, 3); 404 - assert.strictEqual(v2.id, 'legacy-ext'); 405 - assert.strictEqual(v2.name, 'Legacy Extension'); 406 - assert.strictEqual(v2.builtin, true); 407 - assert.strictEqual(v2.tiles.length, 1); 408 - assert.strictEqual(v2.tiles[0].resident, true); 409 - assert.strictEqual(v2.tiles[0].url, 'background.html'); 410 - }); 411 - 412 - it('should convert manifest with no background', () => { 413 - const v1 = { id: 'no-bg', name: 'No Background', background: false }; 414 - const v2 = convertV1ToV2(v1 as Record<string, unknown>); 415 - assert.strictEqual(v2.tiles.length, 0); 416 - }); 417 - 418 - it('should carry over commands', () => { 419 - const v2 = convertV1ToV2(VALID_V1_MANIFEST as Record<string, unknown>); 420 - assert.ok(v2.commands); 421 - assert.strictEqual(v2.commands!.length, 1); 422 - assert.strictEqual(v2.commands![0].name, 'legacy cmd'); 423 - }); 424 - 425 - it('should infer pubsub capabilities', () => { 426 - const v2 = convertV1ToV2(VALID_V1_MANIFEST as Record<string, unknown>); 427 - assert.ok(v2.capabilities.pubsub); 428 - assert.ok(v2.capabilities.pubsub.scopes.includes('self')); 429 - assert.ok(v2.capabilities.pubsub.scopes.includes('global')); 430 - }); 431 - 432 - it('should infer commands capability from commands array', () => { 433 - const v2 = convertV1ToV2(VALID_V1_MANIFEST as Record<string, unknown>); 434 - assert.strictEqual(v2.capabilities.commands, true); 435 - }); 436 - 437 - it('should mark lazy if v1 was lazy', () => { 438 - const v1 = { ...VALID_V1_MANIFEST, lazy: true }; 439 - const v2 = convertV1ToV2(v1 as Record<string, unknown>); 440 - assert.strictEqual(v2.tiles[0].lazy, true); 441 - assert.strictEqual(v2.tiles[0].resident, false); 442 - }); 443 - });
-44
backend/electron/tile-manifest.ts
··· 1223 1223 }; 1224 1224 } 1225 1225 1226 - // ─── V1 to V2 Conversion Helper ───────────────────────────────────── 1227 - 1228 - /** 1229 - * Convert a v1 extension manifest to v2 tile manifest format 1230 - * This is used internally for the compatibility layer — doesn't modify files 1231 - */ 1232 - export function convertV1ToV2(v1: Record<string, unknown>): TileManifestV2 { 1233 - const id = (v1.id || v1.shortname || 'unknown') as string; 1234 - const name = (v1.name || id) as string; 1235 - 1236 - // Build tiles array from v1 background field 1237 - const tiles: TileEntry[] = []; 1238 - if (v1.background && typeof v1.background === 'string') { 1239 - tiles.push({ 1240 - id: 'background', 1241 - url: v1.background as string, 1242 - resident: v1.lazy !== true, 1243 - lazy: v1.lazy === true, 1244 - }); 1245 - } 1246 - 1247 - // Infer capabilities from v1 manifest 1248 - const capabilities: TileCapabilities = { 1249 - pubsub: { scopes: ['self', 'global'] }, 1250 - commands: Array.isArray(v1.commands) && v1.commands.length > 0, 1251 - shortcuts: Array.isArray(v1.shortcuts) && v1.shortcuts.length > 0, 1252 - }; 1253 - 1254 - return { 1255 - manifestVersion: 3, 1256 - id, 1257 - shortname: (v1.shortname as string) || undefined, 1258 - name, 1259 - description: v1.description as string | undefined, 1260 - version: v1.version as string | undefined, 1261 - builtin: v1.builtin as boolean | undefined, 1262 - hidden: v1.hidden as boolean | undefined, 1263 - tiles, 1264 - capabilities, 1265 - commands: v1.commands as TileCommand[] | undefined, 1266 - shortcuts: v1.shortcuts as TileShortcut[] | undefined, 1267 - settingsSchema: v1.settingsSchema as string | undefined, 1268 - }; 1269 - }