refactor: cleanup stories #87-92 (perf, idiomatic, infra, WS-token security) #107
No reviewers
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom!107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/cleanup-87-92"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bundles the six cleanup stories (#87–#92) into one PR, per request.
#89 — Server idiomatic cleanup
StorageErrornow derivesDisplay/Errorvia thiserror (identical strings; the branchingFrom<sqlx::Error>stays manual).new_idno longer panics on ULID monotonic overflow — falls back toUlid::new(); the generator lock recovers from poisoning..expect("…poisoned")).event_jsonlogs awarn!on serialization failure instead of silently returningNone.#![allow(dead_code)]replaced with targeted per-item allows.aftercursor — left untouched to avoid response changes.#88 — Tauri core cleanup
ed25519-dalekzeroize feature on; intermediate mnemonic strings wrapped inZeroizing.get_signing_key_for/get_seed_forinto oneload_seed_for.ACTIVE_ACCOUNTswitched toparking_lot::Mutex(no poisoning).load_accounts_indexsurfaces a distinct error on a corrupt index instead of silently treating it as empty.#90 — Bot SDK cleanup
with_configinit, 21 builder methods, 21-arm dispatch) collapse into onedefine_handlers!op↔event table; a single genericHandler<T>replaces 15 aliases.Bot { config, handlers }— no more field-by-field copy inrun().decentcom_bot::Configvia#[serde(flatten)]+apply_env_overrides(); fixes modbot/auditbot silently droppingseed_hex.futures-util.#87 — Frontend performance
App/AppShelluseuseShallownarrow selectors (no more whole-store re-renders).React.memo(MessageItem); message + member lists virtualized with@tanstack/react-virtual.MessageItemthread-fetch effect depends on primitives, not object identity.#91 — Frontend cleanup + WS-token security
?token=, landing in proxy/access logs): server reads anAuthorization: Bearerheader (Rust SDK) or anaccess_token.<token>WebSocket subprotocol (browser — the one header browsers can set), echoing backdecentcom.v1; the URL query path is removed. SDK sends a bearer header; web client sends the subprotocol. Tokens are hex, so subprotocol-safe.utils/pubkey.ts+utils/address.ts(dedupedtruncatePubkey/shortPubkey/normalizeAddress);ProfilePopover's distinct truncation left intact.serverStore: extractedloadServerData();MESSAGE_CREATEdoes a sorted insert instead of a full re-sort.extractErrorMessage()reused byapiRequestanduploadFile.KeySafety/Setupclear the in-memory seed phrase (and best-effort clipboard) on completion.#92 — Build/infra
anyhow, toml, url, bip39, reqwest, tokio-tungstenite, wiremockinto[workspace.dependencies].tokiofor the SDK + bots (rt-multi-thread, macros, sync, time, net, notfull).sednow fails loudly via agrep -qguard instead of silently no-oping.cargo audit --ignore RUSTSEC-…chain into.cargo/audit.toml(one per line, with rationale); CI just runscargo audit.cargo fmt --all -- --checkto CI + a workspace-wide format pass (isolated in its ownstyle:commit).package-lock.jsonwith an updated pnpmpnpm-lock.yaml(what CI installs from).k8srunner. I can't provision a native arm64 runner or safely verify a CI change, so I documented the faster options (native runner / cross-compile / drop arm64) inline inrelease.ymlrather than ship an unverifiable break. Your call.Verification
cargo build --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --all --check— all cleancargo test --workspace— 204 passedbuildok,lintclean, 89 vitest tests passCloses #88, #89, #90, #92. Part of #87, #91 (the pagination-unification sub-item of #89 and the arm64-runner sub-item of #92 are intentionally left, noted above).
🤖 Generated with Claude Code
- Replace the 21-handler triplication (`struct Bot` fields, `with_config` init, `struct Handlers`, 21 builder methods, 21-arm dispatch) with one `define_handlers!` op↔event table that generates the `Handlers` struct, the `on_*` builder methods, and the `dispatch` match. A single generic `Handler<T>` alias replaces the 15 per-type aliases. Adding an event is now one table row + one `Event` variant. - Fold `Bot`'s handler fields into the `Handlers` struct it owns (`Bot { config, handlers }`), removing the field-by-field copy in `run()`. - Example bots embed `decentcom_bot::Config` via `#[serde(flatten)]` and call the new `Config::apply_env_overrides()` instead of re-implementing the env-override block. This fixes modbot/auditbot silently dropping `seed_hex` (they hard-coded `seed_hex: None`). - Remove the unused `futures-util` dependency from bot-sdk. Part of #90 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>- Hoist repeated third-party deps into `[workspace.dependencies]` and switch member crates to `{ workspace = true }`: anyhow, toml, url, bip39, reqwest, tokio-tungstenite, wiremock. - Slim tokio for the non-server crates (SDK + bots) to `rt-multi-thread, macros, sync, time, net` instead of `full`. - Dockerfile: the `sed` that drops the Tauri client workspace member now fails loudly (via a `grep -q` guard) if the member line isn't found, instead of silently no-oping when the manifest is reformatted. - Move the long inline `cargo audit --ignore RUSTSEC-...` chain into `.cargo/audit.toml`, one advisory per line with a rationale; CI just runs `cargo audit`. - Add `cargo fmt --all -- --check` to CI (the formatting pass itself is the next commit) and note the arm64/QEMU release tradeoff + faster options inline. - Replace the stray npm `package-lock.json` (accidentally introduced) with an updated pnpm `pnpm-lock.yaml`, which is what CI installs from. Closes #92 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>