дȫÏîĿÉó²éÎÊÌⲢ·¢²¼ v1.1.9
¸ÄÓñ¾»ú¶ÀÁ¢ CA£¬»ָ´ CLI TLS УÑ飬±£»¤ƾ¾ÝÓëÅäÖò¢·¢±£´档 д Cursor Êý¾ݡ¢»Ự·¾¶¡¢´úÀíÉúÃüÖÜÆڡ¢ģÐÍÇëÇóÓë Skills Îļþ²Ù×÷¡£ Ϊ¶ÀÁ¢ Tab ·þÎñÔö¼ӿͻ§¶˼øȨ£¬Éý¼¶ÒÀÀµÓ빤¾ßÁ´£¬ÍêÉƷ¢²¼ԪÐÅϢͬ²½¡£ Ñé֤£ºÁ½¸ö Go ģ¿éµIJâÊÔ/vet¡¢¹ؼüģ¿é race¡¢ǰ¶˲âÊÔ/Éú²ú¹¹½¨/Éó¼ơ¢ Go ¿ɴï©¶´ɨÃèÓë macOS/Linux ¿ÉÐÐģ¿齻²æ±àÒë¾ùͨ¹ý¡£ Windows ¸ôÀëÆô¶¯ͨ¹ý£»δÍê³ɵĵã»÷ðÑ̺ÍԭÉúƽ̨Ñé֤¼ûÉó²鱨¸档
This commit is contained in:
26
frontend/test/configSafety.test.js
Normal file
26
frontend/test/configSafety.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {safePreferences, apiLogEntry, editorConflict} from '../src/utils/configSafety.js';
|
||||
|
||||
test('cached preferences never include model, headers, token or error bodies', () => {
|
||||
const marker = 'SENTINEL_PRIVATE_CREDENTIAL';
|
||||
const input = {revision:'revision', modelAdapters:[{apiKey:marker,customHeadersJSON:JSON.stringify({Authorization:marker}),openAIExtraParamsJSON:marker}],tabServerToken:marker,serviceLastError:marker,homeMetrics:{refreshIntervalSeconds:30,persistentMode:false,secret:marker}};
|
||||
const safe = safePreferences(input);
|
||||
assert.equal(JSON.stringify(safe).includes(marker),false);
|
||||
assert.deepEqual(safe,{homeMetrics:{includeCacheWriteInHitRate:false,persistentMode:false,refreshIntervalSeconds:30}});
|
||||
assert.deepEqual(safePreferences(safe),safe);
|
||||
});
|
||||
|
||||
test('API log records are metadata only for both success and error', () => {
|
||||
assert.deepEqual(apiLogEntry('SaveUserConfig'),{operation:'SaveUserConfig',status:'completed'});
|
||||
assert.deepEqual(apiLogEntry('SaveUserConfig',true),{operation:'SaveUserConfig',status:'failed'});
|
||||
});
|
||||
|
||||
test('editor rejects stale revision, deleted target and changed identity', () => {
|
||||
const current={revision:'new',modelAdapters:[{id:'a'},{id:'b'}]};
|
||||
assert.equal(editorConflict(current,'old',0,'a'),true);
|
||||
assert.equal(editorConflict(current,'new',2,'b'),true);
|
||||
assert.equal(editorConflict(current,'new',0,'b'),true);
|
||||
assert.equal(editorConflict(current,'new',1,'b'),false);
|
||||
assert.equal(editorConflict(current,'new',-1,''),false);
|
||||
});
|
||||
Reference in New Issue
Block a user