@regressionbot/sdk 2.5.1 → 2.7.0

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/README.md CHANGED
@@ -38,6 +38,34 @@ npm install @regressionbot/sdk
38
38
 
39
39
  ## Migration from 1.x
40
40
 
41
+ ### 2.7.0
42
+
43
+ Needs API 2.10.0 or later for `fidelity`/`scopeNote` to be populated. On an older API these
44
+ fields are simply absent.
45
+
46
+ - **`fidelity`**, on a project (`ProjectConfig`, `ProjectConfigUpdate`), a run's options
47
+ (`runProject()`, `JobBuilder.fidelity()`) and a result (`PageResult`, `JobStatus`,
48
+ `JobSummary`). `'low'` is a fast content-only check against another live site — no
49
+ screenshot, no stored baseline — [about 3-7s a page instead of up to 50s](https://regressionbot.com/docs/workflows/quick-check).
50
+ `'high'` (the default) is today's full capture. Omitted on a run, the project's own
51
+ fidelity is used.
52
+ - **`scopeNote`**, on `JobStatus` and `JobSummary`: on a low-fidelity run, what it compared
53
+ and what it did not look at. Quote it with a quiet result.
54
+
55
+ ### 2.6.0
56
+
57
+ - **`ProjectConfig.startFailureAlertedAt`** — when the owners were last told a scheduled run
58
+ could not be started, so a lapsed plan isn't mailed about it again every hour.
59
+ - **`approve()`, `approvePage()` and `rejectPage()` type `warning`, `note` and (one page only)
60
+ `baselineAdvanced` and the echoed `url`/`variantName`.** The API has always sent these when
61
+ there was no stored baseline to advance into; only the type was missing them.
62
+ - **`JobStatus.intentProvided` is no longer optional.** The API always computes it; this was a
63
+ type-accuracy fix, not a behavior change.
64
+ - **`generateAiSummary()` and `JobAiSummary` are now marked `@deprecated`.** There is no
65
+ production endpoint behind `POST /job/{jobId}/ai-summary` — the AI-summary Lambda is invoked
66
+ only internally by the run pipeline, so this call has always thrown a 404. Summaries are
67
+ generated automatically and asynchronously; read them from `getSummary()`.
68
+
41
69
  2.0.0 re-types the SDK against what the API actually returns, taken from the
42
70
  orchestrator's implementation rather than from a spec that had drifted in both
43
71
  directions. Most of the breakage is caught by the compiler. One is not:
@@ -290,12 +318,12 @@ if (summary.regressions.length > 0) {
290
318
  }
291
319
  }
292
320
  }
293
-
294
- // Or trigger RegressionBot summary generation on-demand for a completed job:
295
- const aiResult = await job.generateAiSummary();
296
- console.log(`Generated summaries for ${aiResult.summaries.length} regressions.`);
297
321
  ```
298
322
 
323
+ `generateAiSummary()` is deprecated and does not work against the current API — there is no
324
+ on-demand endpoint. Summaries are always generated automatically; wait for them with
325
+ `{ waitForSummaries: true }` as above.
326
+
299
327
  ### Reading exactly what changed
300
328
 
301
329
  `changes` is computed by diffing the two documents, so unlike the prose summary it is
package/dist/index.d.ts CHANGED
@@ -50,6 +50,12 @@ export declare class RegressionBot {
50
50
  autoApprove?: boolean;
51
51
  /** What this run is testing, used to judge whether changes were intended. */
52
52
  runContext?: RunContext;
53
+ /**
54
+ * `high` (default): today's capture, with screenshots. `low`: a fast content
55
+ * check — no screenshot, only content changes count, needs `baseOrigin`, and
56
+ * stores no baseline. Omitted, the project's fidelity is used.
57
+ */
58
+ fidelity?: 'low' | 'high';
53
59
  }): Promise<JobHandle>;
54
60
  /**
55
61
  * Update the configuration settings for a named project.
@@ -101,6 +107,12 @@ export declare class JobBuilder {
101
107
  * Merges with anything set by an earlier call.
102
108
  */
103
109
  withContext(context: RunContext): this;
110
+ /**
111
+ * `high` (default): today's capture, with screenshots. `low`: a fast content check —
112
+ * no screenshot, only content changes count, needs `.against()`, and stores no
113
+ * baseline. Left unset, the project's fidelity is used.
114
+ */
115
+ fidelity(value: 'low' | 'high'): this;
104
116
  /**
105
117
  * Compiles the manifest and triggers the API.
106
118
  */
@@ -130,6 +142,10 @@ export declare class JobHandle {
130
142
  private decidePage;
131
143
  /**
132
144
  * Generate AI summaries on-demand for all regressions in a completed job.
145
+ *
146
+ * @deprecated No production endpoint backs this — `POST /job/{jobId}/ai-summary` is not
147
+ * attached to the API Gateway, so this throws a 404. RegressionBot summaries are generated
148
+ * automatically and asynchronously; read them from `getSummary()` once the job completes.
133
149
  */
134
150
  generateAiSummary(): Promise<JobAiSummary>;
135
151
  /**
package/dist/index.js CHANGED
@@ -170,6 +170,15 @@ class JobBuilder {
170
170
  this.manifest.runContext = { ...this.manifest.runContext, ...context };
171
171
  return this;
172
172
  }
173
+ /**
174
+ * `high` (default): today's capture, with screenshots. `low`: a fast content check —
175
+ * no screenshot, only content changes count, needs `.against()`, and stores no
176
+ * baseline. Left unset, the project's fidelity is used.
177
+ */
178
+ fidelity(value) {
179
+ this.manifest.fidelity = value;
180
+ return this;
181
+ }
173
182
  /**
174
183
  * Compiles the manifest and triggers the API.
175
184
  */
@@ -193,7 +202,8 @@ class JobBuilder {
193
202
  autoApprove: this.manifest.autoApprove,
194
203
  masks: this.manifest.masks,
195
204
  customCss: this.manifest.customCss,
196
- runContext: this.manifest.runContext
205
+ runContext: this.manifest.runContext,
206
+ fidelity: this.manifest.fidelity
197
207
  };
198
208
  const res = await this.sdk._request('/crawl', 'POST', payload);
199
209
  return new JobHandle(this.sdk, res.jobId);
@@ -268,6 +278,10 @@ class JobHandle {
268
278
  }
269
279
  /**
270
280
  * Generate AI summaries on-demand for all regressions in a completed job.
281
+ *
282
+ * @deprecated No production endpoint backs this — `POST /job/{jobId}/ai-summary` is not
283
+ * attached to the API Gateway, so this throws a 404. RegressionBot summaries are generated
284
+ * automatically and asynchronously; read them from `getSummary()` once the job completes.
271
285
  */
272
286
  async generateAiSummary() {
273
287
  return this.sdk._request(`/job/${encodeURIComponent(this.jobId)}/ai-summary`, 'POST');
package/dist/types.d.ts CHANGED
@@ -47,6 +47,8 @@ export interface ProjectConfig {
47
47
  masks?: string[];
48
48
  /** CSS injected before screenshotting, to hide dynamic widgets. Max 4096 characters. */
49
49
  customCss?: string;
50
+ /** `low` when the project captures in low fidelity by default. Absent means high. */
51
+ fidelity?: 'low';
50
52
  /** Presence flag only — the stored credential is never returned. */
51
53
  testAuth?: {
52
54
  configured: true;
@@ -79,6 +81,11 @@ export interface ProjectConfig {
79
81
  * summaries are skipped for those runs.
80
82
  */
81
83
  scheduleKeyId?: string;
84
+ /**
85
+ * When the owners were last told this project's scheduled run could not be started.
86
+ * Keeps a lapsed plan from mailing them once an hour.
87
+ */
88
+ startFailureAlertedAt?: string;
82
89
  /** When the scheduler last started a run. The next run is due one interval after this. */
83
90
  lastScheduledRunAt?: string;
84
91
  /** The standing intent scheduled runs are judged against. Absent means scheduled runs are not judged. */
@@ -125,6 +132,12 @@ export interface ProjectConfigUpdate {
125
132
  masks?: string[];
126
133
  /** Max 4096 characters. */
127
134
  customCss?: string;
135
+ /**
136
+ * The fidelity this project's runs capture at unless a run says otherwise. `high`
137
+ * (default) clears it. `low` needs the project's `baseOrigin`. Low fidelity stores no
138
+ * baseline, so changing it invalidates nothing.
139
+ */
140
+ fidelity?: 'low' | 'high';
128
141
  /** Credentials for the test origin's environment gate. Pass null to clear. */
129
142
  testAuth?: EnvGate | null;
130
143
  /** Credentials for the base origin's environment gate. Pass null to clear. */
@@ -377,6 +390,12 @@ export interface PageResult {
377
390
  url: string;
378
391
  /** Whether the capture and comparison succeeded. */
379
392
  status: 'SUCCESS' | 'ERROR';
393
+ /**
394
+ * `low` on a low-fidelity result: no screenshot was taken, and only content changes
395
+ * count. `currentUrl` and `baselineUrl` are pictures drawn from the page copies on a
396
+ * changed page, and null otherwise. Absent means high.
397
+ */
398
+ fidelity?: 'low';
380
399
  /** Device variant tested (e.g. "Desktop Chrome", "iPhone 12"). */
381
400
  variantName: string;
382
401
  /**
@@ -508,10 +527,14 @@ export interface JobStatus {
508
527
  baseOrigin?: string;
509
528
  executionTime: number;
510
529
  createdAt: string;
511
- /** Whether the run carried an intent. Without one no page gets a verdict. */
512
- intentProvided?: boolean;
530
+ /** Whether the run carried an intent. Without one no page gets a verdict. Always computed. */
531
+ intentProvided: boolean;
513
532
  /** Whether this run compared two live origins or one origin against a stored baseline. */
514
533
  comparisonMode?: 'live-vs-live' | 'managed';
534
+ /** `low` on a low-fidelity run. Absent means high. */
535
+ fidelity?: 'low';
536
+ /** On a low-fidelity run: what it compared and what it did not look at. Quote it with a quiet result. */
537
+ scopeNote?: string;
515
538
  /** Page-checks the run made, and how many finished. Mirrors `progress`. */
516
539
  totalUrls?: number;
517
540
  completedCount?: number;
@@ -524,6 +547,10 @@ export interface JobSummary {
524
547
  environment?: string;
525
548
  /** Live-vs-live runs only: the environment of the base origin. Absent otherwise. */
526
549
  baseEnvironment?: string;
550
+ /** `low` on a low-fidelity run. Absent means high. */
551
+ fidelity?: 'low';
552
+ /** On a low-fidelity run: what it compared and what it did not look at. Quote it with a quiet result. */
553
+ scopeNote?: string;
527
554
  /** getSummary() throws until the job reaches one of these. */
528
555
  status: 'COMPLETED' | 'APPROVED' | 'RESOLVED' | 'FAILED';
529
556
  summaryStatus: SummaryStatus;
@@ -620,7 +647,21 @@ export interface ApproveResult {
620
647
  conflictedUrls?: string[];
621
648
  /** One page only: what approvePage or rejectPage wrote on that page's result. */
622
649
  triageStatus?: 'APPROVED' | 'REJECTED';
650
+ /** Set when there was no stored baseline to advance into — the decision was still recorded. */
651
+ warning?: 'NO_BASELINE';
652
+ /** Explains `warning` when present. */
653
+ note?: string;
654
+ /** One page only, and only when `warning` is `'NO_BASELINE'`: always `false`. */
655
+ baselineAdvanced?: boolean;
656
+ /** One page only: echoes the page that was decided. */
657
+ url?: string;
658
+ /** One page only: echoes the page that was decided. */
659
+ variantName?: string;
623
660
  }
661
+ /** @deprecated No production endpoint backs this. The AI-summary Lambda is invoked only
662
+ * internally by the run pipeline and is never attached to the API Gateway, so
663
+ * `generateAiSummary()` gets a 404. RegressionBot summaries are generated automatically and
664
+ * asynchronously — read them from `getSummary()` once the job completes. */
624
665
  export interface JobAiSummary {
625
666
  message: string;
626
667
  jobId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regressionbot/sdk",
3
- "version": "2.5.1",
3
+ "version": "2.7.0",
4
4
  "description": "The official SDK for regressionbot.com - the simplest way to automate visual regression testing.",
5
5
  "homepage": "https://regressionbot.com",
6
6
  "repository": {