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 code-review: don't version-gate videoHistory, exclude hidden rows from sync, honest weather_now desc

Adam Eivyc1dd836e1223
diff --git a/server/lib/schemaVersions.js b/server/lib/schemaVersions.js
index e016601e57..d1ff49e862 100644
--- a/server/lib/schemaVersions.js
+++ b/server/lib/schemaVersions.js
@@ -36,11 +36,18 @@ export const PORTOS_SCHEMA_VERSIONS = Object.freeze({
pipelineIssues: 1,
pipelineSeries: 1,
mediaCollections: 1,
- // v1 = the flat `data/video-history.json` array of generation rows synced
- // by the `videoHistory` sync category (rows ride the snapshot loop so a
- // synced collection's video items aren't filtered out as "missing" on the
- // receiver). The shape has been stable since video gen shipped.
- videoHistory: 1,
+ // NOTE: `videoHistory` is intentionally NOT listed here. The version gate
+ // rejects the ENTIRE snapshot/push payload on ANY ahead-mismatch (the
+ // comparator walks the union of keys), so declaring a brand-new key would
+ // make every not-yet-upgraded peer reject ALL categories (universe,
+ // pipeline, …) — severing sync across a federation that upgrades on
+ // independent schedules. videoHistory is a flat append-only array merged by
+ // id with LWW-on-createdAt; the merge already tolerates unknown/extra rows,
+ // so it does not need whole-payload gating. An older peer that lacks the
+ // `videoHistory` route simply rejects that one category request and keeps
+ // syncing everything else. (Generalizing the gate to be per-category —
+ // which would also fix the same latent issue for mediaCollections — is a
+ // separate follow-up tracked in PLAN.md.)
});
/**
diff --git a/server/services/dataSync.js b/server/services/dataSync.js
index 7b76d68271..1347a80f32 100644
--- a/server/services/dataSync.js
+++ b/server/services/dataSync.js
@@ -597,7 +597,12 @@ async function applyMediaCollectionsRemote(remoteData) {
// need on the sync read path, and the on-disk shape is a plain array.
async function getVideoHistorySnapshot() {
const raw = await readJSONFile(VIDEO_HISTORY_FILE, []);
- const rows = Array.isArray(raw) ? raw : [];
+ // Exclude rows the user hid from their own gallery (`hidden: true`) — hiding
+ // is a local-only visibility decision (e.g. inner chunks of a stitched clip,
+ // or a clip the user tucked away) and must NOT propagate to peers. The whole
+ // point of this category is to render a SHARED collection's video items, and
+ // a hidden row is by definition not part of that shared surface.
+ const rows = (Array.isArray(raw) ? raw : []).filter((r) => r && !r.hidden);
// Canonicalize ordering for the wire so two peers holding identical sets
// produce identical checksums regardless of insertion (newest-first) order.
// Mirrors getMediaCollectionsSnapshot's sort-by-id rationale. Rows without a
diff --git a/server/services/dataSync.pipelineUniverse.test.js b/server/services/dataSync.pipelineUniverse.test.js
index 151d3b0f4e..f014266cc8 100644
--- a/server/services/dataSync.pipelineUniverse.test.js
+++ b/server/services/dataSync.pipelineUniverse.test.js
@@ -699,6 +699,12 @@ describe('dataSync — videoHistory category', () => {
expect(snap.checksum).toBeTruthy();
});
+ it('snapshot excludes hidden rows (local-only visibility must not propagate to peers)', async () => {
+ writeJSON(VIDEO_HISTORY_PATH, [row('v1'), row('v-hidden', { hidden: true }), row('v2')]);
+ const snap = await dataSync.getSnapshot('videoHistory');
+ expect(snap.data.videos.map((v) => v.id).sort()).toEqual(['v1', 'v2']);
+ });
+
it('snapshot checksum is order-insensitive (rows sorted by id on the wire)', async () => {
writeJSON(VIDEO_HISTORY_PATH, [row('v-b'), row('v-a')]);
const a = await dataSync.getSnapshot('videoHistory');
diff --git a/server/services/voice/tools.js b/server/services/voice/tools.js
index 6dc3554435..b2bfd81090 100644
--- a/server/services/voice/tools.js
+++ b/server/services/voice/tools.js
@@ -1598,7 +1598,7 @@ const TOOLS = [
{
name: 'weather_now',
description:
- 'Report the current weather (temperature + conditions) for a location. Use when the user asks "what\'s the weather?", "is it raining?", "how hot is it outside?". Defaults to the user\'s configured location (if set in Settings); otherwise pass `lat`/`lon` for a specific place. Uses the free Open-Meteo service (no API key).',
+ 'Report the current weather (temperature + conditions) for a location. Use when the user asks "what\'s the weather?", "is it raining?", "how hot is it outside?". Pass `lat`/`lon` for a specific place; with no coordinates it uses a saved location if one is configured, otherwise a default location. Uses the free Open-Meteo service (no API key).',
parameters: {
type: 'object',
properties: {