@vellumai/assistant 0.10.12-dev.202607272158.a865fd0 → 0.10.12-dev.202607272227.bd2aa0b
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/package.json +1 -1
- package/src/__tests__/document-tool-security.test.ts +95 -0
- package/src/__tests__/dynamic-skill-background-guard.test.ts +19 -6
- package/src/__tests__/gateway-threshold-reader-mock.ts +99 -0
- package/src/__tests__/require-fresh-approval.test.ts +37 -38
- package/src/__tests__/tool-approval-handler.test.ts +528 -56
- package/src/__tests__/tool-execution-pipeline.benchmark.test.ts +4 -4
- package/src/__tests__/workspace-policy.test.ts +263 -0
- package/src/permissions/channel-permission-query.test.ts +69 -0
- package/src/permissions/channel-permission-query.ts +73 -1
- package/src/permissions/checker.ts +1 -1
- package/src/permissions/gateway-threshold-reader.test.ts +224 -17
- package/src/permissions/gateway-threshold-reader.ts +82 -10
- package/src/permissions/workspace-policy.ts +133 -12
- package/src/tools/__tests__/document-tool-input-schemas.test.ts +103 -0
- package/src/tools/__tests__/schedule-tool-input-schemas.test.ts +15 -116
- package/src/tools/__tests__/tool-schema-drift-harness.ts +142 -0
- package/src/tools/document/document-comment-tool.test.ts +49 -0
- package/src/tools/document/document-comment-tool.ts +45 -6
- package/src/tools/document/document-tool.ts +142 -24
- package/src/tools/policy-context.ts +20 -4
- package/src/tools/tool-approval-handler.ts +259 -46
package/package.json
CHANGED
|
@@ -3,9 +3,12 @@ import { beforeEach, describe, expect, test } from "bun:test";
|
|
|
3
3
|
import { getDocumentById } from "../documents/document-store.js";
|
|
4
4
|
import { getSqlite } from "../persistence/db-connection.js";
|
|
5
5
|
import {
|
|
6
|
+
executeDocumentCreate,
|
|
6
7
|
executeDocumentDelete,
|
|
8
|
+
executeDocumentFind,
|
|
7
9
|
executeDocumentList,
|
|
8
10
|
executeDocumentRead,
|
|
11
|
+
executeDocumentReplaceText,
|
|
9
12
|
executeDocumentUpdate,
|
|
10
13
|
} from "../tools/document/document-tool.js";
|
|
11
14
|
import type { ToolContext, ToolExecutionResult } from "../tools/types.js";
|
|
@@ -338,3 +341,95 @@ describe("executeDocumentUpdate — input validation", () => {
|
|
|
338
341
|
expect(body.error).toContain("Invalid input: surface_id is required");
|
|
339
342
|
});
|
|
340
343
|
});
|
|
344
|
+
|
|
345
|
+
// ── model-input schema validation (LUM-2854) ─────────────────────────
|
|
346
|
+
|
|
347
|
+
describe("document tools — model-input schema validation", () => {
|
|
348
|
+
beforeEach(() => {
|
|
349
|
+
bootstrapDocumentTables();
|
|
350
|
+
seedFixtureDocuments();
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test("document_find rejects a non-string query instead of crashing downstream", () => {
|
|
354
|
+
const result = executeDocumentFind(
|
|
355
|
+
{ surface_id: "doc-current", query: 42 },
|
|
356
|
+
makeContext(),
|
|
357
|
+
);
|
|
358
|
+
expect(result.isError).toBe(true);
|
|
359
|
+
expect(result.content).toContain('Invalid input for tool "document_find"');
|
|
360
|
+
expect(result.content).toContain("query");
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
test("document_find rejects a missing query cleanly", () => {
|
|
364
|
+
const result = executeDocumentFind(
|
|
365
|
+
{ surface_id: "doc-current" },
|
|
366
|
+
makeContext(),
|
|
367
|
+
);
|
|
368
|
+
expect(result.isError).toBe(true);
|
|
369
|
+
expect(result.content).toContain('Invalid input for tool "document_find"');
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
test("document_find treats null option flags as omitted", () => {
|
|
373
|
+
const result = executeDocumentFind(
|
|
374
|
+
{
|
|
375
|
+
surface_id: "doc-current",
|
|
376
|
+
query: "current",
|
|
377
|
+
regex: null,
|
|
378
|
+
case_sensitive: null,
|
|
379
|
+
},
|
|
380
|
+
makeContext(),
|
|
381
|
+
);
|
|
382
|
+
expect(result.isError).toBe(false);
|
|
383
|
+
const body = parseResult<{ total_matches: number }>(result);
|
|
384
|
+
expect(body.total_matches).toBe(1);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test("document_create rejects a non-string title instead of persisting it", () => {
|
|
388
|
+
const result = executeDocumentCreate(
|
|
389
|
+
{ title: 42, initial_content: "hello" },
|
|
390
|
+
makeContext({ conversationId: "conv-current" }),
|
|
391
|
+
);
|
|
392
|
+
expect(result.isError).toBe(true);
|
|
393
|
+
expect(result.content).toContain(
|
|
394
|
+
'Invalid input for tool "document_create"',
|
|
395
|
+
);
|
|
396
|
+
expect(result.content).toContain("title");
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
test("document_update rejects a non-string content before the bespoke checks", () => {
|
|
400
|
+
const result = executeDocumentUpdate(
|
|
401
|
+
{ surface_id: "doc-current", content: 42 },
|
|
402
|
+
makeContext(),
|
|
403
|
+
);
|
|
404
|
+
expect(result.isError).toBe(true);
|
|
405
|
+
expect(result.content).toContain(
|
|
406
|
+
'Invalid input for tool "document_update"',
|
|
407
|
+
);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test("document_list still silently ignores a malformed query", () => {
|
|
411
|
+
const result = executeDocumentList({ query: 42 }, makeContext());
|
|
412
|
+
expect(result.isError).toBe(false);
|
|
413
|
+
const body = parseResult<{ documents: Array<{ surface_id: string }> }>(
|
|
414
|
+
result,
|
|
415
|
+
);
|
|
416
|
+
expect(body.documents.map((d) => d.surface_id)).toEqual(["doc-current"]);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test("document_replace_text rejects a non-number max_replacements", () => {
|
|
420
|
+
const result = executeDocumentReplaceText(
|
|
421
|
+
{
|
|
422
|
+
surface_id: "doc-current",
|
|
423
|
+
find: "current",
|
|
424
|
+
replace: "new",
|
|
425
|
+
max_replacements: "3",
|
|
426
|
+
},
|
|
427
|
+
makeContext(),
|
|
428
|
+
);
|
|
429
|
+
expect(result.isError).toBe(true);
|
|
430
|
+
expect(result.content).toContain(
|
|
431
|
+
'Invalid input for tool "document_replace_text"',
|
|
432
|
+
);
|
|
433
|
+
expect(result.content).toContain("max_replacements");
|
|
434
|
+
});
|
|
435
|
+
});
|
|
@@ -19,6 +19,10 @@ import { afterAll, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
|
19
19
|
|
|
20
20
|
import { RiskLevel } from "../permissions/types.js";
|
|
21
21
|
import type { ToolExecutionResult } from "../tools/types.js";
|
|
22
|
+
import {
|
|
23
|
+
installThresholdReaderMock,
|
|
24
|
+
thresholdReaderMock,
|
|
25
|
+
} from "./gateway-threshold-reader-mock.js";
|
|
22
26
|
|
|
23
27
|
// ---------------------------------------------------------------------------
|
|
24
28
|
// Mock setup — mirrors require-fresh-approval.test.ts patterns
|
|
@@ -37,8 +41,20 @@ let dynamicSkillLoad = false;
|
|
|
37
41
|
*/
|
|
38
42
|
let checkDecision = "prompt";
|
|
39
43
|
|
|
44
|
+
// The real builder returns undefined for these contexts (guardian turns with
|
|
45
|
+
// no channel coordinates), which is what this suite wants. It is registered
|
|
46
|
+
// rather than hard-coded because `mock.module` is process-global: a stub that
|
|
47
|
+
// always returned undefined would also be the builder other test files see,
|
|
48
|
+
// silently stripping the channel coordinates their contexts supply. Captured
|
|
49
|
+
// by value first — `mock.module` swaps the module's exports in place, so
|
|
50
|
+
// reading it through the namespace inside the factory would recurse.
|
|
51
|
+
const realCellQueryModule =
|
|
52
|
+
await import("../permissions/channel-permission-query.js");
|
|
40
53
|
mock.module("../permissions/channel-permission-query.js", () => ({
|
|
41
|
-
buildChannelPermissionCellQuery:
|
|
54
|
+
buildChannelPermissionCellQuery:
|
|
55
|
+
realCellQueryModule.buildChannelPermissionCellQuery,
|
|
56
|
+
effectiveChannelCellThreshold:
|
|
57
|
+
realCellQueryModule.effectiveChannelCellThreshold,
|
|
42
58
|
}));
|
|
43
59
|
|
|
44
60
|
// The scenario under test is "no trust rule covers this load" (a covering rule
|
|
@@ -74,11 +90,8 @@ mock.module("../tools/registry.js", () => ({
|
|
|
74
90
|
|
|
75
91
|
// Background threshold "medium" covers the medium-risk load — the guard,
|
|
76
92
|
// not the threshold, must be what blocks the dynamic case.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
refreshAutoApproveThreshold: async () => null,
|
|
80
|
-
_clearGlobalCacheForTesting: () => {},
|
|
81
|
-
}));
|
|
93
|
+
installThresholdReaderMock();
|
|
94
|
+
thresholdReaderMock.threshold = "medium";
|
|
82
95
|
|
|
83
96
|
mock.module("../tools/shared/filesystem/path-policy.js", () => ({
|
|
84
97
|
sandboxPolicy: () => ({ ok: false }),
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared module mock for `permissions/gateway-threshold-reader`.
|
|
3
|
+
*
|
|
4
|
+
* `mock.module` registrations are process-global and last-one-wins, so files
|
|
5
|
+
* that each stubbed this module their own way overwrote each other depending
|
|
6
|
+
* on load order — a file could pass alone and fail in a batch (or worse, pass
|
|
7
|
+
* for the wrong reason) because a sibling's stub was the one actually live.
|
|
8
|
+
*
|
|
9
|
+
* Every file registers this same delegating mock instead and steers it by
|
|
10
|
+
* writing to {@link thresholdReaderMock}. Which registration wins no longer
|
|
11
|
+
* changes behaviour, so the stubs a test sets are the stubs it gets.
|
|
12
|
+
*
|
|
13
|
+
* Holds no production imports — only mutable state the mock reads — so it is
|
|
14
|
+
* safe to load from preload-time test machinery.
|
|
15
|
+
*/
|
|
16
|
+
import { mock } from "bun:test";
|
|
17
|
+
|
|
18
|
+
/** What the mocked cell lookup resolves to. `ok: false` is a transport failure. */
|
|
19
|
+
export type MockCellResult =
|
|
20
|
+
| { ok: true; resolved: { threshold: string; scope: string } | null }
|
|
21
|
+
| { ok: false };
|
|
22
|
+
|
|
23
|
+
export interface ThresholdReaderMockState {
|
|
24
|
+
/** Resolved by `getAutoApproveThreshold`. */
|
|
25
|
+
threshold: string | undefined;
|
|
26
|
+
/** Resolved by `refreshAutoApproveThreshold`; `null` means "refresh failed". */
|
|
27
|
+
refreshed: string | null;
|
|
28
|
+
/** Resolved by `resolveChannelPermissionCell`. */
|
|
29
|
+
cell: MockCellResult;
|
|
30
|
+
/** The collapsed-global room default `channelNoCellDefault` derives. */
|
|
31
|
+
roomDefault: string | undefined;
|
|
32
|
+
/** Every `getAutoApproveThreshold` call, in order. */
|
|
33
|
+
thresholdReads: Array<{
|
|
34
|
+
conversationId?: string;
|
|
35
|
+
executionContext?: string;
|
|
36
|
+
cellQuery?: Record<string, unknown>;
|
|
37
|
+
}>;
|
|
38
|
+
/** How many times the cell was looked up. */
|
|
39
|
+
cellLookups: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const thresholdReaderMock: ThresholdReaderMockState = {
|
|
43
|
+
threshold: undefined,
|
|
44
|
+
refreshed: null,
|
|
45
|
+
cell: { ok: true, resolved: null },
|
|
46
|
+
roomDefault: "low",
|
|
47
|
+
thresholdReads: [],
|
|
48
|
+
cellLookups: 0,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Restore the defaults: no cell anywhere, a Conservative room default,
|
|
53
|
+
* failed refresh, no recorded calls.
|
|
54
|
+
*/
|
|
55
|
+
export function resetThresholdReaderMock(): void {
|
|
56
|
+
thresholdReaderMock.threshold = undefined;
|
|
57
|
+
thresholdReaderMock.refreshed = null;
|
|
58
|
+
thresholdReaderMock.cell = { ok: true, resolved: null };
|
|
59
|
+
thresholdReaderMock.roomDefault = "low";
|
|
60
|
+
thresholdReaderMock.thresholdReads.length = 0;
|
|
61
|
+
thresholdReaderMock.cellLookups = 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Register the mock. Call at module scope, before importing the code under
|
|
66
|
+
* test. Safe to call from several files in one run — each registration
|
|
67
|
+
* installs the same delegating stubs.
|
|
68
|
+
*/
|
|
69
|
+
export function installThresholdReaderMock(): void {
|
|
70
|
+
mock.module("../permissions/gateway-threshold-reader.js", () => ({
|
|
71
|
+
getAutoApproveThreshold: async (
|
|
72
|
+
conversationId?: string,
|
|
73
|
+
executionContext?: string,
|
|
74
|
+
cellQuery?: Record<string, unknown>,
|
|
75
|
+
) => {
|
|
76
|
+
thresholdReaderMock.thresholdReads.push({
|
|
77
|
+
conversationId,
|
|
78
|
+
executionContext,
|
|
79
|
+
cellQuery,
|
|
80
|
+
});
|
|
81
|
+
return thresholdReaderMock.threshold;
|
|
82
|
+
},
|
|
83
|
+
refreshAutoApproveThreshold: async () => thresholdReaderMock.refreshed,
|
|
84
|
+
resolveChannelPermissionCell: async () => {
|
|
85
|
+
thresholdReaderMock.cellLookups += 1;
|
|
86
|
+
return thresholdReaderMock.cell;
|
|
87
|
+
},
|
|
88
|
+
// Mirrors the production guard: only a successful no-cell walk for a
|
|
89
|
+
// non-guardian derives the default. Reimplemented here (three lines)
|
|
90
|
+
// because this file must hold no production imports.
|
|
91
|
+
channelNoCellDefault: async (cell: MockCellResult, contactType: string) => {
|
|
92
|
+
if (!cell.ok || cell.resolved || contactType === "guardian") {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return thresholdReaderMock.roomDefault;
|
|
96
|
+
},
|
|
97
|
+
_clearGlobalCacheForTesting: () => {},
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
@@ -19,6 +19,10 @@ import {
|
|
|
19
19
|
|
|
20
20
|
import { RiskLevel, type ScopeOption } from "../permissions/types.js";
|
|
21
21
|
import type { ToolExecutionResult } from "../tools/types.js";
|
|
22
|
+
import {
|
|
23
|
+
installThresholdReaderMock,
|
|
24
|
+
thresholdReaderMock,
|
|
25
|
+
} from "./gateway-threshold-reader-mock.js";
|
|
22
26
|
|
|
23
27
|
// ---------------------------------------------------------------------------
|
|
24
28
|
// Terminal audit mock — the permission checker / executor call these directly
|
|
@@ -55,13 +59,6 @@ let riskOverride: string = "high";
|
|
|
55
59
|
/** Scope options override — controls whether persistent decisions are offered. */
|
|
56
60
|
let scopeOptionsOverride: ScopeOption[] | undefined;
|
|
57
61
|
|
|
58
|
-
/**
|
|
59
|
-
* Auto-approve threshold returned to the permission checker. "high" is the
|
|
60
|
-
* full-access posture under which the requireFreshApproval promotion is
|
|
61
|
-
* skipped; every lower value still promotes allow → prompt.
|
|
62
|
-
*/
|
|
63
|
-
let thresholdOverride: "none" | "low" | "medium" | "high" = "medium";
|
|
64
|
-
|
|
65
62
|
/**
|
|
66
63
|
* Sentinel cell query the mocked builder returns. When set, the permission
|
|
67
64
|
* checker must thread it into every gateway threshold read for the
|
|
@@ -69,8 +66,23 @@ let thresholdOverride: "none" | "low" | "medium" | "high" = "medium";
|
|
|
69
66
|
*/
|
|
70
67
|
let cellQueryOverride: Record<string, unknown> | undefined;
|
|
71
68
|
|
|
69
|
+
// Falls through to the real builder when no sentinel is set. `mock.module` is
|
|
70
|
+
// process-global, so a hard-coded return here would also be the builder other
|
|
71
|
+
// test files see — and silently strip the channel coordinates their contexts
|
|
72
|
+
// supply, depending on which registration loaded last. The real function is
|
|
73
|
+
// captured by value first: `mock.module` swaps the module's exports in place,
|
|
74
|
+
// so reading it through the namespace inside the factory would resolve to this
|
|
75
|
+
// mock and recurse.
|
|
76
|
+
const realCellQueryModule =
|
|
77
|
+
await import("../permissions/channel-permission-query.js");
|
|
78
|
+
const realBuildCellQuery = realCellQueryModule.buildChannelPermissionCellQuery;
|
|
79
|
+
const realEffectiveCellThreshold =
|
|
80
|
+
realCellQueryModule.effectiveChannelCellThreshold;
|
|
72
81
|
mock.module("../permissions/channel-permission-query.js", () => ({
|
|
73
|
-
buildChannelPermissionCellQuery: (
|
|
82
|
+
buildChannelPermissionCellQuery: (
|
|
83
|
+
...args: Parameters<typeof realBuildCellQuery>
|
|
84
|
+
) => cellQueryOverride ?? realBuildCellQuery(...args),
|
|
85
|
+
effectiveChannelCellThreshold: realEffectiveCellThreshold,
|
|
74
86
|
}));
|
|
75
87
|
|
|
76
88
|
mock.module("../permissions/checker.js", () => ({
|
|
@@ -130,28 +142,15 @@ mock.module("../tools/registry.js", () => ({
|
|
|
130
142
|
getAllTools: () => [],
|
|
131
143
|
}));
|
|
132
144
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
getAutoApproveThreshold: async (
|
|
143
|
-
conversationId?: string,
|
|
144
|
-
executionContext?: string,
|
|
145
|
-
cellQuery?: Record<string, unknown>,
|
|
146
|
-
) => {
|
|
147
|
-
thresholdReadLog.push({ conversationId, executionContext, cellQuery });
|
|
148
|
-
return thresholdOverride;
|
|
149
|
-
},
|
|
150
|
-
// Refresh failure ("null") keeps the original decision — these tests
|
|
151
|
-
// exercise the cached-threshold paths only.
|
|
152
|
-
refreshAutoApproveThreshold: async () => null,
|
|
153
|
-
_clearGlobalCacheForTesting: () => {},
|
|
154
|
-
}));
|
|
145
|
+
// The mock defaults leave no cell at any cascade level, so the sensitive-tool
|
|
146
|
+
// gate's capability floor stands on its own — these tests are about
|
|
147
|
+
// fresh-approval promotion, not the channel matrix. `thresholdReads` records
|
|
148
|
+
// every getAutoApproveThreshold call so tests can assert the cell query is
|
|
149
|
+
// threaded into each read (including the background auto-approve).
|
|
150
|
+
installThresholdReaderMock();
|
|
151
|
+
|
|
152
|
+
/** Records every getAutoApproveThreshold call. */
|
|
153
|
+
const thresholdReadLog = thresholdReaderMock.thresholdReads;
|
|
155
154
|
|
|
156
155
|
// Stub the workflow run manager so the `manage_workflows` resume gate can read a
|
|
157
156
|
// target run's STORED capabilities without a real journal/DB. Tests set
|
|
@@ -209,7 +208,7 @@ describe("requireFreshApproval: non-interactive guardian denial", () => {
|
|
|
209
208
|
checkResultOverride = undefined;
|
|
210
209
|
scopeOptionsOverride = undefined;
|
|
211
210
|
riskOverride = "high";
|
|
212
|
-
|
|
211
|
+
thresholdReaderMock.threshold = "medium";
|
|
213
212
|
cellQueryOverride = undefined;
|
|
214
213
|
thresholdReadLog.length = 0;
|
|
215
214
|
});
|
|
@@ -375,7 +374,7 @@ describe("requireFreshApproval: context flag propagation", () => {
|
|
|
375
374
|
checkResultOverride = undefined;
|
|
376
375
|
scopeOptionsOverride = undefined;
|
|
377
376
|
riskOverride = "high";
|
|
378
|
-
|
|
377
|
+
thresholdReaderMock.threshold = "medium";
|
|
379
378
|
});
|
|
380
379
|
|
|
381
380
|
afterEach(() => {});
|
|
@@ -404,7 +403,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
404
403
|
checkResultOverride = undefined;
|
|
405
404
|
scopeOptionsOverride = undefined;
|
|
406
405
|
riskOverride = "low";
|
|
407
|
-
|
|
406
|
+
thresholdReaderMock.threshold = "medium";
|
|
408
407
|
fakeWorkflowRun = null;
|
|
409
408
|
});
|
|
410
409
|
|
|
@@ -445,7 +444,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
445
444
|
"run_workflow side-effecting launch prompts at the %s threshold (non-full-access posture)",
|
|
446
445
|
async (threshold) => {
|
|
447
446
|
checkResultOverride = { decision: "allow", reason: "allowed" };
|
|
448
|
-
|
|
447
|
+
thresholdReaderMock.threshold = threshold;
|
|
449
448
|
const state = { prompted: false };
|
|
450
449
|
const executor = new ToolExecutor(trackingPrompter(state));
|
|
451
450
|
const ctx = makeContext();
|
|
@@ -466,7 +465,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
466
465
|
// Full-access posture auto-approves even high-risk tools, so the
|
|
467
466
|
// requireFreshApproval promotion is skipped — the grant auto-allows.
|
|
468
467
|
checkResultOverride = { decision: "allow", reason: "allowed" };
|
|
469
|
-
|
|
468
|
+
thresholdReaderMock.threshold = "high";
|
|
470
469
|
const state = { prompted: false };
|
|
471
470
|
const executor = new ToolExecutor(trackingPrompter(state));
|
|
472
471
|
const ctx = makeContext();
|
|
@@ -488,7 +487,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
488
487
|
// Full access skips the fresh-approval promotion but never overrides an
|
|
489
488
|
// explicit deny — deny rules win regardless of posture.
|
|
490
489
|
checkResultOverride = { decision: "deny", reason: "blocked by rule" };
|
|
491
|
-
|
|
490
|
+
thresholdReaderMock.threshold = "high";
|
|
492
491
|
const state = { prompted: false };
|
|
493
492
|
const executor = new ToolExecutor(trackingPrompter(state));
|
|
494
493
|
const ctx = makeContext();
|
|
@@ -505,7 +504,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
505
504
|
|
|
506
505
|
test("a deny rule still blocks a side-effecting launch at a normal threshold", async () => {
|
|
507
506
|
checkResultOverride = { decision: "deny", reason: "blocked by rule" };
|
|
508
|
-
|
|
507
|
+
thresholdReaderMock.threshold = "medium";
|
|
509
508
|
const state = { prompted: false };
|
|
510
509
|
const executor = new ToolExecutor(trackingPrompter(state));
|
|
511
510
|
const ctx = makeContext();
|
|
@@ -523,7 +522,7 @@ describe("requireFreshApproval: workflow capability grants", () => {
|
|
|
523
522
|
test("a read-only launch (no requireFreshApproval) is unaffected by a normal threshold", async () => {
|
|
524
523
|
// No requireFreshApproval means the allow stands untouched at any posture.
|
|
525
524
|
checkResultOverride = { decision: "allow", reason: "allowed" };
|
|
526
|
-
|
|
525
|
+
thresholdReaderMock.threshold = "medium";
|
|
527
526
|
const state = { prompted: false };
|
|
528
527
|
const executor = new ToolExecutor(trackingPrompter(state));
|
|
529
528
|
const ctx = makeContext();
|