Skip to content

feat: implements allow_new_users setting#2304

Open
HorlogeSkynet wants to merge 3 commits into
mozilla-services:masterfrom
HorlogeSkynet:feat/allow_new_users
Open

feat: implements allow_new_users setting#2304
HorlogeSkynet wants to merge 3 commits into
mozilla-services:masterfrom
HorlogeSkynet:feat/allow_new_users

Conversation

@HorlogeSkynet

Copy link
Copy Markdown
Contributor

Description

New allow_new_users setting, useful for self-hosted nodes.

Testing

⚠️ Not functionally tested at the moment.

Set SYNC_TOKENSERVER__ALLOW_NEW_USERS to false and no new users allocation should occur.

Issue(s)

Closes #1429.

@HorlogeSkynet HorlogeSkynet force-pushed the feat/allow_new_users branch from a17eef7 to c7ab2fe Compare May 13, 2026 19:35
@HorlogeSkynet HorlogeSkynet marked this pull request as ready for review May 13, 2026 19:36
Comment thread tokenserver-db/src/tests.rs Outdated
Comment thread tokenserver-db-common/src/error.rs
Comment thread tokenserver-db-common/src/lib.rs
@chenba

chenba commented May 19, 2026

Copy link
Copy Markdown
Collaborator

@HorlogeSkynet Thank you for the patch. I just tried running the tests and there is a failure. See comments above.

@HorlogeSkynet HorlogeSkynet force-pushed the feat/allow_new_users branch from c7ab2fe to 40a5ca6 Compare May 19, 2026 19:45
@HorlogeSkynet HorlogeSkynet requested a review from chenba May 20, 2026 21:21
@HorlogeSkynet

Copy link
Copy Markdown
Contributor Author

Any news @chenba ? 🙂

@HorlogeSkynet HorlogeSkynet force-pushed the feat/allow_new_users branch from 40a5ca6 to 76e70ad Compare June 7, 2026 20:23
@chenba

chenba commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Any news @chenba ? 🙂

I'm sorry. I got distracted/busy. I should have time to take a look today. Thanks for the reminder.

@chenba chenba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a couple comments wrt error handling.

Comment thread tokenserver-db-common/src/error.rs
kind,
status: StatusCode::NOT_FOUND,
backtrace: Box::new(Backtrace::new_unresolved()),
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When impl From<DbError> for TokenserverError converts an error of this type we'd end up with a HTTP 503. That's misleading for the clients. (We don't want them to retry at the very least.) Whatever error we add here for the feature should become a HTTP 403.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By explicitly matching DbErrorKind::UserNotCreated kind in this context, I guess we prevent _ from converting it to a HTTP 503 by default ?
I've updated the pattern matching to throw a 403 FORBIDDEN as you proposed. Tell me whether it suits what you had in mind.

@HorlogeSkynet HorlogeSkynet force-pushed the feat/allow_new_users branch from 76e70ad to 8b1da2e Compare June 10, 2026 21:21
@HorlogeSkynet HorlogeSkynet requested a review from chenba June 10, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow_new_users setting

2 participants