@haystackeditor/cli 0.23.0 → 0.23.2

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.
@@ -136,11 +136,13 @@ async function body(response, what) {
136
136
  throw new OnboardingResponseError(`The onboarding service returned ${what} that is not JSON: ${error instanceof Error ? error.message : String(error)}`);
137
137
  }
138
138
  }
139
- /** The onboarding of `repository` at `baseCommit`, now. */
140
- export async function readOnboardingStatus(repository, baseCommit, token) {
139
+ /** The onboarding of `repository` at `baseCommit`, now; with `onboardRunId`, that run's (or the run a derivation change moved
140
+ * it to), whatever derivation is live: what a waiting command follows. */
141
+ export async function readOnboardingStatus(repository, baseCommit, token, onboardRunId = null) {
141
142
  if (!COMMIT.test(baseCommit))
142
143
  throw new Error(`Invalid base commit ${baseCommit}.`);
143
- const path = `${ONBOARDING_PATH}?repository=${encodeURIComponent(repository)}&baseCommit=${baseCommit}`;
144
+ const path = `${ONBOARDING_PATH}?repository=${encodeURIComponent(repository)}&baseCommit=${baseCommit}`
145
+ + (onboardRunId === null ? '' : `&onboardRunId=${encodeURIComponent(onboardRunId)}`);
144
146
  const response = await gatewayFetch(path, token);
145
147
  if (!response.ok)
146
148
  throw await classifyHttpError(response, `Haystack API ${ONBOARDING_PATH}`);
@@ -185,7 +187,9 @@ export async function waitForOnboarding(first, token, progress, resume) {
185
187
  await delay(ONBOARDING_READ_EVERY_MS);
186
188
  let next;
187
189
  try {
188
- next = await readOnboardingStatus(status.repository, status.baseCommit, token);
190
+ // The run this wait follows, not the base under whatever derivation is live: a release swap mid-wait otherwise reads
191
+ // not-started while the run goes on to admit this command's crawl (galaxy's n8n replays, 2026-10-03).
192
+ next = await readOnboardingStatus(status.repository, status.baseCommit, token, status.onboardRunId);
189
193
  }
190
194
  catch (error) {
191
195
  const why = transientReadFailure(error);
@@ -196,11 +196,11 @@ function deriveChangeTitle(gitRoot, baseSha, treeSha, commits, deadline) {
196
196
  }
197
197
  function slimInputHash() {
198
198
  // Mirrors front_half_cache_derive in blast-cache.sh for a slim bundle:
199
- // printf '%s\0%s\0%s\0%s\0%s\0' slim agent-deferred none none crawl-blast-v1.
199
+ // printf '%s\0%s\0%s\0%s\0%s\0' slim agent-deferred none none crawl-blast-groups-v2.
200
200
  // The fifth field (CRAWL-V1 rule 4) keeps bundles written before
201
201
  // crawl-blast.json existed from being restored for a crawl.
202
202
  return createHash('sha256')
203
- .update(Buffer.from('slim\0agent-deferred\0none\0none\0crawl-blast-v1\0'))
203
+ .update(Buffer.from('slim\0agent-deferred\0none\0none\0crawl-blast-groups-v2\0'))
204
204
  .digest('hex');
205
205
  }
206
206
  async function buildCompressedPatch(gitRoot, baseSha, workCommit, deadline) {
@@ -160,6 +160,19 @@ function checkSpot(value) {
160
160
  || (reached.page !== null && typeof reached.page !== 'string')))
161
161
  invalid('how a changed spot was reached');
162
162
  }
163
+ function checkPlanningCoverage(value) {
164
+ if (!isRecord(value) || !['groups', 'selectedIncidentPairs', 'unplannedIncidentPairs', 'proposedSituations', 'selectedSituations',
165
+ 'deferredSituations', 'unrealizedSituations', 'completedSituations', 'blockedSituations'].every(key => isCount(value[key]))
166
+ || typeof value.sourceGraphTruncated !== 'boolean' || !Array.isArray(value.unresolvedChanges))
167
+ invalid('its planning coverage');
168
+ const changes = new Set();
169
+ for (const item of value.unresolvedChanges) {
170
+ if (!isRecord(item) || typeof item.changeKey !== 'string' || !item.changeKey || typeof item.reason !== 'string' || !item.reason
171
+ || changes.has(item.changeKey))
172
+ invalid('its unresolved changes');
173
+ changes.add(item.changeKey);
174
+ }
175
+ }
163
176
  /** The published results' shape, shared by the sealed manifest and (amendment 9) an answer; `what` names which. */
164
177
  function checkResults(value, view, what) {
165
178
  if (!isRecord(value) || value.schemaVersion !== 1)
@@ -196,6 +209,8 @@ function checkResults(value, view, what) {
196
209
  || standIns.coverage.length > CRAWL_MAX_STAND_IN_ROWS || !standIns.coverage.every(isStandInRow)
197
210
  || !isCount(standIns.omittedRows) || !isStrings(standIns.gaps, CRAWL_MAX_STAND_IN_ROWS)))
198
211
  invalid('its outside-service coverage');
212
+ if (Object.hasOwn(reach, 'planning'))
213
+ checkPlanningCoverage(reach.planning);
199
214
  if (value.error !== null)
200
215
  checkError(value.error, 'its error');
201
216
  }
@@ -439,6 +454,17 @@ export function formatCrawl(view) {
439
454
  const blast = published.reach.blast;
440
455
  if (blast !== null)
441
456
  lines.push(` ${blast.ran} of ${plural(blast.functions, 'affected function')} ran.`);
457
+ const planning = published.reach.planning;
458
+ if (planning !== undefined) {
459
+ lines.push('', chalk.bold('Situations considered'), ` Considered ${plural(planning.groups, 'group')} of related behavior, with ${plural(planning.selectedIncidentPairs, 'possible failure pattern')} selected across them.`, ` ${planning.selectedSituations} of ${plural(planning.proposedSituations, 'proposed situation')} selected; ${planning.deferredSituations} deferred.`, ` Actions completed for ${plural(planning.completedSituations, 'situation')}; ${planning.blockedSituations} blocked during execution.`, ` Could not plan checks for ${plural(planning.unplannedIncidentPairs, 'selected failure pattern')}; ${plural(planning.unrealizedSituations, 'selected situation')} had no executable route.`, ' Completed actions do not establish that a situation is free of bugs.');
460
+ if (planning.sourceGraphTruncated)
461
+ lines.push(' The recorded code relationships were incomplete.');
462
+ if (planning.unresolvedChanges.length) {
463
+ lines.push(' Changes that could not be included in a behavior group:');
464
+ for (const change of planning.unresolvedChanges)
465
+ lines.push(` ${safe(change.changeKey)}: ${safe(change.reason)}`);
466
+ }
467
+ }
442
468
  // Amendment 13: calls to outside services the stand-ins could not serve: the copy's missing coverage, never a finding.
443
469
  const gaps = published.standIns?.gaps ?? [];
444
470
  if (gaps.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haystackeditor/cli",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "haystack verify: run your app with and without a change, and see what the change broke",
5
5
  "type": "module",
6
6
  "bin": {