@cat-factory/orchestration 0.301.3 → 0.302.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.
Files changed (28) hide show
  1. package/dist/modules/execution/BugFishingController.d.ts +35 -9
  2. package/dist/modules/execution/BugFishingController.d.ts.map +1 -1
  3. package/dist/modules/execution/BugFishingController.js +49 -14
  4. package/dist/modules/execution/BugFishingController.js.map +1 -1
  5. package/dist/modules/execution/RunDispatcher.d.ts.map +1 -1
  6. package/dist/modules/execution/RunDispatcher.js +7 -0
  7. package/dist/modules/execution/RunDispatcher.js.map +1 -1
  8. package/dist/modules/execution/bugFishing.logic.d.ts +37 -3
  9. package/dist/modules/execution/bugFishing.logic.d.ts.map +1 -1
  10. package/dist/modules/execution/bugFishing.logic.js +124 -23
  11. package/dist/modules/execution/bugFishing.logic.js.map +1 -1
  12. package/dist/modules/execution/bugFishingPass.d.ts +35 -0
  13. package/dist/modules/execution/bugFishingPass.d.ts.map +1 -0
  14. package/dist/modules/execution/bugFishingPass.js +45 -0
  15. package/dist/modules/execution/bugFishingPass.js.map +1 -0
  16. package/dist/modules/execution/bugFishingSurvey.d.ts +87 -0
  17. package/dist/modules/execution/bugFishingSurvey.d.ts.map +1 -0
  18. package/dist/modules/execution/bugFishingSurvey.js +130 -0
  19. package/dist/modules/execution/bugFishingSurvey.js.map +1 -0
  20. package/dist/modules/execution/bugFishingTerritories.logic.d.ts +89 -0
  21. package/dist/modules/execution/bugFishingTerritories.logic.d.ts.map +1 -0
  22. package/dist/modules/execution/bugFishingTerritories.logic.js +519 -0
  23. package/dist/modules/execution/bugFishingTerritories.logic.js.map +1 -0
  24. package/dist/modules/execution/dispatcher-registries.d.ts +8 -0
  25. package/dist/modules/execution/dispatcher-registries.d.ts.map +1 -1
  26. package/dist/modules/execution/dispatcher-registries.js +52 -8
  27. package/dist/modules/execution/dispatcher-registries.js.map +1 -1
  28. package/package.json +12 -12
@@ -19,13 +19,25 @@ const MAX_SUMMARY = 4000;
19
19
  /**
20
20
  * Most findings one pass may contribute.
21
21
  *
22
- * The state rides the run's persisted `detail` blob, re-serialized on every progress write, and
23
- * an expedition runs eight passes over it. The cap is generous enough that hitting it means the
24
- * pass stopped applying the finding bar, which is why the overflow is REPORTED in the phase
25
- * summary rather than silently trimmed: a reader who assumed a prefix would conclude the tail
26
- * was never found.
22
+ * Generous enough that hitting it means the pass stopped applying the finding bar, which is why
23
+ * the overflow is REPORTED in the phase summary rather than silently trimmed: a reader who assumed
24
+ * a prefix would conclude the tail was never found.
27
25
  */
28
26
  const MAX_FINDINGS_PER_PHASE = 40;
27
+ /**
28
+ * Most findings ONE EXPEDITION may record, across every pass.
29
+ *
30
+ * The per-phase cap alone bounded the blob only while a phase list was the angle catalog: eight
31
+ * passes of forty. A partitioned codebase plans territories x angles, up to
32
+ * `BUG_FISHING_MAX_PASS_BUDGET` dispatches, so the same per-phase number multiplied out to
33
+ * thousands of findings on a state that rides the run's `detail` blob and is re-serialised on
34
+ * every progress write. This is the bound that does not move when the matrix grows.
35
+ *
36
+ * It is a CEILING on a record nobody can triage rather than a target: an expedition that files two
37
+ * hundred findings has already produced more than a human will work through, and the trim is
38
+ * stated on the phase that hit it for the same reason the per-phase one is.
39
+ */
40
+ const MAX_FINDINGS_PER_EXPEDITION = 200;
29
41
  /**
30
42
  * Trim, SCRUB and cap one field of a finding, in that order.
31
43
  *
@@ -76,6 +88,54 @@ export function planBugFishingPhases(selected) {
76
88
  unknown,
77
89
  };
78
90
  }
91
+ /**
92
+ * Whether a finding's path lies inside the pass's territory.
93
+ *
94
+ * The brief tells a pass what it is NOT responsible for, and this is the platform holding it to
95
+ * that rather than exhorting it: a pass that wanders is corrected here, and the count of what was
96
+ * dropped lands on the phase so a human can see how often it happens. A finding with NO path is
97
+ * kept: an expedition can legitimately report a gap that spans files, and dropping it would be
98
+ * the platform deciding it did not happen.
99
+ */
100
+ function isInTerritory(path, scope) {
101
+ if (!scope || scope.roots.length === 0)
102
+ return true;
103
+ if (!path)
104
+ return true;
105
+ const clean = path.replace(/^\.\//, '').replace(/^\/+/, '');
106
+ return scope.roots.some((root) => clean === root || clean.startsWith(`${root}/`));
107
+ }
108
+ /**
109
+ * What a pass reported READING, intersected with the manifest it was handed.
110
+ *
111
+ * Self-reported by construction (the model lists its own reads), which is why the record says
112
+ * so: nothing here verifies the claim, and a later verified producer would name itself instead.
113
+ * A pass that reported no paths at all gets NO record rather than a zero: "did not say" and
114
+ * "read nothing" are different facts, and a coverage rail showing 0% for the first would accuse
115
+ * a pass that may have read everything.
116
+ */
117
+ export function computeBugFishingCoverage(output, scope) {
118
+ const reported = (output?.filesRead ?? [])
119
+ .map((path) => clamp(path, 400).replace(/^\.\//, '').replace(/^\/+/, ''))
120
+ .filter((path) => path.length > 0);
121
+ if (reported.length === 0)
122
+ return null;
123
+ const manifest = scope?.manifest;
124
+ const unique = new Set(reported);
125
+ if (!manifest) {
126
+ return { filesRead: unique.size, manifestFiles: 0, offManifest: 0, source: 'self-reported' };
127
+ }
128
+ let onManifest = 0;
129
+ for (const path of unique)
130
+ if (manifest.has(path))
131
+ onManifest++;
132
+ return {
133
+ filesRead: onManifest,
134
+ manifestFiles: manifest.size,
135
+ offManifest: unique.size - onManifest,
136
+ source: 'self-reported',
137
+ };
138
+ }
79
139
  /** Severity rank, most severe first; an unrecognised severity sorts last rather than first. */
80
140
  function severityRank(severity) {
81
141
  const index = BUG_FISHING_SEVERITY_ORDER.indexOf(severity);
@@ -90,14 +150,21 @@ function severityRank(severity) {
90
150
  * with no path — an expedition can legitimately report a gap that spans files, and blanking the
91
151
  * row would be the platform deciding it did not happen.
92
152
  */
93
- export function coerceBugFishingFindings(output, phaseId, mintId) {
153
+ export function coerceBugFishingFindings(output, phaseId, mintId, scope) {
94
154
  const raw = (output?.findings ?? []).filter((f) => clamp(f.title, MAX_FINDING_TEXT).length > 0 || clamp(f.detail, MAX_FINDING_TEXT).length > 0);
95
- const kept = [...raw].sort((a, b) => severityRank(a.severity) - severityRank(b.severity));
155
+ const inScope = raw.filter((f) => isInTerritory(clamp(f.path, 400), scope));
156
+ const outOfScope = raw.length - inScope.length;
157
+ const kept = [...inScope].sort((a, b) => severityRank(a.severity) - severityRank(b.severity));
96
158
  const dropped = Math.max(0, kept.length - MAX_FINDINGS_PER_PHASE);
97
159
  return {
160
+ // UNDEFINED, never 0, for a pass that was never scoped: the phase record's own contract is
161
+ // that an absent count means "not scoped to a territory", and a zero would claim the pass was
162
+ // held to one and stayed inside it.
163
+ outOfScope: scope ? outOfScope : undefined,
98
164
  findings: kept.slice(0, MAX_FINDINGS_PER_PHASE).map((f) => ({
99
165
  id: mintId(),
100
166
  phaseId,
167
+ ...(scope?.territoryId ? { territoryId: scope.territoryId } : {}),
101
168
  path: clamp(f.path, 400),
102
169
  line: typeof f.line === 'number' && Number.isFinite(f.line) ? f.line : null,
103
170
  severity: f.severity,
@@ -123,13 +190,27 @@ export function coerceBugFishingFindings(output, phaseId, mintId) {
123
190
  * renders and the controller uses to decide between re-arming the step and parking the run.
124
191
  */
125
192
  export function recordBugFishingPhase(state, phaseIndex, outcome) {
193
+ const recorded = state.findings ?? [];
194
+ const headroom = Math.max(0, MAX_FINDINGS_PER_EXPEDITION - recorded.length);
195
+ const kept = outcome.findings.slice(0, headroom);
196
+ const beyondExpeditionCap = outcome.findings.length - kept.length;
126
197
  const phases = (state.phases ?? []).map((phase, i) => i === phaseIndex
127
198
  ? {
128
199
  ...phase,
129
200
  status: 'completed',
130
- summary: phaseSummary(outcome.summary, outcome.findings.length, outcome.dropped),
201
+ summary: phaseSummary({
202
+ summary: outcome.summary,
203
+ // What the PER-PHASE cap kept, which is what its own sentence is about. The
204
+ // expedition ceiling gets its own sentence below, over what this then trimmed.
205
+ kept: outcome.findings.length,
206
+ dropped: outcome.dropped,
207
+ beyondExpeditionCap,
208
+ outOfScope: outcome.outOfScope ?? 0,
209
+ }),
131
210
  settledAt: outcome.at,
132
211
  failureReason: null,
212
+ coverage: outcome.coverage ?? null,
213
+ ...(outcome.outOfScope !== undefined ? { outOfScopeFindings: outcome.outOfScope } : {}),
133
214
  }
134
215
  : phase);
135
216
  const next = phaseIndex + 1;
@@ -137,25 +218,39 @@ export function recordBugFishingPhase(state, phaseIndex, outcome) {
137
218
  ...state,
138
219
  phases,
139
220
  currentPhaseIndex: next,
140
- findings: [...(state.findings ?? []), ...outcome.findings],
221
+ findings: [...recorded, ...kept],
141
222
  status: next < phases.length ? 'fishing' : 'awaiting_triage',
142
223
  };
143
224
  }
144
225
  /**
145
- * The phase summary as recorded: the agent's own account, plus a sentence naming any findings
146
- * the per-phase cap dropped.
226
+ * The phase summary as recorded: the agent's own account, plus a sentence naming any findings a
227
+ * cap dropped.
147
228
  *
148
- * A cap that is not a plain prefix has to say so — a reader who assumed one would conclude the
149
- * tail was never found, when in fact it was found and discarded.
229
+ * A cap that is not a plain prefix has to say so: a reader who assumed one would conclude the
230
+ * tail was never found, when in fact it was found and discarded. The two caps get two sentences
231
+ * because they need different fixes, a narrower re-run against triaging what is already on the
232
+ * record.
150
233
  */
151
- function phaseSummary(summary, kept, dropped) {
152
- const base = clamp(summary, MAX_SUMMARY);
153
- if (dropped <= 0)
154
- return base;
155
- const note = `This pass reported more findings than one phase may record: the ${kept} most severe were ` +
156
- `kept and ${dropped} lower-severity ones were dropped. Re-run this angle with a narrower ` +
157
- 'focus to see them.';
158
- return base ? `${base}\n\n${note}` : note;
234
+ function phaseSummary(outcome) {
235
+ const { summary, kept, dropped, beyondExpeditionCap, outOfScope } = outcome;
236
+ const notes = [];
237
+ if (dropped > 0) {
238
+ notes.push(`This pass reported more findings than one phase may record: the ${kept} most severe were ` +
239
+ `kept and ${dropped} lower-severity ones were dropped. Re-run this angle with a narrower ` +
240
+ 'focus to see them.');
241
+ }
242
+ if (beyondExpeditionCap > 0) {
243
+ notes.push(`${beyondExpeditionCap} further ${beyondExpeditionCap === 1 ? 'finding was' : 'findings were'} ` +
244
+ 'not recorded: this expedition has already filed as many findings as one record holds. ' +
245
+ 'Triage the catch so far, then run the remaining angles as their own expedition.');
246
+ }
247
+ if (outOfScope > 0) {
248
+ // Named for the same reason the cap is: the reader has to be able to tell a territory that
249
+ // came back clean from one whose pass spent its findings on somebody else's code.
250
+ notes.push(`${outOfScope} ${outOfScope === 1 ? 'finding was' : 'findings were'} dropped for pointing ` +
251
+ "outside this pass's territory. Another pass owns that ground.");
252
+ }
253
+ return [clamp(summary, MAX_SUMMARY), ...notes].filter((part) => part.length > 0).join('\n\n');
159
254
  }
160
255
  /**
161
256
  * Record a pass that FAILED (its container job crashed, or produced nothing usable). The phase
@@ -260,8 +355,14 @@ export function untriagedBugFishingFindings(state, now) {
260
355
  * already caught. Dismissed findings are included deliberately: a human rejecting a finding says
261
356
  * they do not want it fixed, not that the next pass should raise it again.
262
357
  */
263
- export function priorBugFishingFindingTitles(state) {
264
- return (state.findings ?? []).map((f) => f.title).filter((t) => t.trim().length > 0);
358
+ export function priorBugFishingFindingTitles(state, territoryId) {
359
+ // Scoped to the territory once the codebase is partitioned. Across thirty passes the whole
360
+ // list is hundreds of lines, and nobody fishing territory five needs territory one's catch:
361
+ // the deduplication this brief exists for is between passes over the SAME code.
362
+ const scoped = territoryId
363
+ ? (state.findings ?? []).filter((f) => f.territoryId === territoryId)
364
+ : (state.findings ?? []);
365
+ return scoped.map((f) => f.title).filter((t) => t.trim().length > 0);
265
366
  }
266
367
  /**
267
368
  * The angle a phase index names, described from the CATALOG but falling back to what the run
@@ -1 +1 @@
1
- {"version":3,"file":"bugFishing.logic.js","sourceRoot":"","sources":["../../../src/modules/execution/bugFishing.logic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAM1B,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAE5B,6FAA6F;AAC7F,8FAA8F;AAC9F,uEAAuE;AACvE,OAAO,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAEh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,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI;KACnC,CAAA;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { BugFishingPhase, BugFishingStepState, InjectedContextFile } from '@cat-factory/kernel';
2
+ import type { BugFishingPassScope } from './bugFishing.logic.js';
3
+ import type { CodebaseSurveyResult } from './bugFishingSurvey.js';
4
+ /** What a pass is handed (the manifest as a context file) and held to (the scope). */
5
+ export interface BugFishingPass {
6
+ /** The territory to name in the phase brief, or null for a whole-codebase pass. */
7
+ territory: {
8
+ label: string;
9
+ roots: readonly string[];
10
+ } | null;
11
+ /** The `.cat-context/territory.md` manifest, or null when there is no territory to describe. */
12
+ contextFile: InjectedContextFile | null;
13
+ /**
14
+ * What the platform holds the pass to: findings outside the territory are dropped and counted,
15
+ * and the coverage share is computed against the manifest. Undefined for a whole-codebase pass,
16
+ * which owns everything and is therefore scoped by nothing.
17
+ */
18
+ scope: BugFishingPassScope | undefined;
19
+ }
20
+ /**
21
+ * Resolve the pass a planned phase describes against the survey.
22
+ *
23
+ * A phase with no `territoryId` is the PASS-THROUGH: a codebase small enough to fish whole, or an
24
+ * expedition planned before territories existed, or one whose survey could not read the
25
+ * repository. All three get no manifest, no scope and no territory in the brief, which is
26
+ * byte-for-byte the dispatch that shipped before this feature.
27
+ *
28
+ * A phase whose territory the CURRENT survey no longer produces (the tree moved between passes,
29
+ * or a fix merged and re-shaped a directory) falls back to the roots the run itself recorded, and
30
+ * gets no file manifest. That is deliberate: the run's own record is the better witness of what
31
+ * it planned, and a manifest re-derived from a different partition would describe a territory
32
+ * this pass was never given.
33
+ */
34
+ export declare function bugFishingPassScope(state: BugFishingStepState, phase: BugFishingPhase, survey: CodebaseSurveyResult): BugFishingPass;
35
+ //# sourceMappingURL=bugFishingPass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugFishingPass.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/bugFishingPass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAWjE,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC7B,mFAAmF;IACnF,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAA;IAC7D,gGAAgG;IAChG,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACvC;;;;OAIG;IACH,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAAA;CACvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,oBAAoB,GAC3B,cAAc,CA2BhB"}
@@ -0,0 +1,45 @@
1
+ import { BUG_FISHING_TERRITORY_CONTEXT_FILE, renderBugFishingTerritoryContext, } from '@cat-factory/agents';
2
+ /**
3
+ * Resolve the pass a planned phase describes against the survey.
4
+ *
5
+ * A phase with no `territoryId` is the PASS-THROUGH: a codebase small enough to fish whole, or an
6
+ * expedition planned before territories existed, or one whose survey could not read the
7
+ * repository. All three get no manifest, no scope and no territory in the brief, which is
8
+ * byte-for-byte the dispatch that shipped before this feature.
9
+ *
10
+ * A phase whose territory the CURRENT survey no longer produces (the tree moved between passes,
11
+ * or a fix merged and re-shaped a directory) falls back to the roots the run itself recorded, and
12
+ * gets no file manifest. That is deliberate: the run's own record is the better witness of what
13
+ * it planned, and a manifest re-derived from a different partition would describe a territory
14
+ * this pass was never given.
15
+ */
16
+ export function bugFishingPassScope(state, phase, survey) {
17
+ const territoryId = phase.territoryId;
18
+ if (!territoryId)
19
+ return { territory: null, contextFile: null, scope: undefined };
20
+ const recorded = (state.territories ?? []).find((t) => t.id === territoryId);
21
+ const roots = recorded?.roots ?? [];
22
+ const label = phase.territoryLabel || recorded?.label || territoryId;
23
+ const files = (survey.filesByTerritory.get(territoryId) ?? []).map((file) => file.path);
24
+ const scope = { territoryId, roots, manifest: new Set(files) };
25
+ if (files.length === 0) {
26
+ // The survey has no manifest for this territory any more. The pass still owns the roots (the
27
+ // brief says so, and the scope enforces it); it just gets no map, which costs it the
28
+ // orientation saving rather than its correctness.
29
+ return { territory: { label, roots }, contextFile: null, scope };
30
+ }
31
+ const contextFile = {
32
+ path: BUG_FISHING_TERRITORY_CONTEXT_FILE,
33
+ content: renderBugFishingTerritoryContext({
34
+ territory: {
35
+ label,
36
+ roots,
37
+ ...(recorded?.approxTokens !== undefined ? { approxTokens: recorded.approxTokens } : {}),
38
+ },
39
+ files,
40
+ neighbours: (state.territories ?? []).filter((t) => t.id !== territoryId).map((t) => t.label),
41
+ }),
42
+ };
43
+ return { territory: { label, roots }, contextFile, scope };
44
+ }
45
+ //# sourceMappingURL=bugFishingPass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugFishingPass.js","sourceRoot":"","sources":["../../../src/modules/execution/bugFishingPass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,gCAAgC,GACjC,MAAM,qBAAqB,CAAA;AA4B5B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAA0B,EAC1B,KAAsB,EACtB,MAA4B;IAE5B,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAA;IACrC,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IACjF,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KA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,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAA;AAC5D,CAAC"}
@@ -0,0 +1,87 @@
1
+ import type { BugFishingTerritory, Logger, RepoFiles, RunRepoContext } from '@cat-factory/kernel';
2
+ import { type SurveyedFile } from './bugFishingTerritories.logic.js';
3
+ /** What a survey produced, plus what it could not do. */
4
+ export interface CodebaseSurveyResult {
5
+ /** The partition, most worth fishing first once the caller has prioritised it. */
6
+ territories: BugFishingTerritory[];
7
+ /**
8
+ * Every fishable file of each territory, for the manifest and the coverage intersection. Paths
9
+ * are relative to the SURVEY ROOT (the service's own directory in a monorepo), which is the
10
+ * frame the agent's checkout is rooted at.
11
+ */
12
+ filesByTerritory: Map<string, SurveyedFile[]>;
13
+ /** True when the provider cut the tree short: the territories cover a PREFIX of the codebase. */
14
+ treeTruncated: boolean;
15
+ /**
16
+ * Why the survey could not read the codebase, when it could not. Null on a real survey.
17
+ *
18
+ * Stated rather than left for the one-territory plan to imply, because the plan is the same
19
+ * VALUE for opposite FACTS: "this repository is small enough to fish whole" and "nobody could
20
+ * see this repository" produce an identical partition, and only the second is something a human
21
+ * has to act on.
22
+ */
23
+ unavailableReason: string | null;
24
+ }
25
+ /** What the survey needs to read a codebase. */
26
+ export interface CodebaseSurveyInput {
27
+ /**
28
+ * The run's checkout-free repo facade, or null when no repository resolves for the block (no
29
+ * VCS connected, or the deployment wires no repo context).
30
+ */
31
+ repo: RepoFiles | null;
32
+ /** The branch the expedition fishes: the base branch its read-only clone is taken from. */
33
+ branch: string;
34
+ /** The monorepo subdirectory the service lives in, when it has one. */
35
+ serviceDirectory?: string | null;
36
+ logger?: Logger;
37
+ }
38
+ /**
39
+ * The survey a caller gets when the codebase cannot be read: ONE whole-codebase territory,
40
+ * carrying the reason.
41
+ *
42
+ * A pass-through is the correct disposition for an unwired capability, and it must be invisible
43
+ * to the domain: the expedition this plans is byte-for-byte the eight-angle hunt that shipped
44
+ * before territories existed. What it must not be is silent, which is what `reason` is for.
45
+ *
46
+ * ONE territory rather than none, and the difference is not cosmetic: an empty list is what the
47
+ * step then persists as `territories: []`, the value the schema documents as forbidden because it
48
+ * claims the codebase was surveyed and found to contain nothing, and it is also what leaves the
49
+ * planner with no cell to name when the pass budget cuts an angle. The territory's counts are
50
+ * zero because nobody could count them; `unavailableReason` is what says so, and it is the only
51
+ * thing that tells this apart from a genuinely tiny repository.
52
+ *
53
+ * Exported because the seam that RESOLVES the run's repository sits outside this module and can
54
+ * fail on its own terms (an unlinked block chain refuses with a `ValidationError`), and this
55
+ * module's contract is that a survey never throws. That caller states its own reason through here
56
+ * rather than rebuilding the shape.
57
+ */
58
+ export declare function unavailableSurvey(reason: string): CodebaseSurveyResult;
59
+ /**
60
+ * Read the repository tree and partition it into territories.
61
+ *
62
+ * Never throws: a tree read that fails degrades to the whole-codebase expedition WITH the cause
63
+ * recorded, because an expedition that cannot be partitioned is still worth running and a run
64
+ * that failed at planning because a contents API blipped is not. The blueprint read degrades the
65
+ * same way, one level finer: no blueprint means the directory heuristic, which is what a
66
+ * repository that was never blueprinted gets anyway.
67
+ */
68
+ export declare function surveyCodebase(input: CodebaseSurveyInput): Promise<CodebaseSurveyResult>;
69
+ /**
70
+ * Survey the codebase a RUN targets: resolve its repository, then partition the tree.
71
+ *
72
+ * The repo resolution is its own refusal and does not belong to a survey. An unlinked block chain
73
+ * throws a `ValidationError` rather than answering null, deliberately, because guessing a repo once
74
+ * pushed a task into someone else's; that refusal belongs to a DISPATCH, where a human can act on
75
+ * it. This module's contract is the opposite one, that a survey never throws, and its callers
76
+ * include the COMPLETION path of a pass that has already run and has nothing left to refuse.
77
+ *
78
+ * Here rather than on the dispatcher so the two halves of "never throws" sit together, and so the
79
+ * dispatcher keeps only the binding: which repo resolver, which logger.
80
+ */
81
+ export declare function surveyRunCodebase(input: {
82
+ /** The run's repo resolution, bound to one workspace and block by the caller. */
83
+ resolveRunRepo: () => Promise<RunRepoContext | null>;
84
+ /** Bind the block id on it: everything below logs into this scope. */
85
+ logger?: Logger;
86
+ }): Promise<CodebaseSurveyResult>;
87
+ //# sourceMappingURL=bugFishingSurvey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugFishingSurvey.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/bugFishingSurvey.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,cAAc,EACf,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kCAAkC,CAAA;AAiBzC,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,kFAAkF;IAClF,WAAW,EAAE,mBAAmB,EAAE,CAAA;IAClC;;;;OAIG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAA;IAC7C,iGAAiG;IACjG,aAAa,EAAE,OAAO,CAAA;IACtB;;;;;;;OAOG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;IACtB,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAQtE;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgC9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAC7C,iFAAiF;IACjF,cAAc,EAAE,MAAM,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACpD,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiBhC"}
@@ -0,0 +1,130 @@
1
+ import { BLUEPRINT_JSON_PATH, safeParseBlueprintService } from '@cat-factory/contracts';
2
+ import { describeError, noopLogger } from '@cat-factory/kernel';
3
+ import { partitionCodebase, wholeCodebaseTerritory, } from './bugFishingTerritories.logic.js';
4
+ /**
5
+ * The survey a caller gets when the codebase cannot be read: ONE whole-codebase territory,
6
+ * carrying the reason.
7
+ *
8
+ * A pass-through is the correct disposition for an unwired capability, and it must be invisible
9
+ * to the domain: the expedition this plans is byte-for-byte the eight-angle hunt that shipped
10
+ * before territories existed. What it must not be is silent, which is what `reason` is for.
11
+ *
12
+ * ONE territory rather than none, and the difference is not cosmetic: an empty list is what the
13
+ * step then persists as `territories: []`, the value the schema documents as forbidden because it
14
+ * claims the codebase was surveyed and found to contain nothing, and it is also what leaves the
15
+ * planner with no cell to name when the pass budget cuts an angle. The territory's counts are
16
+ * zero because nobody could count them; `unavailableReason` is what says so, and it is the only
17
+ * thing that tells this apart from a genuinely tiny repository.
18
+ *
19
+ * Exported because the seam that RESOLVES the run's repository sits outside this module and can
20
+ * fail on its own terms (an unlinked block chain refuses with a `ValidationError`), and this
21
+ * module's contract is that a survey never throws. That caller states its own reason through here
22
+ * rather than rebuilding the shape.
23
+ */
24
+ export function unavailableSurvey(reason) {
25
+ const only = wholeCodebaseTerritory([]);
26
+ return {
27
+ territories: [only],
28
+ filesByTerritory: new Map([[only.id, []]]),
29
+ treeTruncated: false,
30
+ unavailableReason: reason,
31
+ };
32
+ }
33
+ /**
34
+ * Read the repository tree and partition it into territories.
35
+ *
36
+ * Never throws: a tree read that fails degrades to the whole-codebase expedition WITH the cause
37
+ * recorded, because an expedition that cannot be partitioned is still worth running and a run
38
+ * that failed at planning because a contents API blipped is not. The blueprint read degrades the
39
+ * same way, one level finer: no blueprint means the directory heuristic, which is what a
40
+ * repository that was never blueprinted gets anyway.
41
+ */
42
+ export async function surveyCodebase(input) {
43
+ const log = input.logger ?? noopLogger;
44
+ const repo = input.repo;
45
+ if (!repo)
46
+ return unavailableSurvey('No repository is linked to this task, so the codebase was not surveyed.');
47
+ if (!repo.listTree) {
48
+ return unavailableSurvey('The connected VCS client cannot list a repository tree, so the codebase was not surveyed.');
49
+ }
50
+ let tree;
51
+ try {
52
+ tree = await repo.listTree(input.branch);
53
+ }
54
+ catch (error) {
55
+ log.warn('bugFishing.treeReadFailed', { branch: input.branch, ...describeError(error) });
56
+ return unavailableSurvey('The repository tree could not be read, so the codebase was not surveyed.');
57
+ }
58
+ const blueprint = await readBlueprint(repo, input.branch, log);
59
+ const survey = partitionCodebase(tree, {
60
+ serviceDirectory: input.serviceDirectory ?? null,
61
+ blueprint,
62
+ });
63
+ return {
64
+ territories: survey.territories,
65
+ filesByTerritory: survey.filesByTerritory,
66
+ treeTruncated: survey.treeTruncated,
67
+ unavailableReason: null,
68
+ };
69
+ }
70
+ /**
71
+ * Survey the codebase a RUN targets: resolve its repository, then partition the tree.
72
+ *
73
+ * The repo resolution is its own refusal and does not belong to a survey. An unlinked block chain
74
+ * throws a `ValidationError` rather than answering null, deliberately, because guessing a repo once
75
+ * pushed a task into someone else's; that refusal belongs to a DISPATCH, where a human can act on
76
+ * it. This module's contract is the opposite one, that a survey never throws, and its callers
77
+ * include the COMPLETION path of a pass that has already run and has nothing left to refuse.
78
+ *
79
+ * Here rather than on the dispatcher so the two halves of "never throws" sit together, and so the
80
+ * dispatcher keeps only the binding: which repo resolver, which logger.
81
+ */
82
+ export async function surveyRunCodebase(input) {
83
+ const log = input.logger ?? noopLogger;
84
+ let runRepo;
85
+ try {
86
+ runRepo = await input.resolveRunRepo();
87
+ }
88
+ catch (error) {
89
+ log.warn('bugFishing.repoResolveFailed', describeError(error));
90
+ return unavailableSurvey('The repository this task targets could not be resolved, so the codebase was not surveyed.');
91
+ }
92
+ return surveyCodebase({
93
+ repo: runRepo?.repo ?? null,
94
+ branch: runRepo?.baseBranch ?? 'HEAD',
95
+ serviceDirectory: runRepo?.serviceDirectory ?? null,
96
+ logger: log,
97
+ });
98
+ }
99
+ /**
100
+ * The service's committed blueprint, or null.
101
+ *
102
+ * Read at the REPOSITORY root, because that is where `blueprintPostOp` commits it: the post-op
103
+ * writes {@link BLUEPRINT_JSON_PATH} through a root-scoped `RepoFiles`, with no service prefix,
104
+ * whatever subdirectory the service that produced it lives in. Reading it under the service
105
+ * directory found nothing on every monorepo service, and found it silently: a blueprinted service
106
+ * fell through to the directory heuristic with nothing saying it had one. The constant is imported
107
+ * rather than restated so the reader cannot drift from the writer again.
108
+ *
109
+ * The blueprint is a DECOMPOSITION first and a file map second: its `references` were written by
110
+ * a model against an older tree, so the partition drops a reference the tree no longer has rather
111
+ * than trusting it, and a blueprint that parses to nothing usable is simply no blueprint. A read
112
+ * failure is the same answer for the same reason: the directory heuristic is a complete fallback,
113
+ * not a degraded one.
114
+ */
115
+ async function readBlueprint(repo, branch, log) {
116
+ try {
117
+ const file = await repo.getFile(BLUEPRINT_JSON_PATH, branch);
118
+ if (!file?.content)
119
+ return null;
120
+ return safeParseBlueprintService(JSON.parse(file.content)) ?? null;
121
+ }
122
+ catch (error) {
123
+ log.warn('bugFishing.blueprintReadFailed', {
124
+ path: BLUEPRINT_JSON_PATH,
125
+ ...describeError(error),
126
+ });
127
+ return null;
128
+ }
129
+ }
130
+ //# sourceMappingURL=bugFishingSurvey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bugFishingSurvey.js","sourceRoot":"","sources":["../../../src/modules/execution/bugFishingSurvey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAQvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAEL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kCAAkC,CAAA;AAsDz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