matrix-org / matrix-org/rust-synapse-compress-state
Gracefully handle case where the given room ID on the CLI is not valid
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 173
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
Of all the things, I know this is probably... okay, *nonexistent* on the priority queue, but.
When an invalid / non-existent room ID is given to the `-r` option, the tool crashes:
```
# ./synapse_compress_state -p ... -r '!this_is:not.valid'
Fetching state from DB for room '!this_is:not.valid'...
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/database.rs:162:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
I learned this when my monthly clean-up script was wrapping room IDs in double quotes, and everything was... unceremoniously failing. It seems like, as just a small user experience enhancement, it might be a good idea to catch this case and gracefully inform that `Room '!this_is:not.valid' doesn't exist.`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/database.rs:162 and reproduce the failure by invoking the tool with the CLI -r option and a nonexistent room ID. The work is done when that input no longer panics and instead reports that the specified room does not exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100