element-hq / element-hq/synapse

Int vs Bool confusion for the fields returned by the users admin API

Open
#16,733 3 comments 0 reactions 0 assignees View on GitHub
A-Docs T-Task
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#16733](https://github.com/matrix-org/synapse/issues/16733).

---

### Description

The List Accounts User Admin API (`GET /_synapse/admin/v2/users`) used to be returning certain boolean-like fields as integers (e.g. `"is_guest": 0`).

The [v1.97.0 documentation page](https://github.com/matrix-org/synapse/blob/v1.97.0/docs/admin_api/user_admin_api.md) shows examples that use integers (e.g. `"is_guest": 0`) while actually saying something like:

> The following fields are returned in the JSON response body:
> ...
> `is_guest` - `bool` - Status if that user is a guest account.

This is confusing - is it an integer or a boolean that we're receiving?

However, going back to [the documentation for an ancient version (like v1.35.0)](https://github.com/matrix-org/synapse/blob/v1.35.0/docs/admin_api/user_admin_api.rst), one can read the same exact thing.

On that old version, I believe the API was definitely returning integers, not booleans.

However, on v1.97.0 (at least.. possibly even earlier), the API seems to have started returning booleans. It may be an accidental change. It may have been announced in some release notes and I may have missed it.

Nevertheless, I believe the documentation page is confusing (is it a bool or an integer?) and potentially out of date now - it needs fixes.

Related to: https://github.com/devture/matrix-corporal/issues/30

### Steps to reproduce

1. Run Synapse v1.97.0
2. Use the `GET /_synapse/admin/v2/users` API with an admin token
3. Observe that various fields (`is_guest`, `admin`, `deactivated`, `shadow_banned`, `approved`, `erased`, `locked`) all a boolean type of value (`false` or `true`). On previous versions, integers (`0`, `1`) were used.

### Homeserver

another homeserver

### Synapse Version

1.97.0

### Installation Method

Docker (matrixdotorg/synapse)

### Database

PostgreSQL (irrelevant)

### Workers

Multiple workers

### Platform

VM + containers

### Configuration

_No response_

### Relevant log output

```shell
None
```

### Anything else that would be useful to know?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.