Merge pull request #1072 from PR0M3TH3AN/refactor-watch-history-context-10244638915022032080

Refactor watch history context to month-centric fields
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-04 22:29:18 -05:00
commit 4c6eae2f14
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -1486,6 +1486,7 @@ class WatchHistoryManager {
devLogger.warn("[nostr] Unable to build watch history payload for month.", {
actor: actorKey,
monthIdentifier,
recordId: snapshotId,
});
return { ok: false, error: "invalid-month", retryable: false };
}
@@ -1516,7 +1517,7 @@ class WatchHistoryManager {
}
devLogger.info("[nostr] Preparing to publish watch history snapshot.", {
actor: actorKey,
snapshotId,
recordId: snapshotId,
monthIdentifier,
itemCount: canonicalItems.length,
payloadCount: Array.isArray(payload.items) ? payload.items.length : 0,
@@ -1619,7 +1620,7 @@ class WatchHistoryManager {
const tryEncryptWithCandidate = async (candidate, plaintext, context = {}) => {
const details = {
actor: actorKey,
snapshotId,
recordId: snapshotId,
monthIdentifier,
payloadSize: plaintext.length,
scheme: candidate.scheme,
@@ -2401,6 +2402,8 @@ class WatchHistoryManager {
const ciphertext = typeof event.content === "string" ? event.content : "";
const ciphertextPreview = ciphertext.slice(0, 32);
const chunkContext = {
recordId: snapshotId,
month: snapshotId,
eventId: event.id ?? null,
};
const availableSchemes = Array.from(decryptorCandidates.keys());
+1 -1
View File
@@ -370,7 +370,7 @@ const BASE_SCHEMAS = {
},
[NOTE_TYPES.WATCH_HISTORY_CHUNK]: {
type: NOTE_TYPES.WATCH_HISTORY_CHUNK,
label: "Watch history month payload",
label: "Watch history monthly payload",
kind: WATCH_HISTORY_KIND,
identifierTag: {
name: "d",