@vitrinka/web 0.3.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @vitrinka/web
2
2
 
3
+ ## 0.3.1
4
+
5
+ - **A bug report always carries the current screen.** When a checkout
6
+ window went over the 4 MiB / 20 000-event cap on its own, it was dropped
7
+ and the buffer stayed empty until the next 30-second checkout; a report
8
+ opened in that gap (or before the first snapshot) froze a clip with no
9
+ rrweb window, so vitrinka rendered no stills, the board stayed empty and
10
+ the description never reached intake. Opening the report sheet now takes
11
+ a fresh checkout when the clip holds no snapshot, so the clip opens on at
12
+ least the current screen. A clip that already holds a window is frozen
13
+ as-is — a checkout would rotate its older window out.
14
+
3
15
  ## 0.3.0
4
16
 
5
17
  - **Report a bug, without a recording running.** A new ⋯ menu row. While
package/README.md CHANGED
@@ -180,7 +180,9 @@ buffer starts — scrubbed URLs, click text that never reads a value). Nothing
180
180
  of it is written to storage or sent until you press Send; a reload, an
181
181
  unlink or a recording start discards it.
182
182
 
183
- **The report.** The sheet freezes the last minute as it opens, asks what
183
+ **The report.** The sheet freezes the last minute as it opens (when that
184
+ holds no full snapshot — a window over a cap was dropped — it takes one of
185
+ the current screen first), asks what
184
186
  went wrong (required) and offers **Mark on screen** — annotate mode's
185
187
  element pick or region drag. Send files one short session under the pill's
186
188
  credential: title `Bug report: <first line>`, `meta.kind: "report"` and
@@ -15,7 +15,8 @@
15
15
  * - Caps: ≤ 4 MiB of serialized rrweb (each event measured at emit), ≤ 20 000
16
16
  * rrweb events, ≤ 500 lane events. Over an rrweb cap the older window goes;
17
17
  * a window over a cap on its own goes too, and buffering resumes at the
18
- * next checkout (a clip must open on a full snapshot).
18
+ * next checkout (a clip must open on a full snapshot) — or at the one a
19
+ * report takes when its clip holds none (report.ts `holdReport`).
19
20
  *
20
21
  * DOM-free and React-free: the rrweb lane (capture/rrweb.ts) feeds it.
21
22
  */
@@ -61,3 +62,5 @@ export declare function pushFlightEvent(kind: string, payload: Record<string, un
61
62
  }): string | null;
62
63
  /** A copy of what the buffer holds now (it keeps rolling); null when not buffering. */
63
64
  export declare function takeFlightClip(): FlightClip | null;
65
+ /** Does the clip hold a window that opens on a Meta + FullSnapshot — a screen to replay? */
66
+ export declare function clipHasSnapshot(clip: FlightClip): boolean;
@@ -3,6 +3,8 @@ export const FLIGHT_CHECKOUT_MS = 30_000;
3
3
  export const FLIGHT_MAX_RRWEB_BYTES = 4 * 1024 * 1024;
4
4
  export const FLIGHT_MAX_RRWEB_EVENTS = 20_000;
5
5
  export const FLIGHT_MAX_LANE_EVENTS = 500;
6
+ /** rrweb's `EventType.FullSnapshot`; `@rrweb/types` is type-only here, so the value. */
7
+ const RRWEB_FULL_SNAPSHOT = 2;
6
8
  const encoder = new TextEncoder();
7
9
  let active = false;
8
10
  /** Bumped on every start, so a capture begun in one buffer never lands in the next. */
@@ -91,3 +93,7 @@ export function takeFlightClip() {
91
93
  lanes: lanes.slice(),
92
94
  };
93
95
  }
96
+ /** Does the clip hold a window that opens on a Meta + FullSnapshot — a screen to replay? */
97
+ export function clipHasSnapshot(clip) {
98
+ return clip.windows.some((w) => w.events[1]?.type === RRWEB_FULL_SNAPSHOT);
99
+ }
@@ -1,7 +1,8 @@
1
1
  import { api, fetchPolicy, uploadChunk } from './api';
2
2
  import { setRedactionPolicy } from './capture/redact';
3
+ import { checkoutRRWeb } from './capture/rrweb';
3
4
  import { recorderConfig, vitrinkaLinked } from './config';
4
- import { flightActive, startFlightBuffer, stopFlightBuffer, takeFlightClip } from './flight';
5
+ import { clipHasSnapshot, flightActive, startFlightBuffer, stopFlightBuffer, takeFlightClip } from './flight';
5
6
  import { EVENTS_PER_POST, getState, MAX_BATCH_BYTES, splitRRWebEvents, utf8Bytes } from './queue';
6
7
  import { noteRecent } from './recents';
7
8
  import { addAnnotation, createSession, imagePixels } from './session';
@@ -74,7 +75,20 @@ let sending = false;
74
75
  export function holdReport(on) {
75
76
  if (!sending)
76
77
  job = null;
77
- held = on && getState() === null ? takeFlightClip() : null;
78
+ let clip = on && getState() === null ? takeFlightClip() : null;
79
+ // No window to replay — a window over a cap was dropped and the next 30 s
80
+ // checkout has not come, or the first snapshot never did. The server
81
+ // renders stills only from rrweb, so such a report would reach no board
82
+ // and its annotation no intake. Take a checkout now (rrweb emits it
83
+ // synchronously into the buffer) so the clip carries at least the current
84
+ // screen. Never when a window is held: a checkout rotates the older one out
85
+ // and would shrink a good clip. With rrweb not running the checkout is a
86
+ // no-op and the report still sends, without a DOM recording.
87
+ if (clip && !clipHasSnapshot(clip)) {
88
+ checkoutRRWeb();
89
+ clip = takeFlightClip();
90
+ }
91
+ held = clip;
78
92
  }
79
93
  const TITLE_LINE_CAP = 100;
80
94
  function reportTitle(text) {
@@ -17,8 +17,8 @@ import { type SessionState } from './queue';
17
17
  export { currentRoute, notify, subscribe } from './state';
18
18
  export type { SessionDone } from '../protocol';
19
19
  /** Sent as `meta.recorder`; bumped with the package version. */
20
- export declare const RECORDER_VERSION = "0.3.0";
21
- export declare const RECORDER_ID = "web/0.3.0";
20
+ export declare const RECORDER_VERSION = "0.3.1";
21
+ export declare const RECORDER_ID = "web/0.3.1";
22
22
  /** What `POST /api/v1/sessions` answers (the fields this recorder keeps). */
23
23
  export interface SessionOut {
24
24
  id: string;
@@ -6,7 +6,7 @@ import { noteRecent, updateRecent } from './recents';
6
6
  import { currentRoute, notify } from './state';
7
7
  export { currentRoute, notify, subscribe } from './state';
8
8
  /** Sent as `meta.recorder`; bumped with the package version. */
9
- export const RECORDER_VERSION = '0.3.0';
9
+ export const RECORDER_VERSION = '0.3.1';
10
10
  export const RECORDER_ID = `web/${RECORDER_VERSION}`;
11
11
  /**
12
12
  * Re-apply a RECOVERED session's redaction policy after a reload — and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrinka/web",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "vitrinka toolkit for React DOM apps — the journey recorder: capture manual-testing sessions (rrweb DOM stream, clicks, navigation, network, console, notes) straight into vitrinka boards.",
5
5
  "license": "Elastic-2.0",
6
6
  "repository": {