Repository navigation
Conversation
… rules Adds kinds 42110 to 42113 and the relay-only 30623 snapshot, the payload structs, the import tag parser, the pure session status and acceptance rule functions, the rejection reasons (including the session warm-up and the per-channel and per-proposer session caps) and the relay import limits. Signed-off-by: jaykurian <49807026+jaykurian@users.noreply.github.com>
…d writes Adds import_sessions and import_session_participants, the session store that applies control events and imported events under the session row lock and republishes the relay-signed snapshot, and keeps imported events out of mention rows, the listener outbox, unread evidence and thread activity. New proposals are refused once the channel or the proposer holds the configured number of unended sessions; both counts run under transaction-scoped advisory locks. Every imported event rechecks that its author is not an agent. At this commit the replica-fence floor still refuses an imported event's original timestamp, so the tests here cover sessions, consent, caps, expiry and deletion; the next commit adds the transaction-local floor exception, the covered-read guard that keeps it sound, and the tests that store imported events. Signed-off-by: jaykurian <49807026+jaykurian@users.noreply.github.com>
Imported events keep their original created_at, which is older than the buzz.created_at_floor guard (migration 0021). insert_import_event now blanks the floor for its own transaction only (set_config(.., true)); the pooled connection is armed again after COMMIT or ROLLBACK, and a test checks that a plain write on the same connection is still refused. Two rules keep covered replica reads sound: - guard_covered_route sends a covered channel or thread read to the writer while the replica snapshot shows an active session for that channel, until expires_at plus the accept delay. A thread root the snapshot lacks stays on the replica, since its replies commit only after it. - Imports commit only from the session's accepts_after: activated_at plus PROOF_MAX_AGE (the ring's 120 x 500 ms) plus a 15 s margin, computed once at activation and published as an accepts_after tag on the 30623 snapshot. Earlier imports get "invalid: import session warming". The fence now refuses ring entries older than PROOF_MAX_AGE, so a proved snapshot taken while imports can exist already contains the activation. The Postgres tests that store imported events (counts, ranges, agents, DM membership, concurrency, session matching) move here, since they need the exception. Migration 0021 is checksum-frozen, so the exception is recorded in 0081, the replica_fence module docs and docs/database.md. Reviewer ask: sign-off from a replica-fence owner on the floor exception and the warm-up bound. Signed-off-by: jaykurian <49807026+jaykurian@users.noreply.github.com>
…stamps Routes NIP-CI control events to the session store, skips the drift check only for well-formed imported events that pass every session rule, charges imports to a new ImportEvents budget (BUZZ_RATE_LIMIT_IMPORT_EVENTS_PER_MIN, default 600), caps session lifetime with BUZZ_IMPORT_SESSION_MAX_DAYS (default 30), caps unended sessions with BUZZ_IMPORT_MAX_ACTIVE_SESSIONS_PER_CHANNEL (default 2) and BUZZ_IMPORT_MAX_ACTIVE_SESSIONS_PER_PROPOSER (default 8), and keeps imported events away from workflows and agent subscriptions. Import-tagged events are hidden from agent readers on REQ history, NIP-50 search and every HTTP /query mode, using the same agent predicate as live fan-out. Signed-off-by: jaykurian <49807026+jaykurian@users.noreply.github.com>
Signed-off-by: jaykurian <49807026+jaykurian@users.noreply.github.com>
🔐 Codex Security Review
|
|
Hi @jaykurian, I resolved the merge conflicts that arose with recent changes on
If you'd like to pull these conflict fixes into your PR branch, you can run: git pull https://github.com/presentyourlove/buzz.git fix/relay-conversation-import-8981 |
Drop everything except `buzz import slack` so the change carries no relay, database, desktop, or new-crate surface: - relay import exemption and the replica-fence backfill guard - kinds 30623/30624 (identity attestation/claim) and their SDK builders - the `buzz-migrate` claim-service crate - desktop claim dialog, deep link, onboarding flow, and timeline attribution - `buzz import bind` / `buzz import claim` The relay exemption closed the replica fence with an in-process counter, which does not hold across relay pods, and kind 30623 plus the `import` tag collide with the consented-import proposal in block#8981. The removed work stays available on the contributor fork for separate proposals. `uuid`'s v5 feature moves from the workspace manifest to buzz-cli, its only user. Signed-off-by: Ren Koya <koya.ren.701@gmail.com>
The importer no longer asks the relay for anything a member cannot already do, so it runs unchanged against any relay: - Events are stamped with the import time. Each message gets its own second, in Slack order, because the relay orders a channel by whole-second created_at; the original author and time open the message content. - Provenance is a single ["imported_from", "slack", <team>/<channel>/<ts>] tag, the shape proposed in block#3306. The `import` tag, which block#8981 reserves for consented imports, is no longer emitted. - The ledger is exact. Import-time stamps make event ids unreproducible, so a signed event id is journaled as an intent before it is submitted, and an intent left unconfirmed is looked up on the relay by the next run and either adopted or signed afresh. Writes are appended to a synced journal and compacted into the snapshot at channel boundaries. - A run with unconfirmed writes exits non-zero and reports them as `failed`. - --identity-map becomes --user-map: it only populates private channels and DMs now that no identity binding is published. Verified against a relay built from this tree: order, threads, reactions, private and archived channels, re-run idempotency, intent adoption, and recovery from a SIGKILL mid-run with no duplicate messages. Signed-off-by: Ren Koya <koya.ren.701@gmail.com>
|
🤖 @jaykurian Update from #9641 at 80036cc: no action needed here. An oldest-first channel page whose cursor is below the channel-floor month (head pages included) now reads all rows below that month in one pass before walking partitions, so pre-channel imported rows are read in both directions and sparse imports cost one statement instead of one per two months. |
What
Relay side of NIP-CI: people in a conversation on another platform can import its history into a Buzz channel or DM with the original timestamps. Each participant signs only their own messages, and only after every participant has consented to the same manifest.
d= proposal id).["import", <proposal>]and["source", <type>, <ref>].nip-ciinsupported_extensions, so clients can refuse to propose against a relay without it.docs/nips/NIP-CI.md.How
Drift check. Only a well-formed import-tagged kind:9 or kind:7 skips the drift check (
check_timestamp_drift, unit-tested). It is stored only if the session rules hold in the storage transaction: active session, matching channel and source type, a consenting participant, in range, under the declared count, and a reaction target imported under the same proposal.Replica fence (own commit). Imported rows are older than the commit-time floor guard (migration 0021). The import transaction disarms the floor for itself only, with a test that a plain old write on the same connection is still refused afterwards. Covered replica reads (channel windows, channel-pinned queries, thread pages) go to the writer while the reader snapshot shows an active, unexpired import session for that channel; a thread root the snapshot lacks stays on the replica. 0021 is checksum-frozen, so the exception is documented in 0081,
replica_fence.rsanddocs/database.md. The commit body carries a reviewer ask for a replica-fence owner.Warm-up. A session accepts imports only from
activated_at+ 75 s (fence proof retention 60 s plus a 15 s margin), so every replica shows the session active before the first backdated row commits. Until then imports are refused withinvalid: import session warming(retryable) and the active 30623 snapshot carries["accepts_after", "<unix seconds>"].resolvenow also refuses fence proofs older than retention.Active-session caps.
BUZZ_IMPORT_MAX_ACTIVE_SESSIONS_PER_CHANNEL(default 2) andBUZZ_IMPORT_MAX_ACTIVE_SESSIONS_PER_PROPOSER(default 8), counted under advisory locks, so a member cannot pin channels to the writer at will. A resend of a stored proposal is still answeredduplicate:.Atomic writes. Rules 2 to 7 are re-checked under the session row lock, in the same transaction that inserts the event and increments the author's counter. Concurrent publishes cannot overshoot a declared count. A resent event, control events included, returns
duplicate:even after expiry.No agents. Imported history never reaches agents, on push or pull paths:
/querymode drop import-tagged events for agent-authenticated readers (fail closed on a lookup error)Limits. Declared counts are capped per participant and per session (
BUZZ_IMPORT_MAX_EVENTS_PER_PARTICIPANTdefault 50000,BUZZ_IMPORT_MAX_EVENTS_PER_SESSIONdefault 200000). The range starts no earlier than 2000-01-01 and ends in the past. Imports use their own rate limit (BUZZ_RATE_LIMIT_IMPORT_EVENTS_PER_MIN, default 600).BUZZ_IMPORT_SESSION_MAX_DAYS(default 30) caps session lifetime.Strict control records. Each control kind accepts only its spec tags. A consent must name the proposer. A participant who has left the channel can still send kind:42113.
DMs. The participant set must equal the DM member set, at proposal time and again on every imported event.
Quiet writes. Imported events are stored, searchable, audited and fanned out to human channel readers. They produce:
last_reply_atbumpControl records are live activity and do create mention rows.
Snapshot. Republished after each control event, on lazy expiry, and every 50 accepted events per participant. It is stored in the session's channel, so it uses the channel read gate.
Storage. Migration 0081, plus the desired-state schema, deletion inventory, purge coverage and catalog parity for both tables.
Risk
How to test
The e2e test runs over
POST /eventsand/queryand covers the session lifecycle and its rejections. It also checks that the mentions feed excludes an imported mention (with a live mention as the control) and that a non-member reads neither the snapshot nor the history.Follow-ups
feed_types: ["mentions"]yet.🤖 Generated with Claude Code