@fuzdev/fuz_app 0.68.0 → 0.69.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.
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +10 -3
- package/dist/auth/admin_action_specs.d.ts +2 -3
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +2 -3
- package/dist/auth/admin_actions.d.ts +4 -14
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +28 -36
- package/dist/auth/signup_routes.d.ts +0 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +9 -3
- package/dist/auth/standard_rpc_actions.d.ts +5 -5
- package/dist/auth/standard_rpc_actions.js +4 -4
- package/dist/server/app_server.d.ts +1 -7
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +1 -5
- package/dist/testing/CLAUDE.md +85 -2
- package/dist/testing/app_server.d.ts +34 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -6
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +69 -1
- package/dist/testing/cross_backend/actor_lookup.d.ts +10 -0
- package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -0
- package/dist/testing/cross_backend/actor_lookup.js +83 -0
- package/dist/testing/cross_backend/actor_search.d.ts +6 -0
- package/dist/testing/cross_backend/actor_search.d.ts.map +1 -0
- package/dist/testing/cross_backend/actor_search.js +92 -0
- package/dist/testing/cross_backend/app_settings.d.ts +6 -0
- package/dist/testing/cross_backend/app_settings.d.ts.map +1 -0
- package/dist/testing/cross_backend/app_settings.js +95 -0
- package/dist/testing/cross_backend/backend_config.d.ts +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +0 -9
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +0 -1
- package/dist/testing/cross_backend/cell_grant_role.d.ts +8 -0
- package/dist/testing/cross_backend/cell_grant_role.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_role.js +102 -0
- package/dist/testing/cross_backend/conformance_case.d.ts +144 -0
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_case.js +132 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +46 -0
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_table.js +199 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +0 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts +17 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +20 -12
- package/dist/testing/cross_backend/origin.d.ts +10 -0
- package/dist/testing/cross_backend/origin.d.ts.map +1 -0
- package/dist/testing/cross_backend/origin.js +73 -0
- package/dist/testing/cross_backend/setup.d.ts +22 -40
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +34 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +90 -2
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +91 -3
- package/dist/testing/cross_backend/xfail.d.ts +15 -0
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -0
- package/dist/testing/cross_backend/xfail.js +37 -0
- package/dist/testing/integration.d.ts +2 -3
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +20 -85
- package/dist/testing/rate_limiting.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts +3 -3
- package/dist/testing/sse_round_trip.d.ts +1 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +0 -1
- package/dist/ui/AdminAccounts.svelte +74 -83
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte +21 -23
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +17 -26
- package/dist/ui/OpenSignupToggle.svelte +2 -5
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +9 -10
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.js +7 -17
- package/dist/ui/admin_accounts_state.svelte.d.ts +12 -19
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +10 -24
- package/dist/ui/admin_invites_state.svelte.d.ts +8 -11
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.js +7 -16
- package/dist/ui/admin_sessions_state.svelte.d.ts +6 -10
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.js +4 -14
- package/dist/ui/app_settings_state.svelte.d.ts +8 -12
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/app_settings_state.svelte.js +6 -16
- package/dist/ui/audit_log_state.svelte.d.ts +9 -8
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +8 -20
- package/package.json +1 -1
|
@@ -89,6 +89,40 @@ export declare const create_test_account_with_credentials: (options: CreateTestA
|
|
|
89
89
|
api_token: string;
|
|
90
90
|
session_cookie: string;
|
|
91
91
|
}>;
|
|
92
|
+
/** Options for `mint_test_session`. */
|
|
93
|
+
export interface MintTestSessionOptions {
|
|
94
|
+
db: Db;
|
|
95
|
+
keyring: Keyring;
|
|
96
|
+
session_options: SessionOptions<string>;
|
|
97
|
+
/** Account the minted session belongs to. */
|
|
98
|
+
account_id: string;
|
|
99
|
+
/**
|
|
100
|
+
* Session lifetime offset in seconds applied to `NOW()` for the
|
|
101
|
+
* `auth_session.expires_at` row. A negative value backdates the row so
|
|
102
|
+
* the authoritative DB-row expiry gate (`query_session_get_valid` —
|
|
103
|
+
* `WHERE expires_at > NOW()`) rejects it, while the returned cookie's
|
|
104
|
+
* own signed payload stays valid (future). Resolution therefore passes
|
|
105
|
+
* the cookie-payload check in `parse_session` and is refused at the
|
|
106
|
+
* DB-row gate — the gate the in-process payload-expiry tests never
|
|
107
|
+
* reach and the one that structurally needs a server-side mint.
|
|
108
|
+
*/
|
|
109
|
+
expires_in_seconds: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Mint a real `auth_session` row for an existing account and return a
|
|
113
|
+
* validly-signed session cookie value referencing it. Test-only — the
|
|
114
|
+
* forge behind the cross-backend expiry conformance cases (the
|
|
115
|
+
* `expired_session` principal): pass a negative `expires_in_seconds` to
|
|
116
|
+
* produce an *expired server-side session* whose signed cookie envelope is
|
|
117
|
+
* still well-formed. Both the TS `_testing_mint_session` action and the
|
|
118
|
+
* in-process `fixture.mint_expired_session()` seam call this so the write
|
|
119
|
+
* semantics match across transports.
|
|
120
|
+
*
|
|
121
|
+
* @mutates `options.db` — inserts one `auth_session` row.
|
|
122
|
+
*/
|
|
123
|
+
export declare const mint_test_session: (options: MintTestSessionOptions) => Promise<{
|
|
124
|
+
session_cookie: string;
|
|
125
|
+
}>;
|
|
92
126
|
/**
|
|
93
127
|
* Bootstrap the test-DB keeper. Direct-query shortcut for the default
|
|
94
128
|
* `create_test_app` path — bootstrap is not what most tests exercise, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAG/B,OAAO,KAAK,EAAC,IAAI,EAAC,MA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AAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACpE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,8EAA8E;IAC9E,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,aAAa,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,IAAI,CAAC;IACV,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,sBAAsB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,4EAA4E;IAC5E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GACzC,SAAS,gCAAgC,KACvC,OAAO,CAAC,mBAAmB,CAuE7B,CAAC"}
|
|
@@ -106,12 +106,16 @@ export const create_test_account_with_credentials = async (options) => {
|
|
|
106
106
|
// Create API token (account-scoped — acting actor is per-request)
|
|
107
107
|
const { token: api_token, id: token_id, token_hash } = generate_api_token();
|
|
108
108
|
await query_create_api_token(deps, token_id, account.id, 'test-cli', token_hash);
|
|
109
|
-
// Create session (account-scoped — acting actor is per-request)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
// Create session (account-scoped — acting actor is per-request).
|
|
110
|
+
// Shares the mint primitive with `mint_test_session` / the
|
|
111
|
+
// `_testing_mint_session` action; here with the standard 30-day lifetime.
|
|
112
|
+
const { session_cookie } = await mint_test_session({
|
|
113
|
+
db,
|
|
114
|
+
keyring,
|
|
115
|
+
session_options,
|
|
116
|
+
account_id: account.id,
|
|
117
|
+
expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000,
|
|
118
|
+
});
|
|
115
119
|
return {
|
|
116
120
|
account: { id: account.id, username: account.username },
|
|
117
121
|
actor: { id: actor.id },
|
|
@@ -119,6 +123,27 @@ export const create_test_account_with_credentials = async (options) => {
|
|
|
119
123
|
session_cookie,
|
|
120
124
|
};
|
|
121
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* Mint a real `auth_session` row for an existing account and return a
|
|
128
|
+
* validly-signed session cookie value referencing it. Test-only — the
|
|
129
|
+
* forge behind the cross-backend expiry conformance cases (the
|
|
130
|
+
* `expired_session` principal): pass a negative `expires_in_seconds` to
|
|
131
|
+
* produce an *expired server-side session* whose signed cookie envelope is
|
|
132
|
+
* still well-formed. Both the TS `_testing_mint_session` action and the
|
|
133
|
+
* in-process `fixture.mint_expired_session()` seam call this so the write
|
|
134
|
+
* semantics match across transports.
|
|
135
|
+
*
|
|
136
|
+
* @mutates `options.db` — inserts one `auth_session` row.
|
|
137
|
+
*/
|
|
138
|
+
export const mint_test_session = async (options) => {
|
|
139
|
+
const { db, keyring, session_options, account_id, expires_in_seconds } = options;
|
|
140
|
+
const session_token = generate_session_token();
|
|
141
|
+
const session_hash = hash_session_token(session_token);
|
|
142
|
+
const expires_at = new Date(Date.now() + expires_in_seconds * 1000);
|
|
143
|
+
await query_create_session({ db }, session_hash, account_id, expires_at);
|
|
144
|
+
const session_cookie = await create_session_cookie_value(keyring, session_token, session_options);
|
|
145
|
+
return { session_cookie };
|
|
146
|
+
};
|
|
122
147
|
/**
|
|
123
148
|
* Bootstrap the test-DB keeper. Direct-query shortcut for the default
|
|
124
149
|
* `create_test_app` path — bootstrap is not what most tests exercise, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAiC9B,OAAO,EAIN,KAAK,oBAAoB,EACzB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AAEpE,eAAO,MAAM,sCAAsC,GAClD,SAAS,gCAAgC,KACvC,IA+TF,CAAC"}
|
|
@@ -18,7 +18,8 @@ import '../assert_dev_env.js';
|
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
20
|
import { describe, assert } from 'vitest';
|
|
21
|
-
import { AccountDeleteOutput, AccountUndeleteOutput, AccountPurgeOutput, AdminAccountListOutput, ERROR_CANNOT_DELETE_KEEPER, } from '../../auth/admin_action_specs.js';
|
|
21
|
+
import { AccountDeleteOutput, AccountUndeleteOutput, AccountPurgeOutput, AdminAccountListOutput, AuditLogListOutput, ERROR_CANNOT_DELETE_KEEPER, } from '../../auth/admin_action_specs.js';
|
|
22
|
+
import { ERROR_ACCOUNT_NOT_FOUND, ERROR_AUTHENTICATION_REQUIRED } from '../../http/error_schemas.js';
|
|
22
23
|
import { test_if } from './capabilities.js';
|
|
23
24
|
import { cross_rpc_call, error_reason, expect_output, } from './cell_cross_helpers.js';
|
|
24
25
|
import { SPINE_RPC_PATH } from './default_spine_surface.js';
|
|
@@ -56,6 +57,73 @@ export const describe_account_lifecycle_cross_tests = (options) => {
|
|
|
56
57
|
assert.strictEqual(purge.ok, false, 'purge of keeper account must be refused');
|
|
57
58
|
assert.strictEqual(error_reason(purge), ERROR_CANNOT_DELETE_KEEPER);
|
|
58
59
|
});
|
|
60
|
+
test_if(capabilities.account_lifecycle, 'fail-closed: a soft-deleted account’s session + bearer credentials no longer authenticate', async () => {
|
|
61
|
+
const fixture = await setup_test();
|
|
62
|
+
const victim = await fixture.create_account({ username: 'lifecycle_failclosed' });
|
|
63
|
+
const admin_headers = fixture.create_session_headers();
|
|
64
|
+
// Sanity: the victim's session authenticates while active, so the
|
|
65
|
+
// post-deletion 401 is a real fail-closed transition, not a
|
|
66
|
+
// never-valid credential passing vacuously.
|
|
67
|
+
const before = await cross_rpc_call(fixture.fresh_transport(), rpc_path, 'account_verify', undefined, victim.create_session_headers());
|
|
68
|
+
assert.ok(before.ok, 'victim session authenticates before deletion');
|
|
69
|
+
const deleted = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, 'account_delete', { account_id: victim.account.id }, admin_headers), AccountDeleteOutput);
|
|
70
|
+
assert.strictEqual(deleted.deleted, true);
|
|
71
|
+
// The tombstone blocks auth resolution (and the soft-delete
|
|
72
|
+
// revoked sessions/tokens) — the stale session credential must
|
|
73
|
+
// fail closed with a generic 401, not partially authenticate.
|
|
74
|
+
const session_probe = await cross_rpc_call(fixture.fresh_transport(), rpc_path, 'account_verify', undefined, victim.create_session_headers());
|
|
75
|
+
assert.strictEqual(session_probe.ok, false, 'soft-deleted account session must not authenticate');
|
|
76
|
+
assert.strictEqual(error_reason(session_probe), ERROR_AUTHENTICATION_REQUIRED);
|
|
77
|
+
// The victim's bearer token must fail closed too.
|
|
78
|
+
const bearer_probe = await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, 'account_verify', undefined, victim.create_bearer_headers());
|
|
79
|
+
assert.strictEqual(bearer_probe.ok, false, 'soft-deleted account bearer token must not authenticate');
|
|
80
|
+
assert.strictEqual(error_reason(bearer_probe), ERROR_AUTHENTICATION_REQUIRED);
|
|
81
|
+
});
|
|
82
|
+
test_if(capabilities.account_lifecycle, 'keeper guard emits a fail-loud failure-audit row (drained, cross-impl)', async () => {
|
|
83
|
+
const fixture = await setup_test();
|
|
84
|
+
const t = fixture.fresh_transport();
|
|
85
|
+
// Refused keeper self-delete — the guard fires before any mutation
|
|
86
|
+
// and emits a forensic `outcome: failure` audit row.
|
|
87
|
+
const del = await cross_rpc_call(t, rpc_path, 'account_delete', { account_id: fixture.account.id }, fixture.create_session_headers());
|
|
88
|
+
assert.strictEqual(error_reason(del), ERROR_CANNOT_DELETE_KEEPER);
|
|
89
|
+
// Deterministic barrier before reading: await in-flight
|
|
90
|
+
// fire-and-forget audit writes (the real await on the Rust spine;
|
|
91
|
+
// satisfied-by-construction on the TS spine via await_pending_effects).
|
|
92
|
+
const td = fixture.fresh_transport({ origin: null });
|
|
93
|
+
const drained = await cross_rpc_call(td, rpc_path, '_testing_drain_effects', undefined, fixture.create_daemon_token_headers());
|
|
94
|
+
assert.ok(drained.ok, `_testing_drain_effects failed: ${JSON.stringify(drained.error)}`);
|
|
95
|
+
// The failure row is now authoritative on both spines. `_testing_reset`
|
|
96
|
+
// wiped audit_log at setup, so the refused delete is the only
|
|
97
|
+
// account_delete event.
|
|
98
|
+
const listed = expect_output(await cross_rpc_call(t, rpc_path, 'audit_log_list', { event_type: 'account_delete' }, fixture.create_session_headers()), AuditLogListOutput);
|
|
99
|
+
const failure = listed.events.find((e) => e.outcome === 'failure' &&
|
|
100
|
+
e.metadata?.reason === ERROR_CANNOT_DELETE_KEEPER);
|
|
101
|
+
assert.ok(failure, 'keeper-removal guard must emit an account_delete outcome=failure audit row with reason cannot_delete_keeper');
|
|
102
|
+
});
|
|
103
|
+
test_if(capabilities.account_lifecycle, 'deterministic: double-undelete → second call is not_found', async () => {
|
|
104
|
+
const fixture = await setup_test();
|
|
105
|
+
const victim = await fixture.create_account({ username: 'lifecycle_double' });
|
|
106
|
+
const t = fixture.fresh_transport();
|
|
107
|
+
const admin_headers = fixture.create_session_headers();
|
|
108
|
+
const deleted = expect_output(await cross_rpc_call(t, rpc_path, 'account_delete', { account_id: victim.account.id }, admin_headers), AccountDeleteOutput);
|
|
109
|
+
assert.strictEqual(deleted.deleted, true);
|
|
110
|
+
// First undelete clears the tombstone.
|
|
111
|
+
const undeleted = expect_output(await cross_rpc_call(t, rpc_path, 'account_undelete', { account_id: victim.account.id }, admin_headers), AccountUndeleteOutput);
|
|
112
|
+
assert.strictEqual(undeleted.undeleted, true);
|
|
113
|
+
// Second undelete on the now-active account is a deterministic
|
|
114
|
+
// not_found — the query only matches soft-deleted rows, so the
|
|
115
|
+
// outcome is the same on both spines (no silent idempotent ok).
|
|
116
|
+
const again = await cross_rpc_call(t, rpc_path, 'account_undelete', { account_id: victim.account.id }, admin_headers);
|
|
117
|
+
assert.strictEqual(again.ok, false, 'double-undelete must not silently succeed');
|
|
118
|
+
assert.strictEqual(error_reason(again), ERROR_ACCOUNT_NOT_FOUND);
|
|
119
|
+
});
|
|
120
|
+
// The last-admin guard (`ERROR_CANNOT_DELETE_LAST_ADMIN`) is **not**
|
|
121
|
+
// cross-process-testable against this fixture: the per-test keeper
|
|
122
|
+
// permanently holds `ROLE_ADMIN` (bootstrap seeds `[ROLE_KEEPER,
|
|
123
|
+
// ROLE_ADMIN]` and there is no remove-admin-from-keeper path), so a
|
|
124
|
+
// non-keeper admin is never the *sole* active admin and the guard
|
|
125
|
+
// never fires here. Its logic is covered in-process by
|
|
126
|
+
// `src/test/auth/account_keeper_guard.db.test.ts`.
|
|
59
127
|
test_if(capabilities.account_lifecycle, 'admin_account_list include_deleted surfaces tombstoned rows with deleted_at set', async () => {
|
|
60
128
|
const fixture = await setup_test();
|
|
61
129
|
const victim = await fixture.create_account({ username: 'lifecycle_listed' });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import type { CellCrossTestOptions } from './cell_cross_helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the actor-lookup parity suite. Shares the shape of the cell /
|
|
5
|
+
* origin suites (`setup_test` / `capabilities` / `rpc_path`); reuses
|
|
6
|
+
* `CellCrossTestOptions` rather than minting a structural duplicate.
|
|
7
|
+
*/
|
|
8
|
+
export type ActorLookupCrossTestOptions = CellCrossTestOptions;
|
|
9
|
+
export declare const describe_actor_lookup_cross_tests: (options: ActorLookupCrossTestOptions) => void;
|
|
10
|
+
//# sourceMappingURL=actor_lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor_lookup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/actor_lookup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqC9B,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAGlE;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAS/D,eAAO,MAAM,iCAAiC,GAAI,SAAS,2BAA2B,KAAG,IAkDxF,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-backend parity suite for `actor_lookup`.
|
|
4
|
+
*
|
|
5
|
+
* `actor_lookup` is an opt-in batched id → label resolver
|
|
6
|
+
* (`{ids} → {actors: [{id, username, display_name?}]}`), not folded into the
|
|
7
|
+
* standard bundle. It's live-mounted on the spine RPC path but kept off the
|
|
8
|
+
* declared surface (`create_spine_surface_spec`) — like cells / ws / sse — so
|
|
9
|
+
* the standard cross suite's generic round-trip never drives it; this
|
|
10
|
+
* dedicated suite is its validator. Three cases over raw transport calls:
|
|
11
|
+
*
|
|
12
|
+
* - **anonymous → 401** — the account-grain auth gate refuses an
|
|
13
|
+
* unauthenticated caller before the handler runs.
|
|
14
|
+
* - **keeper resolves own actor → 200** — the populated round trip: the
|
|
15
|
+
* returned row carries the keeper's `id` + `username`, and **no**
|
|
16
|
+
* `account_id` / `email` / timestamp / role field (the wire shape's
|
|
17
|
+
* deliberate info-leak posture). This is the assertion that exercises the
|
|
18
|
+
* Rust row→JSON mapping against the TS canonical shape.
|
|
19
|
+
* - **empty `ids` → 400** — the `min(1)` input bound is enforced on both
|
|
20
|
+
* spines (TS Zod, Rust `parse_ids`).
|
|
21
|
+
*
|
|
22
|
+
* Runs both legs via the shared `{setup_test}` protocol: the in-process leg
|
|
23
|
+
* (`auth/actor_lookup_parity.db.test.ts`, plain `gro test`) and the
|
|
24
|
+
* cross-process leg (`cross_backend/actor_lookup.cross.test.ts`, the TS spine
|
|
25
|
+
* binaries + Rust `testing_spine_stub` over real HTTP). `actor_lookup` is
|
|
26
|
+
* mounted on every spine, so the suite is ungated.
|
|
27
|
+
*
|
|
28
|
+
* `$lib`-free by contract (relative specifiers only), like the sibling
|
|
29
|
+
* cross-backend suites.
|
|
30
|
+
*
|
|
31
|
+
* @module
|
|
32
|
+
*/
|
|
33
|
+
import { describe, test, assert } from 'vitest';
|
|
34
|
+
import { actor_lookup_action_spec } from '../../auth/actor_lookup_action_specs.js';
|
|
35
|
+
import { SPINE_RPC_PATH } from './default_spine_surface.js';
|
|
36
|
+
/** Keys that must never appear on an `actor_lookup` result row. */
|
|
37
|
+
const forbidden_row_keys = ['account_id', 'email', 'created_at', 'updated_at', 'role'];
|
|
38
|
+
/** Build the JSON-RPC envelope body for an `actor_lookup` call. */
|
|
39
|
+
const lookup_envelope = (ids, id) => JSON.stringify({ jsonrpc: '2.0', method: actor_lookup_action_spec.method, params: { ids }, id });
|
|
40
|
+
export const describe_actor_lookup_cross_tests = (options) => {
|
|
41
|
+
const { setup_test } = options;
|
|
42
|
+
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
43
|
+
describe('actor_lookup parity', () => {
|
|
44
|
+
test('anonymous → 401 (account-grain auth gate)', async () => {
|
|
45
|
+
const fixture = await setup_test();
|
|
46
|
+
const res = await fixture.fresh_transport()(rpc_path, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: { 'content-type': 'application/json' },
|
|
49
|
+
body: lookup_envelope([fixture.actor.id], 'anon-lookup'),
|
|
50
|
+
});
|
|
51
|
+
assert.strictEqual(res.status, 401, 'unauthenticated actor_lookup must be refused');
|
|
52
|
+
});
|
|
53
|
+
test('keeper resolves own actor → 200 with id + username, no control fields', async () => {
|
|
54
|
+
const fixture = await setup_test();
|
|
55
|
+
const res = await fixture.transport(rpc_path, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
58
|
+
body: lookup_envelope([fixture.actor.id], 'keeper-lookup'),
|
|
59
|
+
});
|
|
60
|
+
assert.strictEqual(res.status, 200, 'authenticated actor_lookup must succeed');
|
|
61
|
+
const body = (await res.json());
|
|
62
|
+
const actors = body.result?.actors;
|
|
63
|
+
assert(Array.isArray(actors), 'response carries an actors array');
|
|
64
|
+
assert.strictEqual(actors.length, 1, 'the keeper actor resolves to exactly one row');
|
|
65
|
+
const row = actors[0];
|
|
66
|
+
assert(row !== undefined, 'the resolved row is present');
|
|
67
|
+
assert.strictEqual(row.id, fixture.actor.id, 'resolved row id matches the requested actor');
|
|
68
|
+
assert.strictEqual(row.username, fixture.account.username, 'resolved row carries the keeper username');
|
|
69
|
+
for (const key of forbidden_row_keys) {
|
|
70
|
+
assert(!(key in row), `actor_lookup row must not leak '${key}'`);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
test('empty ids → 400 (min(1) input bound)', async () => {
|
|
74
|
+
const fixture = await setup_test();
|
|
75
|
+
const res = await fixture.transport(rpc_path, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
78
|
+
body: lookup_envelope([], 'empty-lookup'),
|
|
79
|
+
});
|
|
80
|
+
assert.strictEqual(res.status, 400, 'empty ids must fail input validation');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import type { CellCrossTestOptions } from './cell_cross_helpers.js';
|
|
3
|
+
/** Options for the actor-search parity suite (shares the cell/origin shape). */
|
|
4
|
+
export type ActorSearchCrossTestOptions = CellCrossTestOptions;
|
|
5
|
+
export declare const describe_actor_search_cross_tests: (options: ActorSearchCrossTestOptions) => void;
|
|
6
|
+
//# sourceMappingURL=actor_search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor_search.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/actor_search.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA2C9B,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAGlE,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAS/D,eAAO,MAAM,iCAAiC,GAAI,SAAS,2BAA2B,KAAG,IAyDxF,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-backend parity suite for `actor_search`.
|
|
4
|
+
*
|
|
5
|
+
* `actor_search` is an opt-in case-insensitive prefix search over
|
|
6
|
+
* `actor.name` (`{query, scope_ids?, limit?} → {actors: [{id, username,
|
|
7
|
+
* display_name?}]}`), not folded into the standard bundle. Like
|
|
8
|
+
* `actor_lookup` / cells, it's live-mounted on the spine RPC path but kept
|
|
9
|
+
* off the declared surface, so this dedicated suite is its validator. The
|
|
10
|
+
* security property under test is the **empty-`scope_ids` admin gate**:
|
|
11
|
+
*
|
|
12
|
+
* - **anonymous → 401** — the account-grain auth gate refuses an
|
|
13
|
+
* unauthenticated caller before the handler runs.
|
|
14
|
+
* - **non-admin + no `scope_ids` → 400** `actor_search_scope_required` — an
|
|
15
|
+
* unbounded global search is admin-only; a non-admin must scope the query.
|
|
16
|
+
* This is the core security assertion, exercised against each impl's real
|
|
17
|
+
* auth resolution.
|
|
18
|
+
* - **non-admin + `scope_ids` → 200** — passing a scope bypasses the admin
|
|
19
|
+
* requirement (results are filtered to actors holding active role_grants on
|
|
20
|
+
* those scopes); an unheld scope simply yields an empty result, not a
|
|
21
|
+
* rejection — proving the gate keys on `scope_ids` presence, not identity.
|
|
22
|
+
* - **admin + no `scope_ids` → 200** — the admin path reaches the unbounded
|
|
23
|
+
* search.
|
|
24
|
+
*
|
|
25
|
+
* Cites `security.md` §Authorization (the `actor_search` scope gate).
|
|
26
|
+
*
|
|
27
|
+
* Runs both legs via the shared `{setup_test}` protocol: in-process
|
|
28
|
+
* (`auth/actor_search_parity.db.test.ts`) + cross-process
|
|
29
|
+
* (`cross_backend/actor_search.cross.test.ts`, TS spine binaries + Rust
|
|
30
|
+
* `testing_spine_stub`). Mounted on every spine, so the suite is ungated.
|
|
31
|
+
*
|
|
32
|
+
* `$lib`-free by contract (relative specifiers only).
|
|
33
|
+
*
|
|
34
|
+
* @module
|
|
35
|
+
*/
|
|
36
|
+
import { describe, test, assert } from 'vitest';
|
|
37
|
+
import { actor_search_action_spec, ERROR_ACTOR_SEARCH_SCOPE_REQUIRED, } from '../../auth/actor_search_action_specs.js';
|
|
38
|
+
import { SPINE_RPC_PATH } from './default_spine_surface.js';
|
|
39
|
+
/** Nil UUID — an unheld scope id (no actor holds a role_grant on it). */
|
|
40
|
+
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
41
|
+
/** Build the JSON-RPC envelope body for an `actor_search` call. */
|
|
42
|
+
const search_envelope = (params, id) => JSON.stringify({ jsonrpc: '2.0', method: actor_search_action_spec.method, params, id });
|
|
43
|
+
export const describe_actor_search_cross_tests = (options) => {
|
|
44
|
+
const { setup_test } = options;
|
|
45
|
+
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
46
|
+
describe('actor_search parity', () => {
|
|
47
|
+
test('anonymous → 401 (account-grain auth gate)', async () => {
|
|
48
|
+
const fixture = await setup_test();
|
|
49
|
+
const res = await fixture.fresh_transport()(rpc_path, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
headers: { 'content-type': 'application/json' },
|
|
52
|
+
body: search_envelope({ query: 'a' }, 'anon-search'),
|
|
53
|
+
});
|
|
54
|
+
assert.strictEqual(res.status, 401, 'unauthenticated actor_search must be refused');
|
|
55
|
+
});
|
|
56
|
+
test('non-admin + no scope_ids → 400 actor_search_scope_required', async () => {
|
|
57
|
+
const fixture = await setup_test();
|
|
58
|
+
const account = await fixture.create_account();
|
|
59
|
+
const res = await fixture.fresh_transport()(rpc_path, {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
headers: { ...account.create_session_headers(), 'content-type': 'application/json' },
|
|
62
|
+
body: search_envelope({ query: 'a' }, 'nonadmin-noscope'),
|
|
63
|
+
});
|
|
64
|
+
assert.strictEqual(res.status, 400, 'non-admin unbounded search must be rejected');
|
|
65
|
+
const body = (await res.json());
|
|
66
|
+
assert.strictEqual(body.error?.data?.reason, ERROR_ACTOR_SEARCH_SCOPE_REQUIRED, 'rejection carries the scope-required reason');
|
|
67
|
+
});
|
|
68
|
+
test('non-admin + scope_ids → 200 (scope bypasses admin gate)', async () => {
|
|
69
|
+
const fixture = await setup_test();
|
|
70
|
+
const account = await fixture.create_account();
|
|
71
|
+
const res = await fixture.fresh_transport()(rpc_path, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { ...account.create_session_headers(), 'content-type': 'application/json' },
|
|
74
|
+
body: search_envelope({ query: 'a', scope_ids: [NIL_UUID] }, 'nonadmin-scope'),
|
|
75
|
+
});
|
|
76
|
+
assert.strictEqual(res.status, 200, 'non-admin with a scope filter is allowed');
|
|
77
|
+
const body = (await res.json());
|
|
78
|
+
assert(Array.isArray(body.result?.actors), 'response carries an actors array');
|
|
79
|
+
});
|
|
80
|
+
test('admin + no scope_ids → 200 (admin reaches unbounded search)', async () => {
|
|
81
|
+
const fixture = await setup_test();
|
|
82
|
+
const res = await fixture.transport(rpc_path, {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
85
|
+
body: search_envelope({ query: 'a' }, 'admin-noscope'),
|
|
86
|
+
});
|
|
87
|
+
assert.strictEqual(res.status, 200, 'admin unbounded search is allowed');
|
|
88
|
+
const body = (await res.json());
|
|
89
|
+
assert(Array.isArray(body.result?.actors), 'response carries an actors array');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import type { CellCrossTestOptions } from './cell_cross_helpers.js';
|
|
3
|
+
/** Options for the app-settings effect suite (shares the cell/origin shape). */
|
|
4
|
+
export type AppSettingsCrossTestOptions = CellCrossTestOptions;
|
|
5
|
+
export declare const describe_app_settings_cross_tests: (options: AppSettingsCrossTestOptions) => void;
|
|
6
|
+
//# sourceMappingURL=app_settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app_settings.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/app_settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsC9B,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAGlE,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAiB/D,eAAO,MAAM,iCAAiC,GAAI,SAAS,2BAA2B,KAAG,IA8DxF,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-backend effect suite for the `open_signup` app setting.
|
|
4
|
+
*
|
|
5
|
+
* The declarative conformance table pins the admin gate on
|
|
6
|
+
* `app_settings_get` / `app_settings_update` (401 / 403 / 200). This suite
|
|
7
|
+
* pins the **behavioral effect** of the toggle end to end: an admin flips
|
|
8
|
+
* `open_signup` via `app_settings_update`, and a subsequent anonymous
|
|
9
|
+
* `POST /signup` observes the new value.
|
|
10
|
+
*
|
|
11
|
+
* - **toggle on → anonymous signup without an invite succeeds (200)** — with
|
|
12
|
+
* `open_signup: true`, the invite gate is skipped.
|
|
13
|
+
* - **toggle off → anonymous signup is refused (403 `no_matching_invite`)** —
|
|
14
|
+
* flipping it back restores the invite requirement, proving the gate keys
|
|
15
|
+
* on the live value rather than a one-time read.
|
|
16
|
+
*
|
|
17
|
+
* The signup handler reads the toggle fresh from the database on every
|
|
18
|
+
* request, so the admin's write is visible to the next signup. This suite
|
|
19
|
+
* runs in a single process, so it validates the read-through *mechanism* —
|
|
20
|
+
* not multi-process consistency (which the fresh-read shape provides by
|
|
21
|
+
* construction but no single-binary test can observe).
|
|
22
|
+
*
|
|
23
|
+
* Cites `security.md` §Signup. Runs both legs via the shared `{setup_test}`
|
|
24
|
+
* protocol: in-process (`auth/app_settings_parity.db.test.ts`) +
|
|
25
|
+
* cross-process (`cross_backend/app_settings.cross.test.ts`, TS spine
|
|
26
|
+
* binaries + Rust `testing_spine_stub`). Mounted on every spine, so the
|
|
27
|
+
* suite is ungated.
|
|
28
|
+
*
|
|
29
|
+
* `$lib`-free by contract (relative specifiers only).
|
|
30
|
+
*
|
|
31
|
+
* @module
|
|
32
|
+
*/
|
|
33
|
+
import { describe, test, assert } from 'vitest';
|
|
34
|
+
import { app_settings_update_action_spec } from '../../auth/admin_action_specs.js';
|
|
35
|
+
import { ERROR_NO_MATCHING_INVITE } from '../../http/error_schemas.js';
|
|
36
|
+
import { SPINE_RPC_PATH } from './default_spine_surface.js';
|
|
37
|
+
/** REST signup path on the spine surface (`/api/account` prefix + `/signup`). */
|
|
38
|
+
const SIGNUP_PATH = '/api/account/signup';
|
|
39
|
+
/** A password that satisfies the creation-strength schema (min 12). */
|
|
40
|
+
const SIGNUP_PASSWORD = 'securepassword123';
|
|
41
|
+
/** Build the JSON-RPC envelope for an `app_settings_update` call. */
|
|
42
|
+
const update_envelope = (open_signup, id) => JSON.stringify({
|
|
43
|
+
jsonrpc: '2.0',
|
|
44
|
+
method: app_settings_update_action_spec.method,
|
|
45
|
+
params: { open_signup },
|
|
46
|
+
id,
|
|
47
|
+
});
|
|
48
|
+
export const describe_app_settings_cross_tests = (options) => {
|
|
49
|
+
const { setup_test } = options;
|
|
50
|
+
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
51
|
+
describe('app_settings open_signup effect', () => {
|
|
52
|
+
test('admin enables open_signup → anonymous signup without invite succeeds', async () => {
|
|
53
|
+
const fixture = await setup_test();
|
|
54
|
+
const enable = await fixture.transport(rpc_path, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
57
|
+
body: update_envelope(true, 'enable-open-signup'),
|
|
58
|
+
});
|
|
59
|
+
assert.strictEqual(enable.status, 200, 'admin app_settings_update must succeed');
|
|
60
|
+
const res = await fixture.fresh_transport()(SIGNUP_PATH, {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: { 'content-type': 'application/json' },
|
|
63
|
+
body: JSON.stringify({ username: 'open_signup_user', password: SIGNUP_PASSWORD }),
|
|
64
|
+
});
|
|
65
|
+
assert.strictEqual(res.status, 200, 'open signup must admit an anonymous account');
|
|
66
|
+
const body = (await res.json());
|
|
67
|
+
assert.strictEqual(body.ok, true, 'signup response reports success');
|
|
68
|
+
});
|
|
69
|
+
test('admin disables open_signup → anonymous signup is refused (no_matching_invite)', async () => {
|
|
70
|
+
const fixture = await setup_test();
|
|
71
|
+
// Enable then disable so the assertion proves the *flip back* takes
|
|
72
|
+
// effect, not merely the closed default.
|
|
73
|
+
const enable = await fixture.transport(rpc_path, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
76
|
+
body: update_envelope(true, 'enable-before-disable'),
|
|
77
|
+
});
|
|
78
|
+
assert.strictEqual(enable.status, 200, 'admin app_settings_update (enable) must succeed');
|
|
79
|
+
const disable = await fixture.transport(rpc_path, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: { ...fixture.create_session_headers(), 'content-type': 'application/json' },
|
|
82
|
+
body: update_envelope(false, 'disable-open-signup'),
|
|
83
|
+
});
|
|
84
|
+
assert.strictEqual(disable.status, 200, 'admin app_settings_update (disable) must succeed');
|
|
85
|
+
const res = await fixture.fresh_transport()(SIGNUP_PATH, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: { 'content-type': 'application/json' },
|
|
88
|
+
body: JSON.stringify({ username: 'closed_signup_user', password: SIGNUP_PASSWORD }),
|
|
89
|
+
});
|
|
90
|
+
assert.strictEqual(res.status, 403, 'closed signup must refuse a no-invite anonymous account');
|
|
91
|
+
const body = (await res.json());
|
|
92
|
+
assert.strictEqual(body.error, ERROR_NO_MATCHING_INVITE, 'rejection carries the no-matching-invite reason');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
@@ -106,7 +106,7 @@ export interface BackendConfig {
|
|
|
106
106
|
/**
|
|
107
107
|
* Capabilities this backend supports — drives `test_if(capabilities.X, ...)`
|
|
108
108
|
* gating in suite bodies. See `capabilities.ts` for the vocabulary and
|
|
109
|
-
* existing flags.
|
|
109
|
+
* existing flags.
|
|
110
110
|
*/
|
|
111
111
|
readonly capabilities: BackendCapabilities;
|
|
112
112
|
}
|
|
@@ -66,15 +66,6 @@ export interface BackendCapabilities {
|
|
|
66
66
|
* this flag opts a backend into the lifecycle parity coverage.
|
|
67
67
|
*/
|
|
68
68
|
readonly account_lifecycle: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Test has direct access to backend-internal state (keyring for
|
|
71
|
-
* signing cookies, DB pool for FK-structural raw queries). Always
|
|
72
|
-
* `true` for in-process Hono via `default_in_process_setup`; always
|
|
73
|
-
* `false` cross-process. Gates the 3 keyring reads in
|
|
74
|
-
* `describe_standard_integration_tests` (expired-cookie generation)
|
|
75
|
-
* and the FK-structural raw query in `describe_audit_completeness_tests`.
|
|
76
|
-
*/
|
|
77
|
-
readonly in_process_only: boolean;
|
|
78
69
|
}
|
|
79
70
|
/**
|
|
80
71
|
* Capability declarations for the in-process Hono transport. Every flag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmB9B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmB9B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACpC;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBASpC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,OAAO,EAAE,MAAM,MAAM,EAAE,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAG,IAMrF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { type CellCrossTestOptions } from './cell_cross_helpers.js';
|
|
3
|
+
/** App role the holder is seeded with; matches the spine's registered role. */
|
|
4
|
+
export declare const CELL_EDITOR_ROLE = "cell_editor";
|
|
5
|
+
/** Username the fixture seeds (via `extra_accounts`) holding `CELL_EDITOR_ROLE`. */
|
|
6
|
+
export declare const CELL_ROLE_HOLDER_USERNAME = "cell_role_holder";
|
|
7
|
+
export declare const describe_cell_grant_role_cross_tests: (options: CellCrossTestOptions) => void;
|
|
8
|
+
//# sourceMappingURL=cell_grant_role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell_grant_role.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/cell_grant_role.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6C9B,OAAO,EACN,KAAK,oBAAoB,EAIzB,MAAM,yBAAyB,CAAC;AAGjC,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,gBAAyB,CAAC;AAEvD,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAK5D,eAAO,MAAM,oCAAoC,GAAI,SAAS,oBAAoB,KAAG,IAuIpF,CAAC"}
|