@fuzdev/fuz_app 0.162.0 → 0.163.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.
Files changed (121) hide show
  1. package/dist/auth/CLAUDE.md +38 -35
  2. package/dist/auth/account_action_specs.d.ts +441 -115
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +47 -46
  5. package/dist/auth/account_route_schema.d.ts +120 -60
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +50 -36
  8. package/dist/auth/account_routes.js +1 -1
  9. package/dist/auth/account_schema.d.ts +54 -27
  10. package/dist/auth/account_schema.d.ts.map +1 -1
  11. package/dist/auth/account_schema.js +16 -18
  12. package/dist/auth/admin_action_specs.d.ts +20 -20
  13. package/dist/auth/admin_action_specs.js +2 -4
  14. package/dist/auth/admin_actions.d.ts +4 -4
  15. package/dist/auth/admin_actions.d.ts.map +1 -1
  16. package/dist/auth/admin_actions.js +3 -3
  17. package/dist/auth/all_cell_actions.d.ts +3 -3
  18. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  19. package/dist/auth/all_cell_actions.js +1 -1
  20. package/dist/auth/api_token.d.ts +4 -4
  21. package/dist/auth/api_token.d.ts.map +1 -1
  22. package/dist/auth/api_token.js +3 -3
  23. package/dist/auth/audit_log_schema.d.ts +28 -48
  24. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  25. package/dist/auth/audit_log_schema.js +34 -30
  26. package/dist/auth/bootstrap_route_schema.d.ts +173 -50
  27. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  28. package/dist/auth/bootstrap_route_schema.js +35 -16
  29. package/dist/auth/cell_grant_action_specs.d.ts +1 -1
  30. package/dist/auth/cell_grant_action_specs.js +1 -1
  31. package/dist/auth/cell_grant_actions.d.ts +4 -4
  32. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  33. package/dist/auth/cell_grant_actions.js +1 -1
  34. package/dist/auth/credential_type_schema.d.ts +16 -29
  35. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  36. package/dist/auth/credential_type_schema.js +14 -18
  37. package/dist/auth/grant_path_schema.d.ts +15 -29
  38. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  39. package/dist/auth/grant_path_schema.js +13 -17
  40. package/dist/auth/migrations.js +1 -1
  41. package/dist/auth/name_schema.d.ts +7 -6
  42. package/dist/auth/name_schema.d.ts.map +1 -1
  43. package/dist/auth/name_schema.js +8 -9
  44. package/dist/auth/password.d.ts +15 -7
  45. package/dist/auth/password.d.ts.map +1 -1
  46. package/dist/auth/password.js +16 -9
  47. package/dist/auth/role_grant_offer_action_specs.js +2 -2
  48. package/dist/auth/role_grant_offer_actions.d.ts +4 -4
  49. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  50. package/dist/auth/role_grant_offer_actions.js +3 -3
  51. package/dist/auth/role_grant_offer_notifications.js +2 -2
  52. package/dist/auth/role_grant_offer_schema.d.ts +2 -2
  53. package/dist/auth/role_grant_offer_schema.js +2 -2
  54. package/dist/auth/role_schema.d.ts +47 -55
  55. package/dist/auth/role_schema.d.ts.map +1 -1
  56. package/dist/auth/role_schema.js +29 -35
  57. package/dist/auth/scope_kind_schema.d.ts +22 -26
  58. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  59. package/dist/auth/scope_kind_schema.js +19 -19
  60. package/dist/auth/self_service_role_action_specs.js +1 -1
  61. package/dist/auth/self_service_role_actions.d.ts +6 -6
  62. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  63. package/dist/auth/self_service_role_actions.js +7 -6
  64. package/dist/auth/signup_route_schema.d.ts +71 -21
  65. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  66. package/dist/auth/signup_route_schema.js +18 -16
  67. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  68. package/dist/auth/standard_rpc_actions.js +1 -1
  69. package/dist/auth/token_lifetime.d.ts +33 -9
  70. package/dist/auth/token_lifetime.d.ts.map +1 -1
  71. package/dist/auth/token_lifetime.js +8 -7
  72. package/dist/auth/token_scope.d.ts +99 -25
  73. package/dist/auth/token_scope.d.ts.map +1 -1
  74. package/dist/auth/token_scope.js +57 -35
  75. package/dist/primitive_schemas.d.ts +2 -19
  76. package/dist/primitive_schemas.d.ts.map +1 -1
  77. package/dist/primitive_schemas.js +2 -20
  78. package/dist/primitive_schemas_fuz.d.ts +22 -2
  79. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  80. package/dist/primitive_schemas_fuz.js +23 -4
  81. package/dist/testing/CLAUDE.md +22 -5
  82. package/dist/testing/admin_integration.d.ts +3 -3
  83. package/dist/testing/admin_integration.d.ts.map +1 -1
  84. package/dist/testing/admin_integration.js +1 -1
  85. package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
  86. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  87. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  88. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  89. package/dist/testing/cross_backend/identity_parity.js +39 -6
  90. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
  91. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  92. package/dist/testing/cross_backend/setup.d.ts +1 -1
  93. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  94. package/dist/testing/cross_backend/setup.js +45 -42
  95. package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
  96. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  97. package/dist/testing/cross_backend/standard.d.ts +4 -4
  98. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  99. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  100. package/dist/testing/cross_backend/token_lifetime.js +34 -1
  101. package/dist/testing/integration.js +1 -1
  102. package/dist/testing/token_scope_fixtures.d.ts +24 -0
  103. package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
  104. package/dist/testing/token_scope_fixtures.js +49 -0
  105. package/dist/testing/transports/bootstrap.d.ts +1 -1
  106. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  107. package/dist/testing/transports/bootstrap.js +13 -12
  108. package/dist/ui/BootstrapForm.svelte +4 -2
  109. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  110. package/dist/ui/SignupForm.svelte +4 -2
  111. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  112. package/package.json +1 -1
  113. package/dist/auth/audit_log_schema_fuz.d.ts +0 -53
  114. package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
  115. package/dist/auth/audit_log_schema_fuz.js +0 -50
  116. package/dist/auth/role_schema_fuz.d.ts +0 -30
  117. package/dist/auth/role_schema_fuz.d.ts.map +0 -1
  118. package/dist/auth/role_schema_fuz.js +0 -30
  119. package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
  120. package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
  121. package/dist/auth/scope_kind_schema_fuz.js +0 -31
@@ -28,16 +28,19 @@
28
28
  *
29
29
  * @module
30
30
  */
31
- import { z } from 'zod';
31
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
32
32
  /** Current `TokenScope` document version. Must match the Rust `TOKEN_SCOPE_VERSION`. */
33
33
  export declare const TOKEN_SCOPE_VERSION = 1;
34
34
  /**
35
- * Serialized-document cap. Matches the Rust `MAX_TOKEN_SCOPE_BYTES` and
35
+ * Serialized-document cap, in UTF-8 bytes of the document's compact JSON (no
36
+ * whitespace, what `JSON.stringify` writes) — never the text a driver or
37
+ * Postgres prints it as, which for `jsonb` adds a space after every `:` and
38
+ * `,`. Matches the Rust `MAX_TOKEN_SCOPE_BYTES`, which measures the same, and
36
39
  * fuz_forge's `MAX_POLICY_BYTES`.
37
40
  */
38
41
  export declare const MAX_TOKEN_SCOPE_BYTES: number;
39
42
  /**
40
- * The stored `api_token.scope` document.
43
+ * The stored `api_token.scope` document, a `@fuzdev/fuz_schema` schema.
41
44
  *
42
45
  * `grandfathered` is a fact about the *row* — the `api_token_scope` migration
43
46
  * wrote it; no minter chose it — that only the token list cares about. The
@@ -49,33 +52,95 @@ export declare const MAX_TOKEN_SCOPE_BYTES: number;
49
52
  * The discriminated union also refuses the contradiction
50
53
  * `{kind: 'full', methods: [...]}`.
51
54
  */
52
- export declare const TokenScope: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
- version: z.ZodLiteral<1>;
54
- kind: z.ZodLiteral<"full">;
55
- grandfathered: z.ZodOptional<z.ZodBoolean>;
56
- }, z.core.$strict>, z.ZodObject<{
57
- version: z.ZodLiteral<1>;
58
- kind: z.ZodLiteral<"methods">;
59
- methods: z.ZodArray<z.ZodString>;
60
- grandfathered: z.ZodOptional<z.ZodBoolean>;
61
- }, z.core.$strict>], "kind">;
62
- export type TokenScope = z.infer<typeof TokenScope>;
55
+ export declare const TokenScope: import("@fuzdev/fuz_schema/schema.ts").Schema<{
56
+ version: 1;
57
+ kind: "full";
58
+ grandfathered?: boolean | undefined;
59
+ } | {
60
+ version: 1;
61
+ kind: "methods";
62
+ methods: string[];
63
+ grandfathered?: boolean | undefined;
64
+ }, {
65
+ version: 1;
66
+ kind: "full";
67
+ grandfathered?: boolean | undefined;
68
+ } | {
69
+ version: 1;
70
+ kind: "methods";
71
+ methods: string[];
72
+ grandfathered?: boolean | undefined;
73
+ }, "variant", {
74
+ readonly key: "kind";
75
+ readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
76
+ version: 1;
77
+ kind: "full";
78
+ grandfathered?: boolean | undefined;
79
+ }, {
80
+ version: 1;
81
+ kind: "full";
82
+ grandfathered?: boolean | undefined;
83
+ }, "object", {
84
+ version: import("@fuzdev/fuz_schema/schema.ts").Schema<1, 1, "literal", 1>;
85
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"full", "full", "literal", "full">;
86
+ grandfathered: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
87
+ }>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
88
+ version: 1;
89
+ kind: "methods";
90
+ methods: string[];
91
+ grandfathered?: boolean | undefined;
92
+ }, {
93
+ version: 1;
94
+ kind: "methods";
95
+ methods: string[];
96
+ grandfathered?: boolean | undefined;
97
+ }, "object", {
98
+ version: import("@fuzdev/fuz_schema/schema.ts").Schema<1, 1, "literal", 1>;
99
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"methods", "methods", "literal", "methods">;
100
+ methods: import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
101
+ grandfathered: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
102
+ }>];
103
+ }>;
104
+ export type TokenScope = Infer<typeof TokenScope>;
63
105
  /**
64
106
  * The `scope` input accepted by `account_token_create` — the stored shape minus
65
- * the row-owned fields.
107
+ * the row-owned fields, a `@fuzdev/fuz_schema` schema.
66
108
  *
67
109
  * A minter cannot set `version` or `grandfathered`: the first is stamped by
68
110
  * `token_scope_full` / `token_scope_methods`, and the second is the migration's
69
111
  * mark for tokens that predate scoping. Letting a caller forge `grandfathered`
70
112
  * would turn a tracked debt into a laundered one.
71
113
  */
72
- export declare const TokenScopeInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
73
- kind: z.ZodLiteral<"full">;
74
- }, z.core.$strict>, z.ZodObject<{
75
- kind: z.ZodLiteral<"methods">;
76
- methods: z.ZodArray<z.ZodString>;
77
- }, z.core.$strict>], "kind">;
78
- export type TokenScopeInput = z.infer<typeof TokenScopeInput>;
114
+ export declare const TokenScopeInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
115
+ kind: "full";
116
+ } | {
117
+ kind: "methods";
118
+ methods: string[];
119
+ }, {
120
+ kind: "full";
121
+ } | {
122
+ kind: "methods";
123
+ methods: string[];
124
+ }, "variant", {
125
+ readonly key: "kind";
126
+ readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
127
+ kind: "full";
128
+ }, {
129
+ kind: "full";
130
+ }, "object", {
131
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"full", "full", "literal", "full">;
132
+ }>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
133
+ kind: "methods";
134
+ methods: string[];
135
+ }, {
136
+ kind: "methods";
137
+ methods: string[];
138
+ }, "object", {
139
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"methods", "methods", "literal", "methods">;
140
+ methods: import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
141
+ }>];
142
+ }>;
143
+ export type TokenScopeInput = Infer<typeof TokenScopeInput>;
79
144
  /** A deliberately-minted full-authority scope. */
80
145
  export declare const token_scope_full: () => TokenScope;
81
146
  /** A narrowed scope over `methods`. */
@@ -197,7 +262,15 @@ export declare const token_scope_denied_body: (capability: string) => {
197
262
  /** Stable label for the token list / UI. */
198
263
  export declare const token_scope_label: (scope: TokenScope) => string;
199
264
  /**
200
- * Parse a stored document, enforcing the size cap and the schema.
265
+ * Parse a stored document, enforcing the size cap and the schema. The cap is
266
+ * measured on the document's compact serialization, not on `raw`, so the
267
+ * spaced text Postgres prints a `jsonb` as reads as the document it is.
268
+ *
269
+ * A `raw` past twice the cap is refused before it is parsed. Postgres prints a
270
+ * `jsonb` as its compact form plus one space after each `:` and `,` outside
271
+ * strings, each of which is a byte of that form beside its braces, so the
272
+ * printed text of a document either spine can write is under twice the cap and
273
+ * never refused here.
201
274
  *
202
275
  * **Fail-closed**: returns `null` on an unreadable document, and every caller on
203
276
  * the enforcement path treats `null` as "refuse the credential" rather than
@@ -208,7 +281,7 @@ export declare const token_scope_label: (scope: TokenScope) => string;
208
281
  */
209
282
  export declare const parse_token_scope: (raw: string) => TokenScope | null;
210
283
  /**
211
- * Serialize for storage, enforcing the size cap.
284
+ * Serialize for storage, enforcing the size cap in UTF-8 bytes.
212
285
  *
213
286
  * Throws on an over-cap document — the mint path maps that to a 400, matching
214
287
  * the Rust side's `TokenScopeError::TooLarge`.
@@ -220,7 +293,8 @@ export declare const serialize_token_scope: (scope: TokenScope) => string;
220
293
  *
221
294
  * The DB driver may hand `scope` back already-parsed (JSONB → object) or as
222
295
  * text depending on backend, so both are normalized here rather than at each
223
- * call site. Lives here rather than beside the queries so the pure scope module
296
+ * call site, and either is held to the cap by its compact serialization, as
297
+ * the Rust spine holds the spaced `scope::text` it reads. Lives here rather than beside the queries so the pure scope module
224
298
  * owns every parse — and so mocking the query module doesn't drag this along.
225
299
  */
226
300
  export declare const parse_stored_token_scope: (value: unknown) => TokenScope | null;
@@ -1 +1 @@
1
- {"version":3,"file":"token_scope.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;;;;;;;;;4BAYrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;;4BAG1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,kDAA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eAAO,MAAM,cAAc,mGAOjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,YACA,CAAC;AAQ3D;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,MAAM,KAAG,MAC3B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,OAEG,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,YAAY,MAAM,KAChB;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAGxD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,MAGrD,CAAC;AAoBF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,UAAU,GAAG,IAU5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,MASzD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,IACc,CAAC"}
@@ -28,17 +28,21 @@
28
28
  *
29
29
  * @module
30
30
  */
31
- import { z } from 'zod';
31
+ import { array, boolean, literal, object, optional, parse, string, variant } from '@fuzdev/fuz_schema/schema.ts';
32
+ import { to_bytes } from '@fuzdev/fuz_util/bytes.ts';
32
33
  import { is_valid_name } from './name_schema.js';
33
34
  /** Current `TokenScope` document version. Must match the Rust `TOKEN_SCOPE_VERSION`. */
34
35
  export const TOKEN_SCOPE_VERSION = 1;
35
36
  /**
36
- * Serialized-document cap. Matches the Rust `MAX_TOKEN_SCOPE_BYTES` and
37
+ * Serialized-document cap, in UTF-8 bytes of the document's compact JSON (no
38
+ * whitespace, what `JSON.stringify` writes) — never the text a driver or
39
+ * Postgres prints it as, which for `jsonb` adds a space after every `:` and
40
+ * `,`. Matches the Rust `MAX_TOKEN_SCOPE_BYTES`, which measures the same, and
37
41
  * fuz_forge's `MAX_POLICY_BYTES`.
38
42
  */
39
43
  export const MAX_TOKEN_SCOPE_BYTES = 4 * 1024;
40
44
  /**
41
- * The stored `api_token.scope` document.
45
+ * The stored `api_token.scope` document, a `@fuzdev/fuz_schema` schema.
42
46
  *
43
47
  * `grandfathered` is a fact about the *row* — the `api_token_scope` migration
44
48
  * wrote it; no minter chose it — that only the token list cares about. The
@@ -50,31 +54,31 @@ export const MAX_TOKEN_SCOPE_BYTES = 4 * 1024;
50
54
  * The discriminated union also refuses the contradiction
51
55
  * `{kind: 'full', methods: [...]}`.
52
56
  */
53
- export const TokenScope = z.discriminatedUnion('kind', [
54
- z.strictObject({
55
- version: z.literal(TOKEN_SCOPE_VERSION),
56
- kind: z.literal('full'),
57
- grandfathered: z.boolean().optional()
57
+ export const TokenScope = variant('kind', [
58
+ object({
59
+ version: literal(TOKEN_SCOPE_VERSION),
60
+ kind: literal('full'),
61
+ grandfathered: optional(boolean)
58
62
  }),
59
- z.strictObject({
60
- version: z.literal(TOKEN_SCOPE_VERSION),
61
- kind: z.literal('methods'),
62
- methods: z.array(z.string()),
63
- grandfathered: z.boolean().optional()
63
+ object({
64
+ version: literal(TOKEN_SCOPE_VERSION),
65
+ kind: literal('methods'),
66
+ methods: array(string),
67
+ grandfathered: optional(boolean)
64
68
  })
65
69
  ]);
66
70
  /**
67
71
  * The `scope` input accepted by `account_token_create` — the stored shape minus
68
- * the row-owned fields.
72
+ * the row-owned fields, a `@fuzdev/fuz_schema` schema.
69
73
  *
70
74
  * A minter cannot set `version` or `grandfathered`: the first is stamped by
71
75
  * `token_scope_full` / `token_scope_methods`, and the second is the migration's
72
76
  * mark for tokens that predate scoping. Letting a caller forge `grandfathered`
73
77
  * would turn a tracked debt into a laundered one.
74
78
  */
75
- export const TokenScopeInput = z.discriminatedUnion('kind', [
76
- z.strictObject({ kind: z.literal('full') }),
77
- z.strictObject({ kind: z.literal('methods'), methods: z.array(z.string()) })
79
+ export const TokenScopeInput = variant('kind', [
80
+ object({ kind: literal('full') }),
81
+ object({ kind: literal('methods'), methods: array(string) })
78
82
  ]);
79
83
  /** A deliberately-minted full-authority scope. */
80
84
  export const token_scope_full = () => ({
@@ -219,8 +223,33 @@ export const token_scope_label = (scope) => {
219
223
  return scope.grandfathered ? 'full (grandfathered)' : 'full';
220
224
  return `${scope.methods.length} methods`;
221
225
  };
226
+ /** The UTF-8 byte length of `json`, the unit `MAX_TOKEN_SCOPE_BYTES` counts. */
227
+ const token_scope_json_bytes = (json) => to_bytes(json).length;
222
228
  /**
223
- * Parse a stored document, enforcing the size cap and the schema.
229
+ * Read a document's parsed JSON value, enforcing the size cap on its compact
230
+ * serialization and the schema; `null` when it is unreadable.
231
+ */
232
+ const token_scope_from_value = (value) => {
233
+ // `JSON.stringify(undefined)` returns `undefined`, not a string — so a row
234
+ // missing the column entirely must be caught here rather than measured.
235
+ // Absent is *unreadable*, which is fail-closed: the caller refuses the
236
+ // credential.
237
+ const json = JSON.stringify(value);
238
+ if (json === undefined || token_scope_json_bytes(json) > MAX_TOKEN_SCOPE_BYTES)
239
+ return null;
240
+ const parsed = parse(TokenScope, value);
241
+ return parsed.ok ? parsed.value : null;
242
+ };
243
+ /**
244
+ * Parse a stored document, enforcing the size cap and the schema. The cap is
245
+ * measured on the document's compact serialization, not on `raw`, so the
246
+ * spaced text Postgres prints a `jsonb` as reads as the document it is.
247
+ *
248
+ * A `raw` past twice the cap is refused before it is parsed. Postgres prints a
249
+ * `jsonb` as its compact form plus one space after each `:` and `,` outside
250
+ * strings, each of which is a byte of that form beside its braces, so the
251
+ * printed text of a document either spine can write is under twice the cap and
252
+ * never refused here.
224
253
  *
225
254
  * **Fail-closed**: returns `null` on an unreadable document, and every caller on
226
255
  * the enforcement path treats `null` as "refuse the credential" rather than
@@ -230,7 +259,8 @@ export const token_scope_label = (scope) => {
230
259
  * authority exactly when something is already wrong.
231
260
  */
232
261
  export const parse_token_scope = (raw) => {
233
- if (raw.length > MAX_TOKEN_SCOPE_BYTES)
262
+ // code units, which never exceed UTF-8 bytes, so this refuses no text the byte cap reads
263
+ if (raw.length > 2 * MAX_TOKEN_SCOPE_BYTES)
234
264
  return null;
235
265
  let value;
236
266
  try {
@@ -239,19 +269,19 @@ export const parse_token_scope = (raw) => {
239
269
  catch {
240
270
  return null;
241
271
  }
242
- const parsed = TokenScope.safeParse(value);
243
- return parsed.success ? parsed.data : null;
272
+ return token_scope_from_value(value);
244
273
  };
245
274
  /**
246
- * Serialize for storage, enforcing the size cap.
275
+ * Serialize for storage, enforcing the size cap in UTF-8 bytes.
247
276
  *
248
277
  * Throws on an over-cap document — the mint path maps that to a 400, matching
249
278
  * the Rust side's `TokenScopeError::TooLarge`.
250
279
  */
251
280
  export const serialize_token_scope = (scope) => {
252
281
  const json = JSON.stringify(scope);
253
- if (json.length > MAX_TOKEN_SCOPE_BYTES) {
254
- throw new Error(`token scope document is ${json.length} bytes, exceeding the ${MAX_TOKEN_SCOPE_BYTES} byte cap`);
282
+ const bytes = token_scope_json_bytes(json);
283
+ if (bytes > MAX_TOKEN_SCOPE_BYTES) {
284
+ throw new Error(`token scope document is ${bytes} bytes, exceeding the ${MAX_TOKEN_SCOPE_BYTES} byte cap`);
255
285
  }
256
286
  return json;
257
287
  };
@@ -261,16 +291,8 @@ export const serialize_token_scope = (scope) => {
261
291
  *
262
292
  * The DB driver may hand `scope` back already-parsed (JSONB → object) or as
263
293
  * text depending on backend, so both are normalized here rather than at each
264
- * call site. Lives here rather than beside the queries so the pure scope module
294
+ * call site, and either is held to the cap by its compact serialization, as
295
+ * the Rust spine holds the spaced `scope::text` it reads. Lives here rather than beside the queries so the pure scope module
265
296
  * owns every parse — and so mocking the query module doesn't drag this along.
266
297
  */
267
- export const parse_stored_token_scope = (value) => {
268
- if (typeof value === 'string')
269
- return parse_token_scope(value);
270
- // `JSON.stringify(undefined)` returns `undefined`, not a string — so a row
271
- // missing the column entirely must be caught here rather than reaching
272
- // `parse_token_scope` and throwing on `.length`. Absent is *unreadable*,
273
- // which is fail-closed: the caller refuses the credential.
274
- const json = JSON.stringify(value);
275
- return json === undefined ? null : parse_token_scope(json);
276
- };
298
+ export const parse_stored_token_scope = (value) => typeof value === 'string' ? parse_token_scope(value) : token_scope_from_value(value);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reusable validator-schema primitives — `bounded_string`, `Username`,
3
- * `UsernameProvided`, `Email`, the branded `Uuid` and `Datetime` with their
4
- * factories, and the hash schema `FactHashSchema`. Lives at
3
+ * `Email`, the branded `Uuid` and `Datetime` with their factories, and the
4
+ * hash schema `FactHashSchema`. Lives at
5
5
  * the top level (not inside `auth/` or `http/`) because these shapes don't
6
6
  * depend on or imply any domain — accounts hold a username and email, but
7
7
  * invites, password resets, cells, and other surfaces all reach for the same
@@ -79,23 +79,6 @@ export declare const USERNAME_PROVIDED_LENGTH_MAX = 255;
79
79
  */
80
80
  export declare const Username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
81
81
  export type Username = z.infer<typeof Username>;
82
- /**
83
- * Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change.
84
- *
85
- * Canonicalized via `.trim().toLowerCase()` at parse time so login's
86
- * per-account rate-limit key and DB lookup see a uniform value
87
- * regardless of casing or surrounding whitespace. Mirrors the storage
88
- * canonicalization on `Username` so submission and storage agree.
89
- *
90
- * The trailing `.refine` rejects a whitespace-only identifier: `.min(1)`
91
- * runs on the raw string (so `" "` passes it), and without the post-trim
92
- * check the value would canonicalize to `""` and fall through to a
93
- * lookup-miss 401 instead of a 400 — an empty identifier is malformed
94
- * input, not a wrong credential. Keeps the Rust spine's
95
- * `account_login` (which rejects empty-after-trim) in parity.
96
- */
97
- export declare const UsernameProvided: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
98
- export type UsernameProvided = z.infer<typeof UsernameProvided>;
99
82
  /**
100
83
  * Maximum email length in **bytes** — RFC 5321 §4.5.3.1.3 path-length limit
101
84
  * (the limit is octets). `Email` bounds the UTF-8 byte length, matching the
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIlF,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,oBAAoB,KAAG,CAAC,CAAC,SA+ChE,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,6GAA6G;AAC7G,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAwC,CAAC;AAEpE,gNAAgN;AAChN,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,wDAEc,CAAC;AACpC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,wDAEqE,CAAC;AACnG,M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AEA,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reusable validator-schema primitives — `bounded_string`, `Username`,
3
- * `UsernameProvided`, `Email`, the branded `Uuid` and `Datetime` with their
4
- * factories, and the hash schema `FactHashSchema`. Lives at
3
+ * `Email`, the branded `Uuid` and `Datetime` with their factories, and the
4
+ * hash schema `FactHashSchema`. Lives at
5
5
  * the top level (not inside `auth/` or `http/`) because these shapes don't
6
6
  * depend on or imply any domain — accounts hold a username and email, but
7
7
  * invites, password resets, cells, and other surfaces all reach for the same
@@ -117,24 +117,6 @@ export const USERNAME_PROVIDED_LENGTH_MAX = 255;
117
117
  export const Username = bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX })
118
118
  .regex(USERNAME_REGEX)
119
119
  .transform((s) => s.toLowerCase());
120
- /**
121
- * Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change.
122
- *
123
- * Canonicalized via `.trim().toLowerCase()` at parse time so login's
124
- * per-account rate-limit key and DB lookup see a uniform value
125
- * regardless of casing or surrounding whitespace. Mirrors the storage
126
- * canonicalization on `Username` so submission and storage agree.
127
- *
128
- * The trailing `.refine` rejects a whitespace-only identifier: `.min(1)`
129
- * runs on the raw string (so `" "` passes it), and without the post-trim
130
- * check the value would canonicalize to `""` and fall through to a
131
- * lookup-miss 401 instead of a 400 — an empty identifier is malformed
132
- * input, not a wrong credential. Keeps the Rust spine's
133
- * `account_login` (which rejects empty-after-trim) in parity.
134
- */
135
- export const UsernameProvided = bounded_string({ min: 1, max: USERNAME_PROVIDED_LENGTH_MAX })
136
- .transform((s) => s.trim().toLowerCase())
137
- .refine((s) => s.length > 0, { message: 'Username must not be empty after trimming whitespace' });
138
120
  /**
139
121
  * Maximum email length in **bytes** — RFC 5321 §4.5.3.1.3 path-length limit
140
122
  * (the limit is octets). `Email` bounds the UTF-8 byte length, matching the
@@ -3,8 +3,9 @@
3
3
  * `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
4
4
  * `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
5
5
  * written in fuz_schema; `UsernameCanonical`, the username an output carries;
6
- * `Timestamp`, a timestamp on the wire; and `Blake3Hash`, a BLAKE3 hex hash,
7
- * which has no Zod twin.
6
+ * `UsernameProvided`, the username login and lookup take; `Timestamp`, a
7
+ * timestamp on the wire; and `Blake3Hash`, a BLAKE3 hex hash. The last four
8
+ * have no Zod twin.
8
9
  *
9
10
  * The output type is shared: the Zod `Uuid` outputs fuz_schema's
10
11
  * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
@@ -59,6 +60,25 @@ export declare const USERNAME_CANONICAL_REGEX: RegExp;
59
60
  */
60
61
  export declare const UsernameCanonical: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
61
62
  export type UsernameCanonical = Infer<typeof UsernameCanonical>;
63
+ /**
64
+ * Username submitted for login or lookup — minimal validation, for
65
+ * forward-compatibility if the creation grammar changes: at least one and at
66
+ * most `USERNAME_PROVIDED_LENGTH_MAX` UTF-16 code units, measured before
67
+ * trimming, holding a character that isn't whitespace.
68
+ *
69
+ * Canonicalized to `.trim().toLowerCase()` at parse time, so login's
70
+ * per-account rate-limit key and its lookup see one value whatever the casing
71
+ * or surrounding whitespace, as `Username` canonicalizes what is stored.
72
+ *
73
+ * A whitespace-only identifier is refused, not canonicalized to `""` and left
74
+ * to fall through to a lookup-miss 401: an empty identifier is malformed
75
+ * input, not a wrong credential, and the Rust spine's `account_login` refuses
76
+ * it too. JS `\s` is exactly the set `trim` removes (ECMA-262's WhiteSpace and
77
+ * LineTerminator), so the `regex` ahead of the transform refuses what would
78
+ * trim to nothing.
79
+ */
80
+ export declare const UsernameProvided: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
81
+ export type UsernameProvided = Infer<typeof UsernameProvided>;
62
82
  /**
63
83
  * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
64
84
  * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_schemas_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAUN,MAAM,EAIN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EASN,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,oBAAoB,KAC3B,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAKlC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,4HAIpB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,4HAG7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,wGAKjB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;CAAmD,CAAC;AACrE,cAAc;AACd,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;GAAqC,CAAC;AAClE,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D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auth_shape.ts`), under the same names, for schemas
5
5
  * written in fuz_schema; `UsernameCanonical`, the username an output carries;
6
- * `Timestamp`, a timestamp on the wire; and `Blake3Hash`, a BLAKE3 hex hash,
7
- * which has no Zod twin.
6
+ * `UsernameProvided`, the username login and lookup take; `Timestamp`, a
7
+ * timestamp on the wire; and `Blake3Hash`, a BLAKE3 hex hash. The last four
8
+ * have no Zod twin.
8
9
  *
9
10
  * The output type is shared: the Zod `Uuid` outputs fuz_schema's
10
11
  * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
@@ -20,8 +21,8 @@
20
21
  * @module
21
22
  */
22
23
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
23
- import { brand, check, iso_datetime, max_length, message, min_length, optional, pipe, regex, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
24
- import { create_uuid, EMAIL_LENGTH_MAX, EMAIL_LENGTH_MESSAGE, EMAIL_REGEX, is_email_within_length_max, USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, USERNAME_REGEX } from './primitive_schemas.js';
24
+ import { brand, check, iso_datetime, max_length, message, min_length, optional, pipe, regex, string, to_lower_case, transform, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
25
+ import { create_uuid, EMAIL_LENGTH_MAX, EMAIL_LENGTH_MESSAGE, EMAIL_REGEX, is_email_within_length_max, USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, USERNAME_PROVIDED_LENGTH_MAX, USERNAME_REGEX } from './primitive_schemas.js';
25
26
  /**
26
27
  * A string schema whose length is bounded in UTF-16 code units, the twin of
27
28
  * the Zod `bounded_string`: fuz_schema's `min_length` / `max_length` read
@@ -61,6 +62,24 @@ export const USERNAME_CANONICAL_REGEX = /^[a-z][0-9a-z_-]*[0-9a-z]$/;
61
62
  * username in any other case fails, where the Zod `Username` lowercased it.
62
63
  */
63
64
  export const UsernameCanonical = pipe(bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX }), regex(USERNAME_CANONICAL_REGEX));
65
+ /**
66
+ * Username submitted for login or lookup — minimal validation, for
67
+ * forward-compatibility if the creation grammar changes: at least one and at
68
+ * most `USERNAME_PROVIDED_LENGTH_MAX` UTF-16 code units, measured before
69
+ * trimming, holding a character that isn't whitespace.
70
+ *
71
+ * Canonicalized to `.trim().toLowerCase()` at parse time, so login's
72
+ * per-account rate-limit key and its lookup see one value whatever the casing
73
+ * or surrounding whitespace, as `Username` canonicalizes what is stored.
74
+ *
75
+ * A whitespace-only identifier is refused, not canonicalized to `""` and left
76
+ * to fall through to a lookup-miss 401: an empty identifier is malformed
77
+ * input, not a wrong credential, and the Rust spine's `account_login` refuses
78
+ * it too. JS `\s` is exactly the set `trim` removes (ECMA-262's WhiteSpace and
79
+ * LineTerminator), so the `regex` ahead of the transform refuses what would
80
+ * trim to nothing.
81
+ */
82
+ export const UsernameProvided = pipe(bounded_string({ min: 1, max: USERNAME_PROVIDED_LENGTH_MAX }), message(regex(/\S/), 'Username must not be empty after trimming whitespace'), transform((s) => s.trim().toLowerCase()));
64
83
  /**
65
84
  * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
66
85
  * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
@@ -127,6 +127,16 @@ mismatch.
127
127
  - `create_recording_audit_emitter(calls_ref?)` — no-op `AuditEmitter` pushing every `emit` and `emit_pool` call into `calls`. Pass `calls_ref` to write into a caller-owned array; omit to let the helper allocate. Returns `{emitter, calls}` — destructure `emitter` as the `audit` dep and read `calls` to assert. `add_listener` records (never fires) and returns a remover with the production semantics, so `listener_count` tracks what a server registered and released. Replaces per-file capturing emitters previously duplicated across `password_change.test.ts`, `audit_log.test.ts`, etc.
128
128
  - `RecordingAuditEmitter` — `{emitter: AuditEmitter; calls: Array<AuditLogInput>}`.
129
129
 
130
+ ### `token_scope_fixtures.ts` — scope documents built to a size
131
+
132
+ `token_scope_methods_at_bytes(bytes, filler)` — method names whose `methods`
133
+ scope document is exactly `bytes` compact UTF-8 bytes, the unit
134
+ `MAX_TOKEN_SCOPE_BYTES` counts: `account_token_list`, names ending in `filler`
135
+ (multibyte for a document far under its byte size in UTF-16 code units), and
136
+ an ASCII pad. The Rust spine's tests build the same list, so a boundary pinned
137
+ on one spine is the boundary on the other. `token_scope_methods_bytes(methods)`
138
+ measures one. Hono-free, imported by the cross-process token suite.
139
+
130
140
  ### `connection_closer_helpers.ts` — `ConnectionCloser` test doubles
131
141
 
132
142
  - `create_recording_closer()` — `{closer, calls}`; `closer.close_connections(target)` records the `target` and `close_all_connections()` records `{kind: 'all'}` into `calls`, closing nothing. To see a handler's closes, add it to the backend's closer (`ctx.deps.connection_closer.add(closer)`) or build the factory's deps with it. The closes are queued post-commit, so they have run by the time a `create_test_app` response is in hand (`await_pending_effects: true` flushes both queues).
@@ -873,7 +883,7 @@ header/account mismatch. Direct-grant fixtures (test focuses on revoke or
873
883
  isolation, not the consent path) go through `create_test_role_grant_direct`
874
884
  from `db_entities.ts`.
875
885
 
876
- Required options: `{setup_test, surface_source, session_options, rpc_endpoints: RpcEndpointsSuiteOption, roles: RoleSchemaResult, admin_prefix?}`.
886
+ Required options: `{setup_test, surface_source, session_options, rpc_endpoints: RpcEndpointsSuiteOption, roles: RoleRegistry, admin_prefix?}`.
877
887
 
878
888
  fuz_app runs it cross-process through the standard bundle
879
889
  and in-process as a consumer wires it
@@ -2572,7 +2582,11 @@ a `{kind:'ttl', days}` mint returns and stores a bounded `expires_at`
2572
2582
  (create output + `account_token_list` read-back), `{kind:'eternal'}` stores
2573
2583
  NULL, an omitted or out-of-range lifetime 400s identically on both
2574
2584
  spines, and a `name` at `API_TOKEN_NAME_LENGTH_MAX` mints and reads back whole
2575
- while one UTF-16 code unit past it is `invalid_params`. It also pins the
2585
+ while one UTF-16 code unit past it is `invalid_params`. It pins the scope cap
2586
+ as compact UTF-8 bytes at mint and at read: a two-byte scope at
2587
+ `MAX_TOKEN_SCOPE_BYTES`, and an ASCII one under it whose printed `jsonb` text
2588
+ is past it, mint, authenticate as bearers and list as `N methods`; one byte
2589
+ past the cap is `invalid_params` with `ERROR_TOKEN_SCOPE_INVALID`. It also pins the
2576
2590
  credential legs' order from stored state: a bearer sent beside a winning
2577
2591
  daemon token keeps `last_used_at` null (never validated), against a token used
2578
2592
  alone whose touch lands. Exists because the action-manifest parity gate captures no param
@@ -2680,7 +2694,7 @@ check.
2680
2694
  ### Identity-primitive parity — `cross_backend/identity_parity.ts`
2681
2695
 
2682
2696
  `describe_identity_parity_cross_tests({setup_test, login_path?, signup_path?, bootstrap_path?, password_path?})` —
2683
- the imperative suite pinning the `primitive_schemas` twins (`Username`,
2697
+ the imperative suite pinning the identity primitives (`Username`,
2684
2698
  `UsernameProvided`, `Email`) + login/signup input handling end-to-end over real
2685
2699
  HTTP (flat REST `/login` + `/signup`, so imperative, not a `conformance_table`
2686
2700
  row). The facets, each a TS↔Rust reimplementation pair that the spec-derived
@@ -2699,7 +2713,7 @@ round-trip / conformance suites never vary:
2699
2713
  - **Login input validation** — malformed login input → 400 `invalid_request_body`
2700
2714
  on every spine: whitespace-only username (empty after trim), over-long username
2701
2715
  (> 255), empty password, unknown body key (strict object). TS runs the full
2702
- `LoginInput` Zod schema; the Rust spine enforces the same shape in
2716
+ `LoginInput` schema; the Rust spine enforces the same shape in
2703
2717
  `account_login` (closed a cluster where three of these fell through to a
2704
2718
  lookup-miss 401 on Rust and a whitespace-only identifier 401'd on TS). Asserted
2705
2719
  by error reason, not just status.
@@ -2707,7 +2721,10 @@ round-trip / conformance suites never vary:
2707
2721
  padded creation name (space, tab, U+0085) → 400, never trimmed into a legal
2708
2722
  one — at signup, and at bootstrap (`bootstrap_path`, default
2709
2723
  `/api/account/bootstrap`, `null` to skip), where the body is validated ahead
2710
- of the window check, so the 400 holds after bootstrap completed.
2724
+ of the window check, so the 400 holds after bootstrap completed. There the
2725
+ `token` past `BOOTSTRAP_TOKEN_LENGTH_MAX` UTF-16 code units is 400 and one at
2726
+ it reaches the closed window's 403, ASCII, two-byte, and astral, so both
2727
+ spines count code units, not bytes or scalar values.
2711
2728
  - **Length + format regex parity** — both `[USERNAME_LENGTH_MIN,
2712
2729
  USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
2713
2730
  just-inside → 403 no-matching-invite) and the creation regex shape (leading
@@ -1,6 +1,6 @@
1
1
  import './assert_dev_env.js';
2
2
  import type { SessionOptions } from '../auth/session_cookie.js';
3
- import { type RoleSchemaResult } from '../auth/role_schema.js';
3
+ import { type RoleRegistry } from '../auth/role_schema.js';
4
4
  import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
5
5
  import type { AppSurfaceSpec } from '../http/surface.js';
6
6
  import type { SetupTest } from './cross_backend/setup.js';
@@ -22,8 +22,8 @@ export interface StandardAdminIntegrationTestOptions {
22
22
  surface_source: AppSurfaceSpec;
23
23
  /** Session config — needed for cookie_name + factory-form rpc_endpoints resolution. */
24
24
  session_options: SessionOptions<string>;
25
- /** Role schema result from `create_role_schema()` — used to determine valid/invalid/web-grantable roles. */
26
- roles: RoleSchemaResult;
25
+ /** Role registry from `create_role_registry()` — used to determine valid/invalid/web-grantable roles. */
26
+ roles: RoleRegistry;
27
27
  /**
28
28
  * RPC endpoint specs — the source `RpcAction` arrays. Required; role_grant
29
29
  * grant/revoke are RPC-only and the suite hard-fails without them.
@@ -1 +1 @@
1
- {"version":3,"file":"admin_integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAgC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAY3E,OAAO,EAMN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AA4B1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAavE;;GAEG;AACH,MAAM,WAAW,mCAAmC;IACnD;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,uFAAuF;IACvF,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,4GAA4G;IAC5G,KAAK,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,mCAAmC,KAC1C,IAg+BF,CAAC"}
1
+ {"version":3,"file":"admin_integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAgC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAYvE,OAAO,EAMN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AA4B1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAavE;;GAEG;AACH,MAAM,WAAW,mCAAmC;IACnD;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,uFAAuF;IACvF,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,yGAAyG;IACzG,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,mCAAmC,KAC1C,IAg+BF,CAAC"}
@@ -7,7 +7,7 @@ import './assert_dev_env.js';
7
7
  * surface — see `role_grant_offer_create` / `role_grant_revoke`), session/token
8
8
  * management, and audit log routes against a real database.
9
9
  *
10
- * Consumers call it with their route factory, session config, role schema,
10
+ * Consumers call it with their route factory, session config, role registry,
11
11
  * and RPC endpoint specs — all admin route tests come for free.
12
12
  *
13
13
  * Scope: admin *semantics* — cross-admin isolation, role_grant grant/revoke