Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: update test count in DONE.md and changelog

[._.]/ Adam Eivy61ce072a8adb
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 66bca80d7c..46c5b8a6e2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -23,7 +23,7 @@
### Sharing
- **Per-sender subscription filenames.** `subscriptionFilename()` now includes the sender's instance id in the bucket-side filename (`sub-<kind>-<recordId>-<senderInstanceId>.json`) so two peers subscribed to the same series/universe don't clobber each other's deterministic share files. Inbox dedup keys on `(recordKind, recordId, senderInstanceId)` so a peer's update no longer wipes the other peer's inbox row. `unsubscribe` best-effort cleans up the pre-v2 sender-less filename when its `senderInstanceId` matches this instance, leaving any other peer's pre-upgrade file intact. New `legacySubscriptionFilename` export for the legacy name. Touched `server/services/sharing/{manifest,subscriptions,importer,exporter}.js` + tests.
-- **Rotation-orphan inbox cull.** Per-sender inbox dedup means a peer that rotates its `instanceId` (factory reset / new device) would otherwise leave its old identity's row stranded forever. `applyInbox` now culls cross-sender orphans on every subscription-manifest arrival when (a) same `(recordKind, recordId, source)`, (b) different `senderInstanceId`, (c) existing row older than 30 days. The conservative window keeps two legitimately distinct peers with the same display name from being incorrectly culled. 3 new integration tests cover the cull/preserve cases.
+- **Rotation-orphan inbox cull.** Per-sender inbox dedup means a peer that rotates its `instanceId` (factory reset / new device) would otherwise leave its old identity's row stranded forever. `applyInbox` now culls cross-sender orphans on every subscription-manifest arrival when (a) same `(recordKind, recordId, source)`, (b) different `senderInstanceId`, (c) existing row older than 30 days. The conservative window keeps two legitimately distinct peers with the same display name from being incorrectly culled. Cull removals persist even when the freshness-gate (`inbox-has-newer`) short-circuits the rest of `applyInbox`. 4 new integration tests cover the cull/preserve cases plus the freshness-gate early-return regression.
## Changed
diff --git a/DONE.md b/DONE.md
index b6afe0679a..6510a376dd 100644
--- a/DONE.md
+++ b/DONE.md
@@ -10,7 +10,7 @@ For active roadmap see [PLAN.md](./PLAN.md). For project goals see [GOALS.md](./
### 2026-05-18
-- **[sharing-inbox-orphans-on-peer-instance-id-rotation] Cull rotation-orphan inbox rows.** Closes the regression introduced by `[sharing-v2-per-sender-subscription-filenames]`: a peer that rotates its `senderInstanceId` (factory reset / new device) would otherwise leave its old identity's inbox row stranded forever, because the per-sender dedup keys on the new id. `applyInbox` in `server/services/sharing/importer.js` now culls cross-sender orphans on every subscription-manifest arrival when (a) same `(recordKind, recordId, source)`, (b) DIFFERENT `senderInstanceId`, and (c) existing row's `createdAt` older than the 30-day `ROTATION_CULL_MS` window. The window is conservative — two legitimately distinct peers sharing the same display name (e.g. both devices named "MacBook") would only be culled after a month of one going silent. 3 new integration tests in `integration.test.js` (cull at 60 days, preserve at 2 days, preserve different-source-old). 78 sharing tests pass.
+- **[sharing-inbox-orphans-on-peer-instance-id-rotation] Cull rotation-orphan inbox rows.** Closes the regression introduced by `[sharing-v2-per-sender-subscription-filenames]`: a peer that rotates its `senderInstanceId` (factory reset / new device) would otherwise leave its old identity's inbox row stranded forever, because the per-sender dedup keys on the new id. `applyInbox` in `server/services/sharing/importer.js` now culls cross-sender orphans on every subscription-manifest arrival when (a) same `(recordKind, recordId, source)`, (b) DIFFERENT `senderInstanceId`, and (c) existing row's `createdAt` older than the 30-day `ROTATION_CULL_MS` window. The window is conservative — two legitimately distinct peers sharing the same display name (e.g. both devices named "MacBook") would only be culled after a month of one going silent. 4 new integration tests in `integration.test.js` (cull at 60 days, preserve at 2 days, preserve different-source-old, and a freshness-gate early-return regression that asserts the cull still persists when the `inbox-has-newer` short-circuit fires). 79 sharing tests pass.
- **[content-addressed-asset-dedup-today-asset-copies] Content-addressed asset dedup.** Share-bucket asset blobs are now stored content-addressed at `<bucket>/assets/blobs/<sha256>` (sidecar metadata at `<sha256>.metadata.json`) instead of filename-addressed at `assets/{images,videos}/<filename>`. Two manifests referencing identical bytes under different filenames now share one on-disk blob — every additional reference is a no-op file-existence check on the same hash. New shared helper `sha256File` in `server/lib/fileUtils.js` (one-shot < 512 KB / streaming ≥ 512 KB); `server/services/backup.js#generateManifest` migrated to the same helper (its inline reimplementation deleted). Path/sidecar helpers (`bucketBlobsDir`, `bucketBlobPath`, `bucketBlobSidecarPath`, `imageSidecarName`, `IMAGE_EXT_RE`) live in `server/services/sharing/buckets.js` so storage-layout changes touch one file. `exporter.js#copyAssetIfPresent` computes the hash and returns `{ kind, ref, hash }` per asset; `importer.js#copyAssetsLocally` resolves bucket paths via a `resolveBucketAssetPaths` helper that prefers `assets/blobs/<hash>` when present and falls back to legacy `assets/{kind}/<filename>` for v1 manifests still in-bucket. `SHARING_SCHEMA_VERSION` bumped 1 → 2; bucket layout adds `assets/blobs/` in `ensureBucketLayout`. `annotationsSync.js#listBucketAssetKeys` now derives the user-facing filename set by scanning manifests' `assetRefs` (with the legacy dir scan retained as a fall-through for v1 buckets). Coverage: 4 new unit tests in `fileUtils.test.js` (small/large split, cross-path identical-bytes equality, distinct-bytes inequality) + 2 new integration tests in `integration.test.js` (two manifests with different filenames + identical bytes share one blob and import cleanly; v1 manifest without `hash` field still imports via legacy path) + updated existing integration assertions to expect `assets/blobs/<hash>` paths. All 249 server test files / 5452 tests pass. Two performance follow-ups captured in PLAN.md: per-source hash caching on the exporter, and per-bucket manifest-scan caching on the annotation flush path.
### 2026-05-17