collab: Make account age-related fields required in LlmTokenClaims (#26959)

This PR makes the account age-related fields required in
`LlmTokenClaims`.

We've also removed the account age check from the LLM token issuance
endpoint, instead having it solely be enforced in the `POST /completion`
endpoint.

This change will be safe to deploy at ~8:01PM EDT.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-17 19:54:44 -04:00 committed by GitHub
parent 0851842d2c
commit cd5d7e82d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 26 deletions

View file

@ -20,17 +20,10 @@ pub struct LlmTokenClaims {
pub system_id: Option<String>,
pub metrics_id: Uuid,
pub github_user_login: String,
// This field is temporarily optional so it can be added
// in a backwards-compatible way. We can make it required
// once all of the LLM tokens have cycled (~1 hour after
// this change has been deployed).
#[serde(default)]
pub account_created_at: Option<NaiveDateTime>,
pub account_created_at: NaiveDateTime,
pub is_staff: bool,
pub has_llm_closed_beta_feature_flag: bool,
#[serde(default)]
pub bypass_account_age_check: bool,
#[serde(default)]
pub has_predict_edits_feature_flag: bool,
pub has_llm_subscription: bool,
pub max_monthly_spend_in_cents: u32,
@ -65,7 +58,7 @@ impl LlmTokenClaims {
system_id,
metrics_id: user.metrics_id,
github_user_login: user.github_login.clone(),
account_created_at: Some(user.account_created_at()),
account_created_at: user.account_created_at(),
is_staff,
has_llm_closed_beta_feature_flag: feature_flags
.iter()