@rigour-labs/core 6.4.2 → 6.4.3

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.
@@ -21,5 +21,9 @@ export interface CodePassConfig extends PassConfig {
21
21
  }
22
22
  export interface CodePassResult extends PassResult {
23
23
  contexts: CodeContext[];
24
+ /** Findings the model proposed, before the self-check (the max and cloud tiers). */
25
+ proposed: number;
26
+ /** Of those, withdrawn by the self-check. */
27
+ withdrawn: number;
24
28
  }
25
29
  export declare function runCodePass(provider: InferenceProvider, facts: FileFacts[], config: CodePassConfig): Promise<CodePassResult>;
@@ -11,7 +11,7 @@ import { buildReferencePack } from './reference-pack.js';
11
11
  import { selfCheck } from './self-check.js';
12
12
  import { Logger } from '../utils/logger.js';
13
13
  export async function runCodePass(provider, facts, config) {
14
- const result = { findings: [], chunksTotal: facts.length, chunksFailed: 0, contexts: [] };
14
+ const result = { findings: [], chunksTotal: facts.length, chunksFailed: 0, contexts: [], proposed: 0, withdrawn: 0 };
15
15
  for (let i = 0; i < facts.length; i++) {
16
16
  const file = facts[i];
17
17
  config.onProgress?.(` Reviewing ${file.path} (${i + 1}/${facts.length})...`);
@@ -32,7 +32,17 @@ export async function runCodePass(provider, facts, config) {
32
32
  context = { ...context, source: `${context.source}\n${pack.source}` };
33
33
  result.contexts.push(context);
34
34
  try {
35
- result.findings.push(...(pack ? await reviewTwiceAndCheck(provider, context, pack, config) : await reviewOnce(provider, context, '', config)));
35
+ if (pack) {
36
+ const checked = await reviewTwiceAndCheck(provider, context, pack, config);
37
+ result.findings.push(...checked.kept);
38
+ result.proposed += checked.proposed;
39
+ result.withdrawn += checked.withdrawn;
40
+ }
41
+ else {
42
+ const found = await reviewOnce(provider, context, '', config);
43
+ result.findings.push(...found);
44
+ result.proposed += found.length;
45
+ }
36
46
  }
37
47
  catch (error) {
38
48
  recordFailure(result, `${file.path}: ${error.message}`, config);
@@ -48,11 +58,11 @@ async function reviewTwiceAndCheck(provider, context, pack, config) {
48
58
  const second = pack.sections.length > 1 ? await reviewOnce(provider, context, [...pack.sections].reverse().join('\n\n'), config) : [];
49
59
  const union = dedupe([...first, ...second]);
50
60
  if (union.length === 0)
51
- return union;
61
+ return { kept: union, proposed: 0, withdrawn: 0 };
52
62
  const checked = await selfCheck(provider, context, pack.text, union, config.inference);
53
63
  if (checked.withdrawn > 0)
54
64
  config.onProgress?.(` Self-check withdrew ${checked.withdrawn} of ${union.length} finding(s) in ${context.file}.`);
55
- return checked.kept;
65
+ return { kept: checked.kept, proposed: union.length, withdrawn: checked.withdrawn };
56
66
  }
57
67
  function packFor(file, config) {
58
68
  const reference = config.reference;
@@ -39,6 +39,7 @@ describe('runCodePass', () => {
39
39
  const result = await run(provider);
40
40
  expect(prompts).toHaveLength(1);
41
41
  expect(result.findings.map(f => f.line)).toEqual([3]);
42
+ expect([result.proposed, result.withdrawn]).toEqual([1, 0]);
42
43
  });
43
44
  it('does not repeat an identical pass when there is only one reference section', async () => {
44
45
  const { provider, prompts } = fakeProvider([[]], []);
@@ -60,6 +61,7 @@ describe('runCodePass', () => {
60
61
  expect(reviews[1].indexOf('REMOVED by this change')).toBeLessThan(reviews[1].indexOf('PR DESCRIPTION'));
61
62
  expect(prompts.filter(p => p.startsWith('You reported a defect'))).toHaveLength(2);
62
63
  expect(result.findings.map(f => [f.line, f.category])).toEqual([[3, 'correctness']]);
64
+ expect([result.proposed, result.withdrawn]).toEqual([2, 1]); // two distinct findings, one withdrawn
63
65
  });
64
66
  it('reads a self-check reply only when it is a verdict', () => {
65
67
  expect(parseVerdict('{"real": false, "reason": "handled"}')).toBe(false);
@@ -31,6 +31,9 @@ export interface DeepRunOutcome {
31
31
  filesAnalyzed: number;
32
32
  chunksTotal: number;
33
33
  chunksFailed: number;
34
+ /** Code mode: findings the model proposed, and how many the self-check withdrew. */
35
+ findingsProposed?: number;
36
+ findingsWithdrawn?: number;
34
37
  /** Model actually used (the stock fallback is named as such). */
35
38
  model?: string;
36
39
  modelFallback?: boolean;
@@ -111,6 +111,8 @@ export class DeepAnalysisGate extends Gate {
111
111
  onProgress: this.config.onProgress,
112
112
  });
113
113
  this.recordPass(result);
114
+ this.outcome.findingsProposed = result.proposed;
115
+ this.outcome.findingsWithdrawn = result.withdrawn;
114
116
  return verifyCodeFindings(result.findings, result.contexts);
115
117
  }
116
118
  /** The max and cloud tiers read reference material and review twice; the small models do not. */
@@ -46,6 +46,8 @@ export async function runDeepAnalysis(config, context, deepOptions) {
46
46
  chunks_total: outcome.chunksTotal,
47
47
  chunks_failed: outcome.chunksFailed,
48
48
  error: outcome.error,
49
+ findings_proposed: outcome.findingsProposed,
50
+ findings_withdrawn: outcome.findingsWithdrawn,
49
51
  findings_count: findings.length,
50
52
  findings_verified: findings.filter(f => f.verified).length,
51
53
  };
@@ -3023,6 +3023,8 @@ export declare const ReportSchema: z.ZodObject<{
3023
3023
  chunks_total: z.ZodOptional<z.ZodNumber>;
3024
3024
  chunks_failed: z.ZodOptional<z.ZodNumber>;
3025
3025
  error: z.ZodOptional<z.ZodString>;
3026
+ findings_proposed: z.ZodOptional<z.ZodNumber>;
3027
+ findings_withdrawn: z.ZodOptional<z.ZodNumber>;
3026
3028
  findings_count: z.ZodOptional<z.ZodNumber>;
3027
3029
  findings_verified: z.ZodOptional<z.ZodNumber>;
3028
3030
  }, "strip", z.ZodTypeAny, {
@@ -3037,6 +3039,8 @@ export declare const ReportSchema: z.ZodObject<{
3037
3039
  files_analyzed?: number | undefined;
3038
3040
  chunks_total?: number | undefined;
3039
3041
  chunks_failed?: number | undefined;
3042
+ findings_proposed?: number | undefined;
3043
+ findings_withdrawn?: number | undefined;
3040
3044
  findings_count?: number | undefined;
3041
3045
  findings_verified?: number | undefined;
3042
3046
  }, {
@@ -3051,6 +3055,8 @@ export declare const ReportSchema: z.ZodObject<{
3051
3055
  files_analyzed?: number | undefined;
3052
3056
  chunks_total?: number | undefined;
3053
3057
  chunks_failed?: number | undefined;
3058
+ findings_proposed?: number | undefined;
3059
+ findings_withdrawn?: number | undefined;
3054
3060
  findings_count?: number | undefined;
3055
3061
  findings_verified?: number | undefined;
3056
3062
  }>>;
@@ -3068,6 +3074,8 @@ export declare const ReportSchema: z.ZodObject<{
3068
3074
  files_analyzed?: number | undefined;
3069
3075
  chunks_total?: number | undefined;
3070
3076
  chunks_failed?: number | undefined;
3077
+ findings_proposed?: number | undefined;
3078
+ findings_withdrawn?: number | undefined;
3071
3079
  findings_count?: number | undefined;
3072
3080
  findings_verified?: number | undefined;
3073
3081
  } | undefined;
@@ -3097,6 +3105,8 @@ export declare const ReportSchema: z.ZodObject<{
3097
3105
  files_analyzed?: number | undefined;
3098
3106
  chunks_total?: number | undefined;
3099
3107
  chunks_failed?: number | undefined;
3108
+ findings_proposed?: number | undefined;
3109
+ findings_withdrawn?: number | undefined;
3100
3110
  findings_count?: number | undefined;
3101
3111
  findings_verified?: number | undefined;
3102
3112
  } | undefined;
@@ -3128,6 +3138,8 @@ export declare const ReportSchema: z.ZodObject<{
3128
3138
  files_analyzed?: number | undefined;
3129
3139
  chunks_total?: number | undefined;
3130
3140
  chunks_failed?: number | undefined;
3141
+ findings_proposed?: number | undefined;
3142
+ findings_withdrawn?: number | undefined;
3131
3143
  findings_count?: number | undefined;
3132
3144
  findings_verified?: number | undefined;
3133
3145
  } | undefined;
@@ -3176,6 +3188,8 @@ export declare const ReportSchema: z.ZodObject<{
3176
3188
  files_analyzed?: number | undefined;
3177
3189
  chunks_total?: number | undefined;
3178
3190
  chunks_failed?: number | undefined;
3191
+ findings_proposed?: number | undefined;
3192
+ findings_withdrawn?: number | undefined;
3179
3193
  findings_count?: number | undefined;
3180
3194
  findings_verified?: number | undefined;
3181
3195
  } | undefined;
@@ -422,6 +422,8 @@ export const ReportSchema = z.object({
422
422
  chunks_total: z.number().optional(),
423
423
  chunks_failed: z.number().optional(),
424
424
  error: z.string().optional(),
425
+ findings_proposed: z.number().optional(), // code mode, before the self-check
426
+ findings_withdrawn: z.number().optional(), // by the self-check
425
427
  findings_count: z.number().optional(),
426
428
  findings_verified: z.number().optional(),
427
429
  }).optional(),
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "description": "AI-native quality gate engine with local Bayesian learning. AST analysis, drift detection, Fix Packet generation, and agent self-healing across TypeScript, JavaScript, Python, Go, Ruby, and C#.",
5
+ "engines": {
6
+ "node": ">=22"
7
+ },
5
8
  "license": "MIT",
6
9
  "homepage": "https://rigour.run",
7
10
  "keywords": [
@@ -67,11 +70,11 @@
67
70
  "pg": "^8.16.3",
68
71
  "sqlite3": "^5.1.7",
69
72
  "openai": "^4.104.0",
70
- "@rigour-labs/brain-darwin-arm64": "6.4.2",
71
- "@rigour-labs/brain-darwin-x64": "6.4.2",
72
- "@rigour-labs/brain-linux-arm64": "6.4.2",
73
- "@rigour-labs/brain-win-x64": "6.4.2",
74
- "@rigour-labs/brain-linux-x64": "6.4.2"
73
+ "@rigour-labs/brain-darwin-x64": "6.4.3",
74
+ "@rigour-labs/brain-darwin-arm64": "6.4.3",
75
+ "@rigour-labs/brain-linux-arm64": "6.4.3",
76
+ "@rigour-labs/brain-linux-x64": "6.4.3",
77
+ "@rigour-labs/brain-win-x64": "6.4.3"
75
78
  },
76
79
  "devDependencies": {
77
80
  "@types/fs-extra": "^11.0.4",