feat(api): account-wide naming instructions in userSettings
What & why
Second of three PRs for #9197. Depends on #9387. This is a fork PR, so it can't be stacked on that branch and also contains its commit. Review only the top commit, feat(api): account-wide naming instructions in userSettings.
userSettings now carries the person's account-wide naming instructions:
getreturns a newnamingInstructions: string | nullfield. Accounts without a row getnull.updatetakes a new optionalnamingInstructions: string | null(max 2000 characters, the same limit as the per-project field on the host). The value is trimmed, and blank saves asnull.
Compatibility (trpc-compat): both changes are additive. Every existing input stays valid, nothing is tightened, and the output only gains a field. Released desktop and mobile builds call get and update({ experimentalChat }) and are unaffected. The update handler builds the set object explicitly, so a call that omits a field never writes it.
How I tested it
user-settings.test.ts:- an account with no row gets the defaults, including
namingInstructions: null updatestores only the fields it was given- naming instructions are trimmed, and blank clears them to
null
- an account with no row gets the defaults, including
- In the dev desktop app against the local API: saving the global field (PR 3) wrote the text to
user_settings.naming_instructionsfor the signed-in user, checked in the DB.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
- I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Adds account-wide naming instructions to userSettings, the second of three PRs for #9197. get now returns namingInstructions: string | null (null when the account has no row), and update accepts an optional namingInstructions field up to 2000 characters; values are trimmed and blank strings are saved as null. Both changes are additive, so existing clients that pass experimentalChat only are unaffected. Adds a naming_instructions column to user_settings in migration 0190_user_settings_naming_instructions.