@fuzdev/fuz_app 0.186.0 → 0.187.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 (34) hide show
  1. package/dist/auth/CLAUDE.md +10 -5
  2. package/dist/auth/account_queries.d.ts +8 -5
  3. package/dist/auth/account_queries.d.ts.map +1 -1
  4. package/dist/auth/account_queries.js +8 -5
  5. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  6. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  7. package/dist/auth/role_grant_offer_action_specs.js +2 -1
  8. package/dist/auth/role_grant_offer_actions.d.ts +12 -0
  9. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  10. package/dist/auth/role_grant_offer_actions.js +48 -20
  11. package/dist/auth/role_grant_offer_queries.d.ts +16 -3
  12. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  13. package/dist/auth/role_grant_offer_queries.js +24 -4
  14. package/dist/auth/role_grant_queries.d.ts +102 -11
  15. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  16. package/dist/auth/role_grant_queries.js +129 -15
  17. package/dist/db/migrate.d.ts +46 -22
  18. package/dist/db/migrate.d.ts.map +1 -1
  19. package/dist/db/migrate.js +103 -85
  20. package/dist/server/app_backend.d.ts.map +1 -1
  21. package/dist/server/app_backend.js +1 -4
  22. package/dist/testing/CLAUDE.md +35 -0
  23. package/dist/testing/cross_backend/backend_both_live.d.ts +47 -0
  24. package/dist/testing/cross_backend/backend_both_live.d.ts.map +1 -0
  25. package/dist/testing/cross_backend/backend_both_live.js +566 -0
  26. package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -1
  27. package/dist/testing/cross_backend/backend_swap.js +37 -201
  28. package/dist/testing/cross_backend/shared_database_backends.d.ts +175 -0
  29. package/dist/testing/cross_backend/shared_database_backends.d.ts.map +1 -0
  30. package/dist/testing/cross_backend/shared_database_backends.js +298 -0
  31. package/dist/testing/cross_backend/spine_suites.d.ts +1 -1
  32. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  33. package/dist/testing/cross_backend/spine_suites.js +1 -0
  34. package/package.json +4 -3
@@ -466,6 +466,41 @@ checked before the first spawn. A standalone suite
466
466
  (`STANDALONE_CROSS_SUITES`). fuz_app's wiring is the `cross_backend_swap`
467
467
  project (../../test/CLAUDE.md §Cross-backend self-tests).
468
468
 
469
+ ## Both spines live
470
+
471
+ `cross_backend/backend_both_live.ts` — `describe_backend_both_live_tests({orders,
472
+ database_url, empty_database, offer_role?, gated_ws_path?})`: two backends over
473
+ one Postgres database at once. Per order, over an emptied database (never
474
+ `_testing_reset`, which would drop what the other spine holds): a boot-state
475
+ phase spawns the second before the first's bootstrap and pins what it keeps
476
+ from its boot — `/status` still advertising bootstrap and its daemon token
477
+ resolving no keeper; a `POST /bootstrap` on it refused by the lock, which
478
+ closes its window but leaves the keeper unresolved — then both stop; the
479
+ boot spawns the first, bootstraps it, then spawns the second, so its daemon
480
+ leg resolves the keeper at assembly. The live cases mint on the first,
481
+ prove the credential on both, revoke on the second and assert the refusal on
482
+ the first at once (logout, session revoke by id, token revoke, password
483
+ change, account delete; an offer accepted on the second conferring on the
484
+ first), each revoke bracketed by drained per-table digests
485
+ (`to_changed_tables`) and followed by both backends' invariant check. The
486
+ declared limits (`docs/security.md` §Single-Process Architecture) are pinned
487
+ by test name: a socket on the first outlives the second's password change,
488
+ logout and token revoke and still answers `account_verify`; a role-gated socket
489
+ outlives the second's role revoke, refused a per-message call needing the role
490
+ and still receiving the account's offer push; an offer made on either spine
491
+ reaches its own socket and no socket on the other. A closing test drains,
492
+ checks and tears down both. Config requirements are the swap's. A standalone
493
+ suite (`STANDALONE_CROSS_SUITES`); fuz_app's wiring is the
494
+ `cross_backend_both_live` project.
495
+
496
+ `cross_backend/shared_database_backends.ts` holds what the two share:
497
+ `to_shared_database_problems` (the config checks), `read_shared_database_snapshot`
498
+ and `to_changed_tables` (per-table content digests), `with_live_backend` /
499
+ `teardown_live_backend` over a `LiveBackend` holder, the transport and RPC
500
+ helpers (`backend_transport`, `backend_rpc`, `backend_rpc_as`,
501
+ `backend_daemon_rpc`, `backend_post_json`), `drain_backend_effects`,
502
+ `assert_backend_invariants`, `verified_account_id` and `passes_admin_gate`.
503
+
469
504
  ## Assertions, coverage, helpers
470
505
 
471
506
  ### `assertions.ts` — surface + error-schema assertions
@@ -0,0 +1,47 @@
1
+ import '../assert_dev_env.js';
2
+ import type { BackendConfig } from './backend_config.js';
3
+ /** One order: `first` boots and bootstraps, `second` boots over it; both then run at once. */
4
+ export interface BackendBothLiveOrder {
5
+ /** Names the order's `describe`. */
6
+ readonly label: string;
7
+ readonly first: BackendConfig;
8
+ readonly second: BackendConfig;
9
+ }
10
+ /** Options for `describe_backend_both_live_tests`. */
11
+ export interface BackendBothLiveTestOptions {
12
+ /** The orders to run, one after another over the one database. */
13
+ readonly orders: ReadonlyArray<BackendBothLiveOrder>;
14
+ /**
15
+ * The `postgres://` database both configs run over, read directly for the
16
+ * snapshots — each config's `DATABASE_URL` env must be this exact string.
17
+ */
18
+ readonly database_url: string;
19
+ /**
20
+ * Empty the database — each order calls it before each of its two spawn
21
+ * sequences, so the keeper bootstrap finds no account. The caller owns the
22
+ * guard on which database it drops (`empty_owned_database`).
23
+ */
24
+ readonly empty_database: () => Promise<void>;
25
+ /**
26
+ * The role of the offer the notification case makes on the first — one the
27
+ * keeper may offer, other than `admin`, which the gated socket's grant, the
28
+ * accepted offer and the reverse notification offer use. Default
29
+ * `SPINE_PARTICIPANT_ROLE`, which the reference spines register.
30
+ */
31
+ readonly offer_role?: string;
32
+ /**
33
+ * The first backend's role-gated WebSocket endpoint, which must admit a
34
+ * global `admin` grant. Default `SPINE_ROLE_GATED_WS_PATH`.
35
+ */
36
+ readonly gated_ws_path?: string;
37
+ }
38
+ /**
39
+ * Describe both spines live over each order (§module doc): per order, the
40
+ * boot-state limits, the boot, the live cross-spine credential cases, the
41
+ * declared per-process limits, and the close, run in turn. Each test after the
42
+ * boot fails naming it when the boot did not complete.
43
+ *
44
+ * @param options - the orders, the shared database, and how to empty it
45
+ */
46
+ export declare const describe_backend_both_live_tests: (options: BackendBothLiveTestOptions) => void;
47
+ //# sourceMappingURL=backend_both_live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend_both_live.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/backend_both_live.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuF9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA+BzD,8FAA8F;AAC9F,MAAM,WAAW,oBAAoB;IACpC,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAC/B;AAED,sDAAsD;AACtD,MAAM,WAAW,0BAA0B;IAC1C,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAsPD;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,GAAI,SAAS,0BAA0B,KAAG,IAkqBtF,CAAC"}