Skip to content

feat(announcements): add the announce validator and the publishing doc - #891

Open
grunch wants to merge 1 commit into
feat/announcements-surfacefrom
feat/announcements-tool
Open

grunch wants to merge 1 commit into
feat/announcements-surfacefrom
feat/announcements-tool

Conversation

@grunch

@grunch grunch commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Linked issue

Part of #319 (step 5 of specs/006-announcement-channel/spec.md §10). Stacked on #890; the last PR of the stack closes the issue.

Type

feat

What changes and why

The reader's failure mode is silence: publish a malformed announcement and nothing tells you, on either end. rust/src/bin/announce.rs turns a draft JSON into the unsigned kind 38387 event through the app's own parser (nostr::announcements::parse_body), so it cannot accept what the app would drop, and it refuses what the app merely tolerates — an unknown severity, a non-https link, an expiry in the past, an empty version range, a draft field it does not know. It never signs: the key stays offline with nak. docs/ANNOUNCEMENTS.md is the procedure. CLAUDE.md and README.md point at it.

Affected flow

No app flow. A maintainer's command: cargo run --bin announce -- --template, then cargo run --bin announce -- draft.json --out event.json, then nak event --sec … <relays> < event.json.

Blast radius

  • rust/Cargo.toml: rlib added to crate-type so the binary links the library. FRB and cargokit keep the cdylib / staticlib; wasm-pack build builds --lib, and on wasm32 the binary is an empty main so cargo check --target wasm32-unknown-unknown stays green. No dependency added, Cargo.lock untouched (--locked holds).
  • cargo build / cargo clippy -- -D warnings now also build the binary (clean).
  • No persisted data, no bindings, no localization, no wire change.

Platforms tested

Linux: cargo build, cargo test --bin announce, cargo clippy --locked -- -D warnings, rustfmt --check on the new file.

Manual testing

Setup

cd rust, nak installed, a throwaway key (nak key generate).

Steps

  1. cargo run --bin announce -- --template > draft.json. Expected: a draft with id, expires_in_days: 14, severity: info, url and seven empty locales.
  2. Run cargo run --bin announce -- draft.json on it unedited. Expected: ✗ \locales.en.title` is empty`, exit 1.
  3. Fill the seven locales, set "severity": "urgent" and "url": "http://mostro.network/". Expected: two problems reported at once — the severity the app would show as a warning, the url it would drop — exit 1.
  4. Fix both and run with --out event.json. Expected: a summary on stderr (id, severity, expiry in days, reaches every version, url, the seven titles), ✓ unsigned event written to event.json; the file is a kind 38387 event with z and y tags and no sig.
  5. nak event --sec <throwaway> wss://relay.mostro.network < event.json then nak req -k 38387 -a <its npub> wss://relay.mostro.network. Expected: the signed event comes back from the relay. (The app ignores it: the throwaway key is not on the allowlist.)
  6. Regression: ./scripts/build-web.sh still produces web/pkg/ (the binary is out of the wasm build).

Not covered

Publishing with a real key (#892).

Screenshots

No visible change.

Automated tests

rust/src/bin/announce.rs tests (9): a filled template clears the app's parser and carries z and y; a missing locale is named; what the app tolerates the tool refuses (severity, url); an expiry in the past, both expiry forms at once, an empty version range and build metadata in a bound are refused; the template names every locale; an unknown draft field is refused.

Checklist

  • cd rust && cargo clippy -- -D warnings && cargo test pass locally (cargo fmt --check already fails on main for rust/src/api/bond.rs; the new file is formatted)
  • flutter analyze and flutter test unaffected (no Dart change)
  • Changed rust/src/api/ or an .arb: no
  • New or changed user-facing text: none
  • Changed an automation identifier: n/a
  • Protocol or transport change: none (it emits the event the protocol's announcement_event.md describes)
  • Behaviour or contract change: spec §8 records what the tool settled; docs/ANNOUNCEMENTS.md added
  • Commits are signed
  • I ran the Manual testing steps myself — steps 1–4 are what the unit tests exercise; 5–6 not run

AI assistance

Written with Claude Code, the whole diff.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T23:52:38.715610Z fa4e2c3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@grunch

grunch commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Step 5 of specs/006 §10. rust/src/bin/announce.rs turns a draft into the
unsigned kind 38387 event through the app's own parser, so it cannot
accept what the app would drop, and refuses what the app merely
tolerates (an unknown severity, a non-https link, an expiry in the past,
an empty version range). It never signs: the key stays offline with nak.
docs/ANNOUNCEMENTS.md is the procedure. The lib gains the rlib crate
type the binary links against.
@grunch
grunch force-pushed the feat/announcements-surface branch from a3a9b02 to 79179cd Compare October 24, 2026 00:36
@grunch
grunch force-pushed the feat/announcements-tool branch from fa4e2c3 to ee60f28 Compare October 24, 2026 00:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant