@tristan2828/ui-foundation 4.24.0 → 4.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,11 @@ React Router v7, TanStack Query. The shared layer — primitives, the
6
6
  `DataTable`/`EntityView`/`EntityForm` composites, the app shell, auth,
7
7
  the gateway error seam, design tokens, lint rules — is the npm package
8
8
  `@tristan2828/ui-foundation`, updated by bumping its version. Everything in
9
- `src/` is this app's own.
9
+ `src/` is this app's own. The backend's auth and security layer (sign-in,
10
+ sessions, limits, TOTP, error reporting, deploy checks) is the pip package
11
+ `ui-foundation-backend` (`foundation_backend`), pinned in
12
+ `backend/pyproject.toml` to the same version; never copy one of its
13
+ modules into `backend/app/`.
10
14
 
11
15
  Contract-first: `openapi.yaml` is the source of truth and is owned by this
12
16
  app. In development MSW serves the contract, so there may be no backend at
@@ -605,10 +605,11 @@ asyncio is a `MissingGreenlet` and a 500.
605
605
  - **After a commit, read by a `user_id` saved before it, never by the
606
606
  `User`.** Take `user_id = user.id` at the top of the handler and use that
607
607
  from then on; or `await session.refresh(user)` first, as `_start_session`
608
- in `routers/auth.py` does to return it.
608
+ in `foundation_backend/routers/auth.py` does to return it.
609
609
  - **Test signed in for real.** The backend's `client` fixture
610
610
  (`tests/conftest.py`) holds a `sessions` row and sends its cookie,
611
- so the real `get_current_user` runs (`tests/signed_in.py`). Never stand
611
+ so the real `get_current_user` runs (`session_cookie` from
612
+ `foundation_backend.testing.signed_in`). Never stand
612
613
  a `User(...)` in for `get_current_user` in an override: a detached user
613
614
  never expires, so the test passes and the route fails live.
614
615
 
@@ -28,7 +28,8 @@ export async function loginTotp(input) {
28
28
  return { user: res.body };
29
29
  }
30
30
  // Auto-logs in on success — the backend sets the same session cookie
31
- // /auth/login does (see backend/app/routers/auth.py's _start_session), so
31
+ // /auth/login does (see _start_session in the backend package's
32
+ // foundation_backend/routers/auth.py), so
32
33
  // the gateway shape is identical to login's: a User on 200, AppError
33
34
  // otherwise (a duplicate email arrives as kind:'validation' with
34
35
  // fieldErrors.email, same as any other field error).
@@ -10,8 +10,8 @@ export function resolveErrorReporting(option) {
10
10
  return option === true ? {} : option;
11
11
  }
12
12
  // A query string or fragment in a URL or path, up to a stack frame's
13
- // trailing :line:col (the backend's scrub, in app/error_reporting.py, is
14
- // the same rule).
13
+ // trailing :line:col (the backend's scrub, in
14
+ // foundation_backend/error_reporting.py, is the same rule).
15
15
  const URL_QUERY = /(\b[a-z][a-z0-9+.-]*:\/\/[^\s?#"'()]+|(?<![\w/])\/[^\s?#"'()]*)[?#][^\s"'()]*?(?=(?::\d+){1,2}(?=[\s"'()]|$)|[\s"'()]|$)/gi;
16
16
  export function scrub(text, limit) {
17
17
  const cut = text.replace(URL_QUERY, "$1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.24.0",
3
+ "version": "4.25.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {