Repository navigation
Conversation
ijoukov
force-pushed
the
agent/preserve-cli-edit-attachments
branch
from
July 28, 2026 03:59
5d1ca9a to
a4580ac
Compare
ijoukov
marked this pull request as ready for review
July 28, 2026 04:01
ijoukov
force-pushed
the
agent/preserve-cli-edit-attachments
branch
from
August 2, 2026 02:38
a4580ac to
cde4b47
Compare
Buzz edit events replace both message content and attachment metadata. Resolve the original message plus its latest kind 40003 edit so repeated CLI edits preserve the effective attachment state instead of resurrecting an older set. Carry forward the complete imeta set and the trailing Markdown references required for rendering. Preserve existing file labels and spoiler formatting, synthesize missing references when metadata and content have drifted, avoid duplicates, and retain --clear-attachments as the explicit destructive path. Add an SDK edit-builder variant for full attachment sets and regression coverage for preservation, clearing, replacement, deduplication, and the signed HTTP command payload. Fixes block#3022 Signed-off-by: Ivan Joukov <[email protected]>
ijoukov
force-pushed
the
agent/preserve-cli-edit-attachments
branch
from
October 4, 2026 17:16
cde4b47 to
9999822
Compare
🔐 Codex Security Review
|
bradseiler
added a commit
that referenced
this pull request
Nov 8, 2026
## Summary Editing attachment messages through `buzz messages edit` can remove their files from the effective message. Preserve the latest live imeta set across successive edits and add `--clear-attachments` for explicit removal. Add an SDK builder for complete replacement attachment sets while preserving the existing API. The relay provides a versioned effective-edit lookup on `/query` for kinds 9/40002/40008/45001/45003; media reads fold the same set. It uses the existing normalized-target index, fresh channel authorization, and a primary snapshot. Generic `#e` matching is unchanged. Mixed-case historical edits cannot restore removed files, including when another reference would allow republication. ### Related issue Fixes #3022. Follows #9077. Related open attempts: #3062 and #3065. ### Testing Published head: `c630c4ebf0b20a9618f4844629eec1e666699cbe`, through all mandatory push hooks. The governed-five snapshot passed all four PostgreSQL/HTTP acceptance tests with `RUST_MIN_STACK` unset and 3,333 affected-package tests. The committed test-only array correction passed clippy and the preflight rerun. Independent mutations detected dropped read/lookup kinds, the CLI two-kind split, and preflight ordering, channel and live-edit errors. The published follow-up adds forum preview retention/suppression and a deleted-original preflight fixture; both surviving mutations now fail as intended. Independent review verified the fixes. All four acceptance tests pass; the full DB/relay run had two NIP-FI failures that passed in isolation. The actual standalone MCP workflow passed against this relay and clean local app `5b583b8c69596353bc37e9f3938eca1aabcd081e`: 15 MCP edits, 10 direct publications and 60 member GET/HEAD checks across five isolated blob pairs. Both tested heads are now published. Relay hosted checks report 80 successful and 31 skipped, with none pending or failed; app hosted checks and human upload → edit → clear → edit → GET/HEAD confirmation remain pending. No human acceptance is claimed. ### Rollout The lookup, CLI preservation/clear and media reads use kinds 9/40002/40008/45001/45003. Deploy the relay before releasing the CLI and paired [MCP producer](block/buzz-app#2937). New clients abort without publishing against an unsupported relay. Old CLI edits emit empty imeta and now revoke diff/forum attachments that previously remained readable. Other channel-tagged kinds retain the historical plain-edit path. No additional schema change is needed beyond migration 0086. Readiness remains blocked by mobile edits that omit imeta, the app UI fold that can restore older files, unaudited SDK/direct callers and unmeasured historical exposure. Run `docs/sql/private-media-edit-preflight.sql` for each community; producer updates do not repair signed historical edits. No enforce activation is authorized. `off` skips policy checks, `shadow` changes policy metrics while allowing policy failures, and `enforce` denies inaccessible references. Observe `buzz_media_publication_access_total{mode="shadow",reason="denied"}`. Prefer rolling back the client release while retaining the additive lookup. A relay rollback makes new CLI/MCP edits fail closed; already-published imeta remains valid under the older reference rules. Concurrent edits still use `(created_at,id)` without compare-and-swap. Generated with Codex --------- Signed-off-by: Brad Seiler <[email protected]> Co-authored-by: Honor <e0bf479eeebe47dde1e35705212a4df70616a7bc834d907ddfb18cf0405f8b1b@seiler-test.communities.public.builderlabstaging.xyz>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3022. Editing message text with
buzz messages editcurrently removes attachments because kind40003edits replace both content and attachment metadata.The CLI now resolves the original message and its latest edit, carries forward the complete effective
imetaset, and preserves attachment Markdown references, labels, and spoiler formatting. Missing references are synthesized and caller-provided references are deduplicated.--clear-attachmentsexplicitly removes attachments; subsequent edits keep them cleared.A new SDK builder accepts the complete attachment set while preserving the existing
build_editAPI.Related open PR: #3065.
Validation
Rebased onto upstream main
f0eb5575ffc9d5f57af4ed3f574529d997c83a0dand resolved test-import conflicts.cargo test -p buzz-sdk -p buzz-cli: 819 tests passed.cargo clippy -p buzz-sdk -p buzz-cli --all-targets -- -D warnings: passed.cargo clippy --workspace --all-targets -- -D warnings: passed.git diff --check: passed.just ci: attempted; stopped at desktop Tauri clippy because this Linux environment lacks the requiredglib-2.0/GTK/WebKit development libraries. The full local gate has not passed.Regression coverage includes attachment preservation, explicit clearing, latest-edit replacement, cleared-state persistence, reference/spoiler handling, and the signed HTTP command payload.
GitHub Actions
The previous CI, Docker image, and Desktop Release Candidate runs never executed their jobs. Each expired awaiting fork-workflow approval. GitHub's annotation states: "This workflow run required approval but was not approved before it expired."
Previous CI run. The refreshed CI, Docker image, and Desktop Release Candidate runs are awaiting fork-workflow approval (
action_required). A repository maintainer must approve them before their jobs can execute.