Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@coderabbitai review |
|
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.
a3a9b02 to
79179cd
Compare
fa4e2c3 to
ee60f28
Compare
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.rsturns a draft JSON into the unsigned kind38387event 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 unknownseverity, a non-httpslink, an expiry in the past, an empty version range, a draft field it does not know. It never signs: the key stays offline withnak.docs/ANNOUNCEMENTS.mdis the procedure.CLAUDE.mdandREADME.mdpoint at it.Affected flow
No app flow. A maintainer's command:
cargo run --bin announce -- --template, thencargo run --bin announce -- draft.json --out event.json, thennak event --sec … <relays> < event.json.Blast radius
rust/Cargo.toml:rlibadded tocrate-typeso the binary links the library. FRB and cargokit keep the cdylib / staticlib;wasm-pack buildbuilds--lib, and onwasm32the binary is an emptymainsocargo check --target wasm32-unknown-unknownstays green. No dependency added,Cargo.lockuntouched (--lockedholds).cargo build/cargo clippy -- -D warningsnow also build the binary (clean).Platforms tested
Linux:
cargo build,cargo test --bin announce,cargo clippy --locked -- -D warnings,rustfmt --checkon the new file.Manual testing
Setup
cd rust,nakinstalled, a throwaway key (nak key generate).Steps
cargo run --bin announce -- --template > draft.json. Expected: a draft withid,expires_in_days: 14,severity: info,urland seven empty locales.cargo run --bin announce -- draft.jsonon it unedited. Expected:✗ \locales.en.title` is empty`, exit 1."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.--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 kind38387event withzandytags and nosig.nak event --sec <throwaway> wss://relay.mostro.network < event.jsonthennak 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.)./scripts/build-web.shstill producesweb/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.rstests (9): a filled template clears the app's parser and carrieszandy; 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 testpass locally (cargo fmt --checkalready fails onmainforrust/src/api/bond.rs; the new file is formatted)flutter analyzeandflutter testunaffected (no Dart change)rust/src/api/or an.arb: noannouncement_event.mddescribes)docs/ANNOUNCEMENTS.mdaddedAI assistance
Written with Claude Code, the whole diff.