fix: date repository cards from state events, not announcements

The explore list fell back to the announcement created_at because kind 30618 state events were only fetched per repository, on open. Sync them globally and refresh the list on published state events, so a card shows the last push without the user cloning first.

Open repository panels now also react to state events from relays and to locally published state events.
This commit is contained in:
2026-09-25 17:36:35 +07:00
parent 1d44338037
commit 42c1229a90
4 changed files with 39 additions and 17 deletions
+14 -12
View File
@@ -123,24 +123,26 @@ flowchart TD
## Remediation options
- **A. Global state sync (smallest change).**
Add `sync_bootstrap(Filter::new().kind(Kind::RepoState))` alongside the announcement
sync in `RepoListStore::subscribe_remote`. Kind `30618` is addressable, so relays
keep one event per repository — volume comparable to announcements. Caveat: coverage
depends on whether state events reach the bootstrap relays; if a grasp server is the
only holder, those repositories remain unseen.
- **A. Global state sync (smallest change). — implemented.**
`RepoListStore::subscribe_remote` now also syncs `filters::all_states()`
(`Filter::new().kind(Kind::RepoState)`) alongside the announcement sync. Kind `30618`
is addressable, so relays keep one event per repository — volume comparable to
announcements. Caveat: coverage depends on whether state events reach the bootstrap
relays; if a grasp server is the only holder, those repositories remain unseen.
- **B. Targeted fetch for the user's own repositories.**
- **B. Targeted fetch for the user's own repositories. — not implemented.**
In `sync_inbox` (`crates/signed_state/src/backend.rs` L1126-1152), where the user's
own repositories' relays are already connected, also sync `filters::state(addr)` per
own repository. This directly addresses "my repositories updated elsewhere" at low
cost. Note the existing race: `sync_inbox` reads the announcement list right after
login, which may not be loaded yet.
- **C. Reactivity fixes.**
Include `Kind::RepoState` in the `Published` refresh conditions, and in
`RepoStore::subscribe_backend` either match kind plus author, or extend `Update` to
carry the `d`-tag identifier.
- **C. Reactivity fixes. — implemented.**
`Kind::RepoState` is now included in the `BackendEvent::Published` refresh condition of
both `RepoListStore` and `RepoStore`. `RepoStore::subscribe_backend` also matches relay
state updates by owner plus kind — state events carry `d`, not `a`, so coordinate
matching misses them — and locally published state updates by owner plus the `d`
identifier.
Suggested combination: A + C, plus B if own-repository freshness on fresh profiles
A + C are implemented; B remains available if own-repository freshness on fresh profiles
matters.