Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

refactor(storage): remove unused hosted manifest retention helper

wyt5c51d367d961
diff --git a/src/main/util/tombstone_retention.ts b/src/main/util/tombstone_retention.ts
index 5b54e3ae..a5f7ed8b 100644
--- a/src/main/util/tombstone_retention.ts
+++ b/src/main/util/tombstone_retention.ts
@@ -57,27 +57,3 @@ export function pruneExpiredDeletedRecords<T extends Record<string, any>>(
): T[] {
return records.filter((record) => !isExpiredIsoTombstone(record?.deleted_at, opts));
}
-
-export function pruneExpiredManifestTombstones<T extends Record<string, any>>(
- tombstones: T,
- opts?: RetentionOptions,
-): T {
- return Object.fromEntries(
- Object.entries(tombstones || {}).filter(([, value]) => {
- if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
- const deletedAtMs = value.deleted_at_ms;
- const revision = value._v;
- if (
- typeof deletedAtMs !== 'number'
- || !Number.isFinite(deletedAtMs)
- || deletedAtMs <= 0
- || typeof revision !== 'number'
- || !Number.isSafeInteger(revision)
- || revision <= 0
- ) {
- return false;
- }
- return !isExpiredMsTombstone(deletedAtMs, opts);
- }),
- ) as T;
-}
diff --git a/test/main/util/sync-record-tombstone.test.ts b/test/main/util/sync-record-tombstone.test.ts
index ffb361b7..2c0b0c90 100644
--- a/test/main/util/sync-record-tombstone.test.ts
+++ b/test/main/util/sync-record-tombstone.test.ts
@@ -10,7 +10,6 @@ import {
isExpiredIsoTombstone,
isExpiredMsTombstone,
pruneExpiredDeletedRecords,
- pruneExpiredManifestTombstones,
TOMBSTONE_RETENTION_MS,
} from '../../../src/main/util/tombstone_retention';
@@ -98,19 +97,4 @@ describe('shared tombstone retention', () => {
.toEqual(['active', 'recent', 'malformed']);
});
- it('drops malformed manifest tombstones before they can delete local data', () => {
- const recent = NOW - 1_000;
- const tombstones = {
- valid: { deleted_at_ms: recent, _v: 2, etag: 'keep-extra-compatible-fields' },
- expired: { deleted_at_ms: NOW - TOMBSTONE_RETENTION_MS, _v: 3 },
- missingRevision: { deleted_at_ms: recent },
- zeroRevision: { deleted_at_ms: recent, _v: 0 },
- stringTimestamp: { deleted_at_ms: String(recent), _v: 4 },
- scalar: true,
- };
-
- expect(pruneExpiredManifestTombstones(tombstones, { nowMs: NOW })).toEqual({
- valid: tombstones.valid,
- });
- });
});