Relay Manager implementation plan

Current direction

The approved Fetch / Coverage / Sync design is the source of truth for the next implementation. It supersedes the earlier 500-event split-window strategy, one-hour presence expiry, global Coverage table, and proposed mandatory per-ID existence-check stage. The completed sections below remain the historical implementation record, not a claim that the new design is implemented.

Runtime status at planning time

Working: account/relay settings, automatic metadata/socket checks, public-event archive with legacy split-window checkpoints, NIP-65 publication, and persisted positive presence facts. Pending: NIP-77, incremental per-relay fetching, scoped query/range history, revised Coverage UI, eligible missing-copy sync and read-back.

Next implementation milestones

1. Evidence, query history, and migration

Exit: repeat-safe migration preserves old data; an event can have independent observations in multiple ranges/runs; partial and newer unrelated scopes do not overwrite older evidence; projection can be rebuilt from recorded provenance.

2. Ordinary paging and incremental fetching

Exit: repeated runs avoid unnecessary full backfills; interrupted snapshots resume without jumping forward; timestamp overlap does not duplicate archive bodies; rechecking can discover newly imported old events; short-page completion records its relay-limit assumptions rather than claiming universal completeness.

3. NIP-77 reconciliation

Exit: differences in both directions are correctly attributed; common bodies are not redownloaded unnecessarily; same-timestamp IDs reconcile; unsupported relays still fetch; partial/error scopes never generate unsupported missing conclusions.

4. Range Coverage and automatic comparison

Exit: the same UI works for both transports; scope history remains inspectable; partial scopes are not displayed as complete empty ranges; multiple overlapping observations do not inflate the unique archive total.

5. Eligible missing-copy Sync and verification

Exit: extra/read-only sources receive no sync uploads; one event missing on two destinations counts as two deliveries; acknowledgement alone is not verification; rejection and inconclusive read-back are separate; archive-only historical versions are not accidentally replayed as current events.

6. Integration review and documentation

No new test files or test-suite runs are included unless requested by the user.

Deferred scope

Historical implementation record

First timeline iteration

Verification: targeted ESLint passed; TypeScript reported zero diagnostics in the plugin; a one-off in-memory check validated empty/preview/populated WebNode schemas, npub account creation, normalized relay updates/removal, invalid URL rejection, account deletion, and preview non-persistence. No browser or live relay checks were run.

Subsequent iterations

Account selection convenience

Verification: targeted ESLint passed; changed-file TypeScript checks reported zero diagnostics; a one-off schema check confirmed the dynamic public-key picker and independent manual npub form in list. Authenticated browser review remains pending.

Compact layout iteration

Verification: targeted ESLint and changed-file TypeScript checks passed; registration generation completed. A one-off in-memory schema/layout check verified empty/populated list output, six element cells per header/body row, inline account submit controls, and removal of the preview command option and render paths. Visual review in authenticated AppWeaver remains pending.

Account actions and automatic refresh

Verification: targeted ESLint passed; plugin TypeScript diagnostics were zero. A one-off in-memory check with stubbed network responses validated concurrent refresh coalescing, five-minute cache reuse, URL-change invalidation, profile and connection observations, preservation of local settings, polling stop on completion, DM list without networking, and visible control placement. Live relay and browser review remain pending.

Account label and alignment cleanup

Verification: targeted ESLint passed; static inspection confirmed the identity label removal and centered flex alignment for account add/selector forms.

Agreed fetch / coverage / sync structure

Verification: targeted ESLint passed and plugin TypeScript diagnostics were zero. A one-off in-memory SQLite check validated additive/repeated migration, existing account/archive retention, write-only scopes, per-relay duplicated-copy counting, stale/future/unknown classification, monotonic observation writes, independent source/relay edits, and the ordered WebNode section/tree schema. No live relay or authenticated browser checks were run.

The initial UI and presence-query foundations were arranged here. The archive and NIP-65 publication actions were implemented in the following section. Their next fetching/coverage changes are tracked in the active milestones above.

Enable publication and backup actions

Verification: targeted ESLint passed, changed-module TypeScript diagnostics were zero, and command registration generation completed. A one-off in-memory check using actual signed events and stubbed relay transport verified invalid-signature/ wrong-author/private-kind filtering, archive deduplication, observed presence, partial backup resume, concurrent-run rejection, interrupted-run recovery, selected-account signer restrictions, signed-list/config validation, per-relay publication outcomes, stale snapshot protection, and enabled widget actions. Live relay and authenticated browser review remain pending.

Initial event-engine backlog (superseded by active milestones)

The current iteration includes local configuration, public-event backup, and NIP-65 publication. Existence checks, event selection/export, and sync are still pending. No dock widget registration. Runtime restart must be done by the user outside the active chat.