mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
test(cli): align the daemon trust-grant case with the workspace restriction
security.folderTrust is now stripped from workspace scope, so a grant on
a workspace that only self-enables trust reports the disabled state
instead of refusing an ineffective grant. Keep the alias DO_NOT_TRUST
fixture: if the restriction regresses, the grant throws again and this
case goes red (mutation-verified).
Fixes the Test (ubuntu-latest) failure on a89935fa.
This commit is contained in:
1 parent
a89935fa1e
commit
6851f531fc
1 file changed
+10
-8
@@ -733,7 +733,7 @@ describe('createDaemonWorkspaceService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('grantWorkspaceTrust refuses a reported deny when only workspace settings enable trust', async () => {
|
||||
it('grantWorkspaceTrust ignores workspace settings that try to enable trust', async () => {
|
||||
await withIsolatedWorkspace(async ({ home, workspace }) => {
|
||||
await writeJson(path.join(workspace, '.qwen', 'settings.json'), {
|
||||
security: { folderTrust: { enabled: true } },
|
||||
@@ -753,14 +753,16 @@ describe('createDaemonWorkspaceService', () => {
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(svc.grantWorkspaceTrust(makeCtx())).rejects.toThrow(
|
||||
WorkspaceTrustGrantIneffectiveError,
|
||||
// The workspace flag is stripped from the merged settings, so the
|
||||
// feature stays disabled and the grant reports the disabled state
|
||||
// instead of refusing an ineffective grant. If the restriction ever
|
||||
// regresses, the alias DO_NOT_TRUST wins again and the grant throws.
|
||||
await expect(svc.grantWorkspaceTrust(makeCtx())).resolves.toMatchObject(
|
||||
{
|
||||
folderTrustEnabled: false,
|
||||
effective: { source: 'disabled', state: 'trusted' },
|
||||
},
|
||||
);
|
||||
await expect(
|
||||
svc.getWorkspaceTrustStatus(makeCtx()),
|
||||
).resolves.toMatchObject({
|
||||
effective: { state: 'untrusted', source: 'file' },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user