audit-tools 0.55.15 → 0.55.16
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/dist/audit/cli/auditStep.d.ts.map +1 -1
- package/dist/audit/cli/auditStep.js +4 -3
- package/dist/audit/cli/auditStep.js.map +1 -1
- package/dist/audit/cli/charterComparisonPrompt.d.ts.map +1 -1
- package/dist/audit/cli/charterComparisonPrompt.js +8 -1
- package/dist/audit/cli/charterComparisonPrompt.js.map +1 -1
- package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
- package/dist/audit/cli/conceptualDispatch.js +9 -5
- package/dist/audit/cli/conceptualDispatch.js.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.d.ts +65 -1
- package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.js +329 -126
- package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
- package/dist/audit/cli/fanoutLanes.d.ts +1 -1
- package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
- package/dist/audit/cli/fanoutLanes.js +4 -2
- package/dist/audit/cli/fanoutLanes.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +17 -15
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +4 -3
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/prompts.d.ts +2 -0
- package/dist/audit/cli/prompts.d.ts.map +1 -1
- package/dist/audit/cli/prompts.js +12 -1
- package/dist/audit/cli/prompts.js.map +1 -1
- package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.js +71 -6
- package/dist/audit/cli/semanticReviewStep.js.map +1 -1
- package/dist/audit/cli/validateResultsCommand.d.ts +11 -0
- package/dist/audit/cli/validateResultsCommand.d.ts.map +1 -1
- package/dist/audit/cli/validateResultsCommand.js +56 -4
- package/dist/audit/cli/validateResultsCommand.js.map +1 -1
- package/dist/audit/decompose/buildStructureDecomposition.d.ts +11 -5
- package/dist/audit/decompose/buildStructureDecomposition.d.ts.map +1 -1
- package/dist/audit/decompose/buildStructureDecomposition.js +17 -8
- package/dist/audit/decompose/buildStructureDecomposition.js.map +1 -1
- package/dist/audit/extractors/designAssessment.d.ts.map +1 -1
- package/dist/audit/extractors/designAssessment.js.map +1 -1
- package/dist/audit/extractors/graph.d.ts +1 -1
- package/dist/audit/extractors/graph.js +1 -1
- package/dist/audit/extractors/graphSignals.d.ts +8 -0
- package/dist/audit/extractors/graphSignals.d.ts.map +1 -1
- package/dist/audit/extractors/graphSignals.js +12 -1
- package/dist/audit/extractors/graphSignals.js.map +1 -1
- package/dist/audit/io/runArtifacts.d.ts +6 -0
- package/dist/audit/io/runArtifacts.d.ts.map +1 -1
- package/dist/audit/io/runArtifacts.js +9 -0
- package/dist/audit/io/runArtifacts.js.map +1 -1
- package/dist/audit/orchestrator/advance.d.ts.map +1 -1
- package/dist/audit/orchestrator/advance.js +3 -0
- package/dist/audit/orchestrator/advance.js.map +1 -1
- package/dist/audit/orchestrator/architectureDiscovery.d.ts +9 -0
- package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -1
- package/dist/audit/orchestrator/architectureDiscovery.js +11 -1
- package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -1
- package/dist/audit/orchestrator/charterPackets.d.ts +36 -7
- package/dist/audit/orchestrator/charterPackets.d.ts.map +1 -1
- package/dist/audit/orchestrator/charterPackets.js +88 -21
- package/dist/audit/orchestrator/charterPackets.js.map +1 -1
- package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
- package/dist/audit/orchestrator/dependencyMap.js +16 -13
- package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
- package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
- package/dist/audit/orchestrator/dependencySlices.js +26 -11
- package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.js +38 -6
- package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.js +3 -2
- package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
- package/dist/audit/orchestrator/state.js +1 -1
- package/dist/audit/orchestrator/state.js.map +1 -1
- package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts +9 -0
- package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/systemicChallengeExecutor.js +12 -2
- package/dist/audit/orchestrator/systemicChallengeExecutor.js.map +1 -1
- package/dist/audit/systemic/reviewFileMap.d.ts +92 -45
- package/dist/audit/systemic/reviewFileMap.d.ts.map +1 -1
- package/dist/audit/systemic/reviewFileMap.js +171 -94
- package/dist/audit/systemic/reviewFileMap.js.map +1 -1
- package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts +15 -6
- package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
- package/dist/audit/systemic/secondOrderAdversaryPrompt.js +119 -36
- package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
- package/dist/audit/types/designAssessment.d.ts +11 -0
- package/dist/audit/types/designAssessment.d.ts.map +1 -1
- package/dist/audit/types/designAssessment.js +23 -1
- package/dist/audit/types/designAssessment.js.map +1 -1
- package/dist/shared/decompose/charterExtraction.d.ts +117 -17
- package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
- package/dist/shared/decompose/charterExtraction.js +27 -3
- package/dist/shared/decompose/charterExtraction.js.map +1 -1
- package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
- package/dist/shared/decompose/systemicChallenge.js +4 -1
- package/dist/shared/decompose/systemicChallenge.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,43 +13,64 @@
|
|
|
13
13
|
* So the map is derived ONCE, by the tool, from artifacts the round did not
|
|
14
14
|
* produce either (the repository manifest and the dependency graph the audit
|
|
15
15
|
* pipeline already extracted), and handed over labelled as prior verified recon.
|
|
16
|
-
* It is a lane ASSET, not a submission: the
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* only thing it hands over is its own findings. Updates
|
|
16
|
+
* It is a lane ASSET, not a submission: each slice reaches the round as a
|
|
17
|
+
* READ-ONLY context file the lane materializer writes and binds into the lane's
|
|
18
|
+
* review binding, so acceptance re-hashes it and refuses a submission made
|
|
19
|
+
* against an edited copy; the prompt carries only the index and the provenance
|
|
20
|
+
* (`reviewFileMapContext`). No file is on a path any lane's write scope covers,
|
|
21
|
+
* and no submission schema has a field for it — a round has no route by which to
|
|
22
|
+
* write back, because the only thing it hands over is its own findings. Updates
|
|
24
23
|
* go through a separate recon pass (the graph builder), which is the only thing
|
|
25
24
|
* that can change what the next round receives. Otherwise the map quietly
|
|
26
25
|
* absorbs one reviewer's assumption and reaches the next reviewer as fact.
|
|
27
26
|
*
|
|
28
|
-
* The map is SCOPED to what the reading round
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* the
|
|
27
|
+
* The map is SCOPED to what the reading round judges — which only the consumer
|
|
28
|
+
* knows: every file in that scope gets an anchor carrying its COMPLETE caller and
|
|
29
|
+
* callee lists, and nothing outside it is anchored. There is no cap. An earlier
|
|
30
|
+
* version anchored the path-sorted FIRST 60 authored files and listed at most 25
|
|
31
|
+
* call sites each — neither number measured. Whatever the map leaves out
|
|
32
|
+
* (in-scope files with no edge, files outside the scope, graph buckets that are
|
|
33
|
+
* not call sites) is STATED: a silently thin map reads as a complete one.
|
|
34
|
+
*
|
|
35
|
+
* It is SLICED by unit, not capped. The uncapped map was one file — 480 KB and
|
|
36
|
+
* 2,563 lines for the six starting-point units of the 0.55.15 dogfood run — and
|
|
37
|
+
* every lane told to read it whole fell back to grep. The prompt now carries a
|
|
38
|
+
* compact index (one row per unit: its counts and its slice file) and each unit's
|
|
39
|
+
* anchors live in their own slice, so a lane reads exactly the slices of the
|
|
40
|
+
* units it judges, each whole. Only call-site buckets feed it
|
|
41
|
+
* (`isDependencyEdgeBucket`): a co-changed file is not a caller.
|
|
38
42
|
*
|
|
39
43
|
* Deterministic and content-derived: every array is ordered by a stable key, so
|
|
40
|
-
*
|
|
44
|
+
* no file churns between emissions of an unchanged round.
|
|
41
45
|
*/
|
|
42
46
|
import type { ArtifactBundle } from "../io/artifacts.js";
|
|
47
|
+
/** A unit as the map slices by it: an id and the files it owns. */
|
|
48
|
+
export interface ReviewFileMapUnit {
|
|
49
|
+
unit_id: string;
|
|
50
|
+
files: readonly string[];
|
|
51
|
+
}
|
|
43
52
|
/**
|
|
44
|
-
* The files a reading round
|
|
45
|
-
* consumer derives it from what its own prompt names
|
|
46
|
-
*
|
|
53
|
+
* The files a reading round judges — the set the map anchors, completely. The
|
|
54
|
+
* consumer derives it from what its own prompt names (it is the only party that
|
|
55
|
+
* knows), so the map and the prompt cannot disagree about it.
|
|
47
56
|
*/
|
|
48
57
|
export interface ReviewFileMapScope {
|
|
49
58
|
/** Repo-relative paths under review. Deduplicated and path-sorted by the map. */
|
|
50
59
|
files: readonly string[];
|
|
51
60
|
/** One clause naming what this scope is, stated to the reading lane. */
|
|
52
61
|
basis: string;
|
|
62
|
+
/**
|
|
63
|
+
* The units the index lists and the slices follow, in the order the consumer
|
|
64
|
+
* names them. A file belongs to the FIRST unit that lists it; a file no unit
|
|
65
|
+
* lists lands in the `unassigned` slice. Omitted: the run's unit manifest.
|
|
66
|
+
*/
|
|
67
|
+
units?: readonly ReviewFileMapUnit[];
|
|
68
|
+
/**
|
|
69
|
+
* Per-file notes rendered under the file's anchor (the systemic round's
|
|
70
|
+
* deterministic leads). A noted file is anchored even when the graph records
|
|
71
|
+
* no edge for it — the note is the reason it is under review.
|
|
72
|
+
*/
|
|
73
|
+
notes?: ReadonlyMap<string, readonly string[]>;
|
|
53
74
|
}
|
|
54
75
|
export interface ReviewFileMapAnchor {
|
|
55
76
|
/** The repo-relative file the call sites below target. */
|
|
@@ -58,16 +79,29 @@ export interface ReviewFileMapAnchor {
|
|
|
58
79
|
callers: string[];
|
|
59
80
|
/** Every file it references, path-sorted. */
|
|
60
81
|
callees: string[];
|
|
82
|
+
/** The scope's notes for this file, in the order given. */
|
|
83
|
+
notes: string[];
|
|
84
|
+
}
|
|
85
|
+
/** One unit's share of the map: the files under review it owns and the slice file holding them. */
|
|
86
|
+
export interface ReviewFileMapSlice {
|
|
87
|
+
/** The owning unit, or `null` for in-scope files no unit lists. */
|
|
88
|
+
unit_id: string | null;
|
|
89
|
+
/** The slice file's name. Unique within one map. */
|
|
90
|
+
filename: string;
|
|
91
|
+
/** This unit's files under review, path-sorted. */
|
|
92
|
+
files: string[];
|
|
61
93
|
}
|
|
62
94
|
export interface ReviewFileMap {
|
|
63
95
|
/** What produced this map — the provenance the reading lane is told to trust. */
|
|
64
96
|
provenance: {
|
|
65
97
|
/** `tool` — the map is machine-derived, never authored by a reviewer. */
|
|
66
98
|
author: "tool";
|
|
67
|
-
/** The
|
|
99
|
+
/** The call-site buckets the edges were read from. */
|
|
68
100
|
sources: string[];
|
|
69
101
|
/** Edges consulted, so a thin map is visibly thin rather than silently so. */
|
|
70
102
|
edge_count: number;
|
|
103
|
+
/** Graph buckets present but not read, because they are not call sites. */
|
|
104
|
+
omitted_sources: string[];
|
|
71
105
|
/** Whether an edge category was present at all in the graph. */
|
|
72
106
|
graph_present: boolean;
|
|
73
107
|
};
|
|
@@ -77,21 +111,28 @@ export interface ReviewFileMap {
|
|
|
77
111
|
/** Files under review: each is anchored or counted in `files_without_edges`. */
|
|
78
112
|
file_count: number;
|
|
79
113
|
/**
|
|
80
|
-
* Authored (manifest) files outside the scope, so not anchored. Stated
|
|
81
|
-
*
|
|
114
|
+
* Authored (manifest) files outside the scope, so not anchored. Stated: an
|
|
115
|
+
* unanchored file is outside this map, not unconnected.
|
|
82
116
|
*/
|
|
83
117
|
outside_scope: number;
|
|
84
118
|
};
|
|
85
|
-
/** One anchor per in-scope file the graph connects, path-sorted. */
|
|
119
|
+
/** One anchor per in-scope file the graph connects or the scope notes, path-sorted. */
|
|
86
120
|
anchors: ReviewFileMapAnchor[];
|
|
87
121
|
/**
|
|
88
|
-
* In-scope files the graph records NO edge for
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* whose absence a round must not read as "nothing depends on it".
|
|
122
|
+
* In-scope files the graph records NO edge for. Always stated: these are
|
|
123
|
+
* exactly the files whose absence a round must not read as "nothing depends
|
|
124
|
+
* on it".
|
|
92
125
|
*/
|
|
93
126
|
files_without_edges: number;
|
|
127
|
+
/** One entry per listed unit, in scope order, then `unassigned` when any file is. */
|
|
128
|
+
slices: ReviewFileMapSlice[];
|
|
94
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Which unit owns each file: the FIRST unit, in the order given, that lists it.
|
|
132
|
+
* The one ownership rule the map's slices and any per-unit count a consumer
|
|
133
|
+
* renders beside them both read, so a file two units list is counted once.
|
|
134
|
+
*/
|
|
135
|
+
export declare function unitOwnership(units: readonly ReviewFileMapUnit[]): Map<string, string>;
|
|
95
136
|
/**
|
|
96
137
|
* Build the map from the dependency graph the audit already extracted. Edges are
|
|
97
138
|
* read in both directions per anchor — callers and callees — because the review
|
|
@@ -102,31 +143,37 @@ export interface ReviewFileMap {
|
|
|
102
143
|
*/
|
|
103
144
|
export declare function buildReviewFileMap(bundle: ArtifactBundle, scope: ReviewFileMapScope): ReviewFileMap;
|
|
104
145
|
/**
|
|
105
|
-
* Render
|
|
106
|
-
*
|
|
107
|
-
*
|
|
146
|
+
* Render one slice: a short provenance header, then every anchor of the unit with
|
|
147
|
+
* its complete caller and callee lists and its notes. Returned as text rather
|
|
148
|
+
* than JSON so a lane reads it as data-that-was-handed-over.
|
|
108
149
|
*/
|
|
109
|
-
export declare function
|
|
150
|
+
export declare function renderReviewFileMapSlice(map: ReviewFileMap, slice: ReviewFileMapSlice): string[];
|
|
110
151
|
/** A file the tool generates for a lane — the shape a lane spec's `generatedContext` carries. */
|
|
111
152
|
export interface ReviewFileMapContextFile {
|
|
112
153
|
filename: string;
|
|
113
154
|
label: string;
|
|
114
155
|
text: string;
|
|
115
156
|
}
|
|
116
|
-
/** One build of the map, split into what the prompt carries and what the
|
|
157
|
+
/** One build of the map, split into what the prompt carries and what the files carry. */
|
|
117
158
|
export interface ReviewFileMapContext {
|
|
118
|
-
/** The prompt's share: provenance, the read-only rule, scope
|
|
159
|
+
/** The prompt's share: provenance, the read-only rule, scope, counts, and the unit index. */
|
|
119
160
|
summaryLines: string[];
|
|
120
|
-
/**
|
|
121
|
-
|
|
161
|
+
/** One read-only slice per unit with an anchor, bound into the lane's review. */
|
|
162
|
+
contextFiles: ReviewFileMapContextFile[];
|
|
163
|
+
}
|
|
164
|
+
/** An extra column of the unit index, filled per unit by the consumer. */
|
|
165
|
+
export interface ReviewFileMapIndexColumn {
|
|
166
|
+
header: string;
|
|
167
|
+
cell: (unitId: string | null) => string;
|
|
122
168
|
}
|
|
123
169
|
/**
|
|
124
|
-
* Split one map into the prompt
|
|
125
|
-
* two cannot come from different builds. The
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* materializer lists under its "Read-only context files" section.
|
|
170
|
+
* Split one map into the prompt's index and the read-only slice files, so the
|
|
171
|
+
* two cannot come from different builds. The index states the provenance, the
|
|
172
|
+
* read-only rule, every count, the omitted buckets, and one row per unit naming
|
|
173
|
+
* its slice — the lane materializer lists each slice's full path under its
|
|
174
|
+
* "Read-only context files" section.
|
|
130
175
|
*/
|
|
131
|
-
export declare function reviewFileMapContext(map: ReviewFileMap
|
|
176
|
+
export declare function reviewFileMapContext(map: ReviewFileMap, options?: {
|
|
177
|
+
columns?: readonly ReviewFileMapIndexColumn[];
|
|
178
|
+
}): ReviewFileMapContext;
|
|
132
179
|
//# sourceMappingURL=reviewFileMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewFileMap.d.ts","sourceRoot":"","sources":["../../../src/audit/systemic/reviewFileMap.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"reviewFileMap.d.ts","sourceRoot":"","sources":["../../../src/audit/systemic/reviewFileMap.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// sites-pinned: tests/audit/systemic-challenge.test.ts, tests/audit/review-file-map-context.test.ts
|
|
1
|
+
// sites-pinned: tests/audit/systemic-challenge.test.ts, tests/audit/review-file-map-context.test.ts, tests/audit/review-evidence-right-sizing.test.ts
|
|
2
2
|
/**
|
|
3
3
|
* The VERIFIED CALL-SITE MAP a design-review round receives as a read-only,
|
|
4
4
|
* provenanced input.
|
|
@@ -14,33 +14,69 @@
|
|
|
14
14
|
* So the map is derived ONCE, by the tool, from artifacts the round did not
|
|
15
15
|
* produce either (the repository manifest and the dependency graph the audit
|
|
16
16
|
* pipeline already extracted), and handed over labelled as prior verified recon.
|
|
17
|
-
* It is a lane ASSET, not a submission: the
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* only thing it hands over is its own findings. Updates
|
|
17
|
+
* It is a lane ASSET, not a submission: each slice reaches the round as a
|
|
18
|
+
* READ-ONLY context file the lane materializer writes and binds into the lane's
|
|
19
|
+
* review binding, so acceptance re-hashes it and refuses a submission made
|
|
20
|
+
* against an edited copy; the prompt carries only the index and the provenance
|
|
21
|
+
* (`reviewFileMapContext`). No file is on a path any lane's write scope covers,
|
|
22
|
+
* and no submission schema has a field for it — a round has no route by which to
|
|
23
|
+
* write back, because the only thing it hands over is its own findings. Updates
|
|
25
24
|
* go through a separate recon pass (the graph builder), which is the only thing
|
|
26
25
|
* that can change what the next round receives. Otherwise the map quietly
|
|
27
26
|
* absorbs one reviewer's assumption and reaches the next reviewer as fact.
|
|
28
27
|
*
|
|
29
|
-
* The map is SCOPED to what the reading round
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* the
|
|
28
|
+
* The map is SCOPED to what the reading round judges — which only the consumer
|
|
29
|
+
* knows: every file in that scope gets an anchor carrying its COMPLETE caller and
|
|
30
|
+
* callee lists, and nothing outside it is anchored. There is no cap. An earlier
|
|
31
|
+
* version anchored the path-sorted FIRST 60 authored files and listed at most 25
|
|
32
|
+
* call sites each — neither number measured. Whatever the map leaves out
|
|
33
|
+
* (in-scope files with no edge, files outside the scope, graph buckets that are
|
|
34
|
+
* not call sites) is STATED: a silently thin map reads as a complete one.
|
|
35
|
+
*
|
|
36
|
+
* It is SLICED by unit, not capped. The uncapped map was one file — 480 KB and
|
|
37
|
+
* 2,563 lines for the six starting-point units of the 0.55.15 dogfood run — and
|
|
38
|
+
* every lane told to read it whole fell back to grep. The prompt now carries a
|
|
39
|
+
* compact index (one row per unit: its counts and its slice file) and each unit's
|
|
40
|
+
* anchors live in their own slice, so a lane reads exactly the slices of the
|
|
41
|
+
* units it judges, each whole. Only call-site buckets feed it
|
|
42
|
+
* (`isDependencyEdgeBucket`): a co-changed file is not a caller.
|
|
39
43
|
*
|
|
40
44
|
* Deterministic and content-derived: every array is ordered by a stable key, so
|
|
41
|
-
*
|
|
45
|
+
* no file churns between emissions of an unchanged round.
|
|
42
46
|
*/
|
|
43
47
|
import { compareCodeUnits } from "audit-tools/shared";
|
|
48
|
+
import { isDependencyEdgeBucket } from "../extractors/graphSignals.js";
|
|
49
|
+
const REVIEW_FILE_MAP_PREFIX = "review-call-site-map";
|
|
50
|
+
/**
|
|
51
|
+
* A slice file name unique within one map. Uniqueness is checked on the
|
|
52
|
+
* CASE-FOLDED name: unit ids `Unit` and `unit` would otherwise name two files
|
|
53
|
+
* that are one file on a case-insensitive filesystem (win32, default darwin),
|
|
54
|
+
* and one slice would overwrite the other.
|
|
55
|
+
*/
|
|
56
|
+
function sliceFilename(unitId, used) {
|
|
57
|
+
const slug = (unitId ?? "unassigned").replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unit";
|
|
58
|
+
let name = `${REVIEW_FILE_MAP_PREFIX}.${slug}.md`;
|
|
59
|
+
for (let suffix = 2; used.has(name.toLowerCase()); suffix += 1) {
|
|
60
|
+
name = `${REVIEW_FILE_MAP_PREFIX}.${slug}-${suffix}.md`;
|
|
61
|
+
}
|
|
62
|
+
used.add(name.toLowerCase());
|
|
63
|
+
return name;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Which unit owns each file: the FIRST unit, in the order given, that lists it.
|
|
67
|
+
* The one ownership rule the map's slices and any per-unit count a consumer
|
|
68
|
+
* renders beside them both read, so a file two units list is counted once.
|
|
69
|
+
*/
|
|
70
|
+
export function unitOwnership(units) {
|
|
71
|
+
const owner = new Map();
|
|
72
|
+
for (const unit of units) {
|
|
73
|
+
for (const file of unit.files) {
|
|
74
|
+
if (!owner.has(file))
|
|
75
|
+
owner.set(file, unit.unit_id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return owner;
|
|
79
|
+
}
|
|
44
80
|
/**
|
|
45
81
|
* Build the map from the dependency graph the audit already extracted. Edges are
|
|
46
82
|
* read in both directions per anchor — callers and callees — because the review
|
|
@@ -52,12 +88,18 @@ import { compareCodeUnits } from "audit-tools/shared";
|
|
|
52
88
|
export function buildReviewFileMap(bundle, scope) {
|
|
53
89
|
const graphs = bundle.graph_bundle?.graphs;
|
|
54
90
|
const sources = [];
|
|
91
|
+
const omittedSources = [];
|
|
55
92
|
const outgoing = new Map();
|
|
56
93
|
const incoming = new Map();
|
|
57
94
|
let edgeCount = 0;
|
|
58
95
|
for (const [kind, edges] of Object.entries(graphs ?? {})) {
|
|
59
96
|
if (!Array.isArray(edges))
|
|
60
97
|
continue;
|
|
98
|
+
if (!isDependencyEdgeBucket(kind)) {
|
|
99
|
+
if (edges.length > 0)
|
|
100
|
+
omittedSources.push(`${kind} (${edges.length} edge(s))`);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
61
103
|
let kindCount = 0;
|
|
62
104
|
for (const edge of edges) {
|
|
63
105
|
if (typeof edge !== "object" ||
|
|
@@ -78,6 +120,7 @@ export function buildReviewFileMap(bundle, scope) {
|
|
|
78
120
|
edgeCount += kindCount;
|
|
79
121
|
}
|
|
80
122
|
sources.sort(compareCodeUnits);
|
|
123
|
+
omittedSources.sort(compareCodeUnits);
|
|
81
124
|
const inScope = [...new Set(scope.files)].sort(compareCodeUnits);
|
|
82
125
|
const inScopeSet = new Set(inScope);
|
|
83
126
|
const outsideScope = (bundle.repo_manifest?.files ?? []).filter((file) => !inScopeSet.has(file.path)).length;
|
|
@@ -86,17 +129,42 @@ export function buildReviewFileMap(bundle, scope) {
|
|
|
86
129
|
for (const path of inScope) {
|
|
87
130
|
const callers = [...(incoming.get(path) ?? [])].sort(compareCodeUnits);
|
|
88
131
|
const callees = [...(outgoing.get(path) ?? [])].sort(compareCodeUnits);
|
|
132
|
+
const notes = [...(scope.notes?.get(path) ?? [])];
|
|
89
133
|
if (callers.length === 0 && callees.length === 0) {
|
|
90
134
|
filesWithoutEdges += 1;
|
|
91
|
-
|
|
135
|
+
if (notes.length === 0)
|
|
136
|
+
continue;
|
|
92
137
|
}
|
|
93
|
-
anchors.push({ path, callers, callees });
|
|
138
|
+
anchors.push({ path, callers, callees, notes });
|
|
139
|
+
}
|
|
140
|
+
// Slice by unit: the consumer's units in its order, else the manifest's by id.
|
|
141
|
+
const units = scope.units ??
|
|
142
|
+
[...(bundle.unit_manifest?.units ?? [])].sort((a, b) => compareCodeUnits(a.unit_id, b.unit_id));
|
|
143
|
+
const owner = unitOwnership(units);
|
|
144
|
+
const used = new Set();
|
|
145
|
+
const slices = [];
|
|
146
|
+
const seenUnits = new Set();
|
|
147
|
+
for (const unit of units) {
|
|
148
|
+
if (seenUnits.has(unit.unit_id))
|
|
149
|
+
continue;
|
|
150
|
+
seenUnits.add(unit.unit_id);
|
|
151
|
+
const unitFiles = inScope.filter((file) => owner.get(file) === unit.unit_id);
|
|
152
|
+
// The consumer's units are all listed (they ARE its index); the manifest's
|
|
153
|
+
// only where they hold a file under review.
|
|
154
|
+
if (unitFiles.length === 0 && scope.units === undefined)
|
|
155
|
+
continue;
|
|
156
|
+
slices.push({ unit_id: unit.unit_id, filename: sliceFilename(unit.unit_id, used), files: unitFiles });
|
|
157
|
+
}
|
|
158
|
+
const unassigned = inScope.filter((file) => !owner.has(file));
|
|
159
|
+
if (unassigned.length > 0) {
|
|
160
|
+
slices.push({ unit_id: null, filename: sliceFilename(null, used), files: unassigned });
|
|
94
161
|
}
|
|
95
162
|
return {
|
|
96
163
|
provenance: {
|
|
97
164
|
author: "tool",
|
|
98
165
|
sources,
|
|
99
166
|
edge_count: edgeCount,
|
|
167
|
+
omitted_sources: omittedSources,
|
|
100
168
|
graph_present: graphs !== undefined,
|
|
101
169
|
},
|
|
102
170
|
scope: {
|
|
@@ -106,96 +174,100 @@ export function buildReviewFileMap(bundle, scope) {
|
|
|
106
174
|
},
|
|
107
175
|
anchors,
|
|
108
176
|
files_without_edges: filesWithoutEdges,
|
|
177
|
+
slices,
|
|
109
178
|
};
|
|
110
179
|
}
|
|
180
|
+
function sliceAnchors(map, slice) {
|
|
181
|
+
const files = new Set(slice.files);
|
|
182
|
+
return map.anchors.filter((anchor) => files.has(anchor.path));
|
|
183
|
+
}
|
|
184
|
+
function unitLabel(slice) {
|
|
185
|
+
return slice.unit_id ?? "(no unit)";
|
|
186
|
+
}
|
|
111
187
|
/**
|
|
112
|
-
* Render
|
|
113
|
-
*
|
|
114
|
-
*
|
|
188
|
+
* Render one slice: a short provenance header, then every anchor of the unit with
|
|
189
|
+
* its complete caller and callee lists and its notes. Returned as text rather
|
|
190
|
+
* than JSON so a lane reads it as data-that-was-handed-over.
|
|
115
191
|
*/
|
|
116
|
-
export function
|
|
192
|
+
export function renderReviewFileMapSlice(map, slice) {
|
|
193
|
+
const anchors = sliceAnchors(map, slice);
|
|
194
|
+
const edgeless = slice.files.length - anchors.filter((a) => a.callers.length + a.callees.length > 0).length;
|
|
117
195
|
const lines = [
|
|
118
|
-
|
|
196
|
+
`### Call-site map slice — unit ${unitLabel(slice)} (provenance: machine-derived prior recon — you did NOT author this)`,
|
|
119
197
|
"",
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"expected to TRUST it as a starting point, not to reproduce it.",
|
|
198
|
+
"Derived by the audit tool from this run's dependency graph (call-site buckets only). Read-only " +
|
|
199
|
+
"and bound into your review: if it disagrees with the source, say so in your finding and name the " +
|
|
200
|
+
"file and symbol that contradict it.",
|
|
124
201
|
"",
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"recon is shared.",
|
|
131
|
-
"",
|
|
132
|
-
`Edges consulted: ${map.provenance.edge_count}` +
|
|
133
|
-
(map.provenance.sources.length > 0
|
|
134
|
-
? ` — from ${map.provenance.sources.join(", ")}.`
|
|
135
|
-
: map.provenance.graph_present
|
|
136
|
-
? " — the dependency graph carried no edges."
|
|
137
|
-
: " — no dependency graph was available."),
|
|
138
|
-
"",
|
|
139
|
-
`Scope: ${map.scope.basis} — ${map.scope.file_count} file(s) under review. Every one the graph ` +
|
|
140
|
-
"connects is listed below with its COMPLETE caller and callee lists; nothing is capped.",
|
|
202
|
+
`${slice.files.length} file(s) of this unit are under review; ${anchors.length} are listed below ` +
|
|
203
|
+
`with their COMPLETE caller and callee lists; ${edgeless} carry no graph edge` +
|
|
204
|
+
(edgeless > 0
|
|
205
|
+
? " — an absent edge is a gap in this extraction, not a finding that nothing depends on the file."
|
|
206
|
+
: "."),
|
|
141
207
|
"",
|
|
142
208
|
];
|
|
143
|
-
|
|
144
|
-
lines.push(`${map.scope.outside_scope} other authored file(s) lie outside this scope and are not ` +
|
|
145
|
-
"anchored; they still appear as callers or callees wherever an edge reaches them. An " +
|
|
146
|
-
"unanchored file is outside this map, not unconnected — derive its call sites yourself " +
|
|
147
|
-
"if your review follows the code there.", "");
|
|
148
|
-
}
|
|
149
|
-
const noEdgeLine = (count) => `${count} authored file(s) carry no graph edge and are NOT listed — their absence is a gap ` +
|
|
150
|
-
"in this extraction, not a finding that nothing depends on them.";
|
|
151
|
-
if (map.anchors.length === 0) {
|
|
152
|
-
lines.push("No call sites are mapped (no graph edges connect the authored files). Treat this as NO " +
|
|
153
|
-
"RECON rather than as a map showing everything is unconnected — the absence of an edge in " +
|
|
154
|
-
"this repository's extraction is not evidence that no caller exists.", "");
|
|
155
|
-
if (map.files_without_edges > 0) {
|
|
156
|
-
lines.push(noEdgeLine(map.files_without_edges), "");
|
|
157
|
-
}
|
|
158
|
-
return lines;
|
|
159
|
-
}
|
|
160
|
-
for (const anchor of map.anchors) {
|
|
209
|
+
for (const anchor of anchors) {
|
|
161
210
|
lines.push(`- **${anchor.path}**`);
|
|
162
211
|
lines.push(` - referenced by: ${anchor.callers.join(", ") || "(none recorded)"}`);
|
|
163
212
|
lines.push(` - references: ${anchor.callees.join(", ") || "(none recorded)"}`);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// In-scope files the graph has no edge for at all: a drop, so it is stated.
|
|
167
|
-
lines.push("", `⚠ ${noEdgeLine(map.files_without_edges)}`);
|
|
213
|
+
for (const note of anchor.notes)
|
|
214
|
+
lines.push(` - lead: ${note}`);
|
|
168
215
|
}
|
|
169
216
|
lines.push("");
|
|
170
217
|
return lines;
|
|
171
218
|
}
|
|
172
|
-
/** The context file's name. Its directory is content-addressed by the lane materializer. */
|
|
173
|
-
const REVIEW_FILE_MAP_FILENAME = "review-call-site-map.md";
|
|
174
219
|
/**
|
|
175
|
-
* Split one map into the prompt
|
|
176
|
-
* two cannot come from different builds. The
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* materializer lists under its "Read-only context files" section.
|
|
220
|
+
* Split one map into the prompt's index and the read-only slice files, so the
|
|
221
|
+
* two cannot come from different builds. The index states the provenance, the
|
|
222
|
+
* read-only rule, every count, the omitted buckets, and one row per unit naming
|
|
223
|
+
* its slice — the lane materializer lists each slice's full path under its
|
|
224
|
+
* "Read-only context files" section.
|
|
181
225
|
*/
|
|
182
|
-
export function reviewFileMapContext(map) {
|
|
226
|
+
export function reviewFileMapContext(map, options = {}) {
|
|
183
227
|
const noRecon = "so the map is NO RECON — an absent edge is not evidence that no caller exists";
|
|
184
228
|
const edges = map.provenance.sources.length > 0
|
|
185
229
|
? `from ${map.provenance.sources.join(", ")}`
|
|
186
230
|
: map.provenance.graph_present
|
|
187
|
-
? `the dependency graph carried no edges, ${noRecon}`
|
|
231
|
+
? `the dependency graph carried no call-site edges, ${noRecon}`
|
|
188
232
|
: `no dependency graph was available, ${noRecon}`;
|
|
233
|
+
const contextFiles = [];
|
|
234
|
+
const sliced = new Set();
|
|
235
|
+
for (const slice of map.slices) {
|
|
236
|
+
if (sliceAnchors(map, slice).length === 0)
|
|
237
|
+
continue;
|
|
238
|
+
sliced.add(slice.filename);
|
|
239
|
+
contextFiles.push({
|
|
240
|
+
filename: slice.filename,
|
|
241
|
+
label: `Call-site map slice — unit ${unitLabel(slice)} (tool-generated prior recon)`,
|
|
242
|
+
text: renderReviewFileMapSlice(map, slice).join("\n"),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
const columns = options.columns ?? [];
|
|
246
|
+
const header = ["unit", "files under review", "anchored", "no graph edge", ...columns.map((c) => c.header), "slice file"];
|
|
247
|
+
const rows = map.slices.map((slice) => {
|
|
248
|
+
const anchors = sliceAnchors(map, slice);
|
|
249
|
+
const edgeless = slice.files.length - anchors.filter((a) => a.callers.length + a.callees.length > 0).length;
|
|
250
|
+
return [
|
|
251
|
+
unitLabel(slice),
|
|
252
|
+
String(slice.files.length),
|
|
253
|
+
String(anchors.length),
|
|
254
|
+
String(edgeless),
|
|
255
|
+
...columns.map((column) => column.cell(slice.unit_id)),
|
|
256
|
+
sliced.has(slice.filename) ? `\`${slice.filename}\`` : "—",
|
|
257
|
+
];
|
|
258
|
+
});
|
|
189
259
|
const summaryLines = [
|
|
190
260
|
"### Verified call-site map (provenance: machine-derived prior recon — you did NOT author this)",
|
|
191
261
|
"",
|
|
192
262
|
"The audit tool derived a call-site map from the dependency graph and the repository manifest " +
|
|
193
|
-
|
|
194
|
-
'
|
|
195
|
-
"
|
|
196
|
-
"
|
|
263
|
+
"extracted earlier in this run and wrote it as one read-only SLICE file per unit, indexed below; " +
|
|
264
|
+
'each slice\'s full path is listed under "Read-only context files" at the end of this prompt. ' +
|
|
265
|
+
"Before re-deriving any call site, find the unit of the file you are judging in the index and read " +
|
|
266
|
+
"that unit's slice whole — it lists every anchored file of the unit with its complete caller and " +
|
|
267
|
+
"callee lists. Read only the slices of the units you judge. It is a factual input handed to you so " +
|
|
268
|
+
"this round spends its budget on judgment: TRUST it as a starting point, do not reproduce it.",
|
|
197
269
|
"",
|
|
198
|
-
"**You cannot write back to it.**
|
|
270
|
+
"**You cannot write back to it.** Every slice is read-only and bound into this review, so a " +
|
|
199
271
|
"submission made against an edited copy is refused, and a correction reaches the next round " +
|
|
200
272
|
"only through a fresh extraction pass. If it disagrees with what you find in the source, say " +
|
|
201
273
|
"so explicitly in your finding — name the file and the symbol that contradicts the map. Your " +
|
|
@@ -203,18 +275,23 @@ export function reviewFileMapContext(map) {
|
|
|
203
275
|
"",
|
|
204
276
|
`Scope: ${map.scope.basis} — ${map.scope.file_count} file(s) under review; ` +
|
|
205
277
|
`${map.anchors.length} anchored with their complete caller and callee lists; ` +
|
|
206
|
-
`${map.files_without_edges} carry no graph edge
|
|
207
|
-
|
|
278
|
+
`${map.files_without_edges} carry no graph edge (an absent edge is a gap in this extraction, ` +
|
|
279
|
+
"not a finding that nothing depends on the file); " +
|
|
280
|
+
`${map.scope.outside_scope} other authored file(s) lie outside this scope and are not anchored ` +
|
|
281
|
+
"(outside this map, not unconnected — they still appear as callers or callees wherever an edge " +
|
|
282
|
+
"reaches them).",
|
|
208
283
|
`Edges consulted: ${map.provenance.edge_count} — ${edges}.`,
|
|
284
|
+
...(map.provenance.omitted_sources.length > 0
|
|
285
|
+
? [
|
|
286
|
+
`Not read: ${map.provenance.omitted_sources.join(", ")} — not a call site (co_change records ` +
|
|
287
|
+
"files changed in the same commits; routes is not an edge list), so not listed.",
|
|
288
|
+
]
|
|
289
|
+
: []),
|
|
209
290
|
"",
|
|
210
291
|
];
|
|
211
|
-
|
|
212
|
-
summaryLines,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
label: "Verified call-site map (tool-generated prior recon)",
|
|
216
|
-
text: renderReviewFileMap(map).join("\n"),
|
|
217
|
-
},
|
|
218
|
-
};
|
|
292
|
+
if (rows.length > 0) {
|
|
293
|
+
summaryLines.push(`| ${header.join(" | ")} |`, `|${header.map(() => "---").join("|")}|`, ...rows.map((row) => `| ${row.join(" | ")} |`), "");
|
|
294
|
+
}
|
|
295
|
+
return { summaryLines, contextFiles };
|
|
219
296
|
}
|
|
220
297
|
//# sourceMappingURL=reviewFileMap.js.map
|