identity tier

identity-user-prefs

Per-user preferences (locale now; timezone/notifications later) keyed to auth users. Typed, FK-backed; the single source for resolve_locale.

Per-user preferences (locale now; timezone/notifications later) keyed to auth users. Typed, FK-backed; the single source for resolve_locale.

Tieridentity
Roleunclassified (baselined)
Pathcrates/identity/user-prefs
Edition2021
Targetsidentity_user_prefs, integration_tests
Public items0 across 0 modules
Tests24

What it is for

identity-user-prefs — per-user preferences keyed 1:1 to an auth user.

Owns the user_preferences table (typed, FK'd to auth.users) and the canonical resolve_locale helper. Holds the user-adjustable settings that follow the user (locale now; timezone / notifications later).

# Why a dedicated library crate (and not infrastructure-preferences) The generic infrastructure-preferences K/V store (scope/namespace/key/JSONB) can hold a per-user value but cannot express a typed locale column, an FK to users, or supported-set validation as a boundary invariant. Auth owns identity, not user-adjustable settings (Gate-1.5 consensus). So per-user identity-adjacent prefs live here, typed and FK-backed.

# The single locale source Every locale-aware surface calls resolve_locale rather than reading the column directly, so precedence (user pref → tenant/site default → framework fallback) lives in one place and Forge never hardcodes a default language.

Capabilities

No public items.

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

No public items.

Re-exports. Exported here, defined elsewhere.

ExportDefined in
Localefoundation_i18n::Locale
LocaleSettingsstate::LocaleSettings
SupportedLocalessupported::SupportedLocales
resolve_localeresolve::resolve_locale
{Theme,UserPreferences}model::{Theme,UserPreferences}
{UserPrefsError,UserPrefsResult}error::{UserPrefsError,UserPrefsResult}
{get_locale,get_or_create_default,set_locale,set_theme}repo::{get_locale,get_or_create_default,set_locale,set_theme}

Boundary

Reaches into foundation.

Shares tier identity with 7 other crates: identity-auth, identity-identifiers, identity-impersonation, identity-parties, identity-party-places, identity-rbac, identity-tenant.

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)identity
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/identity/user-prefs
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_identity["identity"] --> n_foundation["foundation"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-i18n`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
tokio^1fullnoalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
dotenvy^0.15noalways
tokio^1full, rt-multi-thread, macrosnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_auth["application-auth"] -->|uses| SELF
  SELF["identity-user-prefs"]
  SELF -->|runtime| n_foundation_i18n["foundation-i18n"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

FeatureEnablesOn by default
postgresno
flowchart LR
  n_postgres["postgres"]

Targets

KindNameSource
libidentity_user_prefs`src/lib.rs`
testintegration_tests`tests/integration_tests.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimeyes
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-auth.

Verification

KindCount
Unit tests16
Integration tests8
Examples0
Doctests0

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc00
Public modules with a //! block00

Metrics

MetricValue
Rust source files7
Source lines603
Code lines338
Public API items0
Public modules0
Tests24
Examples0
Cargo features1
Direct runtime dependencies7
Workspace reverse dependencies1
pie showData
    title Rust source composition
    "Code" : 338
    "Blank or comment" : 265

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All identity · Manual