@bryan-thompson/inspector-assessment-cli 1.29.0 → 1.29.1
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.
|
@@ -12,6 +12,7 @@ jest.unstable_mockModule("../../profiles.js", () => ({
|
|
|
12
12
|
}));
|
|
13
13
|
jest.unstable_mockModule("../../../../client/lib/lib/assessmentTypes.js", () => ({
|
|
14
14
|
DEFAULT_ASSESSMENT_CONFIG: {
|
|
15
|
+
configVersion: 2,
|
|
15
16
|
enableExtendedAssessment: false,
|
|
16
17
|
parallelTesting: false,
|
|
17
18
|
testTimeout: 10000,
|
|
@@ -286,4 +287,52 @@ describe("buildConfig", () => {
|
|
|
286
287
|
expect(result.logging?.level).toBe("error");
|
|
287
288
|
});
|
|
288
289
|
});
|
|
290
|
+
describe("config version validation (Issue #107)", () => {
|
|
291
|
+
let consoleWarnSpy;
|
|
292
|
+
beforeEach(() => {
|
|
293
|
+
consoleWarnSpy = jest
|
|
294
|
+
.spyOn(console, "warn")
|
|
295
|
+
.mockImplementation(() => { });
|
|
296
|
+
});
|
|
297
|
+
afterEach(() => {
|
|
298
|
+
consoleWarnSpy.mockRestore();
|
|
299
|
+
});
|
|
300
|
+
it("should not warn when configVersion is present in defaults", () => {
|
|
301
|
+
// DEFAULT_ASSESSMENT_CONFIG mock includes configVersion: 2
|
|
302
|
+
buildConfig({ serverName: "test" });
|
|
303
|
+
// Should NOT warn because configVersion is set
|
|
304
|
+
expect(consoleWarnSpy).not.toHaveBeenCalledWith(expect.stringContaining("Config missing configVersion"));
|
|
305
|
+
});
|
|
306
|
+
it("should still build config successfully with configVersion", () => {
|
|
307
|
+
const result = buildConfig({ serverName: "test" });
|
|
308
|
+
expect(result).toBeDefined();
|
|
309
|
+
expect(result.configVersion).toBe(2);
|
|
310
|
+
expect(result.testTimeout).toBeDefined();
|
|
311
|
+
expect(result.logging).toBeDefined();
|
|
312
|
+
});
|
|
313
|
+
it("should include configVersion in final config", () => {
|
|
314
|
+
const result = buildConfig({ serverName: "test" });
|
|
315
|
+
expect(result.configVersion).toBe(2);
|
|
316
|
+
});
|
|
317
|
+
it("should preserve configVersion through profile-based config", () => {
|
|
318
|
+
modulesToLegacyConfig.mockReturnValue({
|
|
319
|
+
functionality: true,
|
|
320
|
+
security: true,
|
|
321
|
+
});
|
|
322
|
+
const result = buildConfig({ serverName: "test", profile: "quick" });
|
|
323
|
+
expect(result.configVersion).toBe(2);
|
|
324
|
+
});
|
|
325
|
+
it("should preserve configVersion through module filtering", () => {
|
|
326
|
+
getAllModulesConfig.mockReturnValue({
|
|
327
|
+
functionality: true,
|
|
328
|
+
security: true,
|
|
329
|
+
});
|
|
330
|
+
resolveModuleNames.mockReturnValue(["functionality"]);
|
|
331
|
+
const result = buildConfig({
|
|
332
|
+
serverName: "test",
|
|
333
|
+
onlyModules: ["functionality"],
|
|
334
|
+
});
|
|
335
|
+
expect(result.configVersion).toBe(2);
|
|
336
|
+
});
|
|
337
|
+
});
|
|
289
338
|
});
|
|
@@ -33,6 +33,10 @@ describe("JSONL Event Emission", () => {
|
|
|
33
33
|
emitJSONL({ event: "test" });
|
|
34
34
|
expect(emittedEvents[0]).toHaveProperty("version");
|
|
35
35
|
});
|
|
36
|
+
it("should include schemaVersion field", () => {
|
|
37
|
+
emitJSONL({ event: "test" });
|
|
38
|
+
expect(emittedEvents[0]).toHaveProperty("schemaVersion", 1);
|
|
39
|
+
});
|
|
36
40
|
it("should handle complex nested objects", () => {
|
|
37
41
|
emitJSONL({
|
|
38
42
|
event: "complex",
|
|
@@ -123,5 +123,12 @@ export function buildConfig(options) {
|
|
|
123
123
|
const envLogLevel = process.env.LOG_LEVEL;
|
|
124
124
|
const logLevel = options.logLevel ?? envLogLevel ?? "info";
|
|
125
125
|
config.logging = { level: logLevel };
|
|
126
|
+
// Config version validation (Issue #107)
|
|
127
|
+
// Warn if config is missing version field - will be required in v2.0.0
|
|
128
|
+
if (!config.configVersion) {
|
|
129
|
+
console.warn("⚠️ Config missing configVersion field. " +
|
|
130
|
+
"This will be required in v2.0.0. " +
|
|
131
|
+
"See docs/DEPRECATION_GUIDE.md for migration info.");
|
|
132
|
+
}
|
|
126
133
|
return config;
|
|
127
134
|
}
|
|
@@ -7,16 +7,22 @@
|
|
|
7
7
|
* This is a CLI-local version that imports from the built client lib
|
|
8
8
|
* to avoid rootDir conflicts in TypeScript compilation.
|
|
9
9
|
*/
|
|
10
|
-
import { INSPECTOR_VERSION } from "../../../client/lib/lib/moduleScoring.js";
|
|
10
|
+
import { INSPECTOR_VERSION, SCHEMA_VERSION, } from "../../../client/lib/lib/moduleScoring.js";
|
|
11
|
+
// Re-export for consumers of this module
|
|
12
|
+
export { SCHEMA_VERSION };
|
|
11
13
|
// ============================================================================
|
|
12
14
|
// Core Functions
|
|
13
15
|
// ============================================================================
|
|
14
16
|
/**
|
|
15
17
|
* Emit a JSONL event to stderr for real-time machine parsing.
|
|
16
|
-
* Automatically includes version
|
|
18
|
+
* Automatically includes version and schemaVersion fields for compatibility checking.
|
|
17
19
|
*/
|
|
18
20
|
export function emitJSONL(event) {
|
|
19
|
-
console.error(JSON.stringify({
|
|
21
|
+
console.error(JSON.stringify({
|
|
22
|
+
...event,
|
|
23
|
+
version: INSPECTOR_VERSION,
|
|
24
|
+
schemaVersion: SCHEMA_VERSION,
|
|
25
|
+
}));
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Emit server_connected event after successful connection.
|
package/package.json
CHANGED