matrix-org / matrix-org/rust-synapse-compress-state

Gracefully handle case where the given room ID on the CLI is not valid

Open
#59 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.