feat(proto): enum hygiene for rule export format and account TLS #356

Merged
KofTwentyTwo merged 1 commits from story/ws-a5-enum-hygiene into dev 2026-07-31 22:28:22 +00:00
KofTwentyTwo commented 2026-07-31 22:26:01 +00:00 (Migrated from github.com)

Summary

  • Adds RuleExportFormat (UNSPECIFIED/SQL/JSON) as a dedicated proto enum for ExportRulesRequest.format, replacing the stringly "sql"/"json" field. Not reusing the mailbox Export service's ExportFormat enum: its members (MBOX/EML_ZIP/JSON/JSONL) describe portable mailbox output, not rule rendering, and the two enums share no members or meaning. UNSPECIFIED is rejected with invalid_argument by the daemon (export_rules in crates/nunciod/src/grpc.rs); the CLI's filter export --format parses sql/json case-insensitively before dialing and errors on anything else.
  • Drops AccountConfig.use_tls from the wire contract (reserved 7; reserved "use_tls";) and from nuncio_core::AccountConfig. It duplicated imap_tls_mode/smtp_tls_mode and a repo-wide grep confirmed it was never read for behavior anywhere (daemon, CLI, store, validation) -- only ever written and ignored. The SQLite accounts.use_tls column is kept (with a DEFAULT 1) for on-disk compatibility with existing rows; save_account/list_accounts/salvage code no longer read or write it from a struct field.
  • Regenerated the nuncio.v1 descriptor golden (crates/nuncio-proto/proto/nuncio/v1/descriptor.bin).

Test plan

  • cargo fmt --all -- --check
  • cargo check-all (clippy --all-targets --workspace -D warnings, 0 warnings)
  • cargo test-all -- all crates pass, 0 ignored (workspace total incl. new export_rules_rejects_unspecified_format test in nunciod::grpc::tests)
  • cargo test -p nuncio-proto contract_stability -- golden matches
## Summary - Adds `RuleExportFormat` (UNSPECIFIED/SQL/JSON) as a dedicated proto enum for `ExportRulesRequest.format`, replacing the stringly `"sql"`/`"json"` field. Not reusing the mailbox `Export` service's `ExportFormat` enum: its members (MBOX/EML_ZIP/JSON/JSONL) describe portable mailbox output, not rule rendering, and the two enums share no members or meaning. `UNSPECIFIED` is rejected with `invalid_argument` by the daemon (`export_rules` in `crates/nunciod/src/grpc.rs`); the CLI's `filter export --format` parses `sql`/`json` case-insensitively before dialing and errors on anything else. - Drops `AccountConfig.use_tls` from the wire contract (`reserved 7; reserved "use_tls";`) and from `nuncio_core::AccountConfig`. It duplicated `imap_tls_mode`/`smtp_tls_mode` and a repo-wide grep confirmed it was never read for behavior anywhere (daemon, CLI, store, validation) -- only ever written and ignored. The SQLite `accounts.use_tls` column is kept (with a `DEFAULT 1`) for on-disk compatibility with existing rows; `save_account`/`list_accounts`/salvage code no longer read or write it from a struct field. - Regenerated the `nuncio.v1` descriptor golden (`crates/nuncio-proto/proto/nuncio/v1/descriptor.bin`). ## Test plan - [x] `cargo fmt --all -- --check` - [x] `cargo check-all` (clippy `--all-targets --workspace -D warnings`, 0 warnings) - [x] `cargo test-all` -- all crates pass, 0 ignored (workspace total incl. new `export_rules_rejects_unspecified_format` test in `nunciod::grpc::tests`) - [x] `cargo test -p nuncio-proto contract_stability` -- golden matches
Sign in to join this conversation.