@clipboard-health/ai-rules 2.15.3 → 2.15.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipboard-health/ai-rules",
3
- "version": "2.15.3",
3
+ "version": "2.15.4",
4
4
  "description": "Pre-built AI agent rules for consistent coding standards.",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toErrorMessage = toErrorMessage;
4
+ // Prefer stack over message for Error instances to preserve debugging context.
4
5
  function toErrorMessage(error) {
5
6
  return error instanceof Error ? (error.stack ?? error.message) : String(error);
6
7
  }
@@ -178,7 +178,7 @@ step(click "Submit") → network(POST /api/orders, 201) → step(waitForURL /con
178
178
  For each timeline entry:
179
179
 
180
180
  - **`kind: "step"`** — test action with `title`, `category`, `durationMs`, `depth`, optional `error`
181
- - **`kind: "network"`** — HTTP request with `method`, `url`, `status`, optional `durationMs`, `resourceType`, `traceId`, `failureText`, `wasAborted`
181
+ - **`kind: "network"`** — slimmed HTTP entry with `method`, `url`, `status`, and `networkId`. Resolve `networkId` against `attempts[].network.instances[]` for per-request detail (`durationMs`, `timings`, `traceId`/`spanId`/`requestId`/`correlationId`, `requestBodyRef`/`responseBodyRef`, redirect links), and against `attempts[].network.groups[instance.groupId]` for shared shape (`resourceType`, `failureText`, `wasAborted`, occurrence counts)
182
182
  - **`kind: "console"`** — browser message with `type` (warning/error/pageerror/page-closed/page-crashed) and `text`
183
183
 
184
184
  All entries share `offsetMs` (milliseconds since attempt start), giving a single temporal view.
@@ -216,11 +216,11 @@ For each attempt, compare `status`, `durationMs`, and `error` across retries —
216
216
 
217
217
  ### 4Ee: Inspect network activity and extract trace IDs
218
218
 
219
- Scan `network[]` for 4xx/5xx responses, `failureText`, and `wasAborted` near the failure's `offsetMs`. Use `timings` to isolate slow phases (DNS, connect, wait, receive).
219
+ Scan `attempts[].network.instances[]` for 4xx/5xx responses near the failure's `offsetMs` and use per-instance `timings` to isolate slow phases (DNS, connect, wait, receive). Join each instance to its group via `attempts[].network.groups[instance.groupId]` for shape-level signal (`failureText`, `wasAborted`, `resourceType`, `occurrenceCount`). Resolve payloads via `attempts[].network.bodies[instance.requestBodyRef | instance.responseBodyRef]` when the body matters.
220
220
 
221
- **`traceId`** — when present on a failing request, you must follow [`references/datadog-apm-traces.md`](./references/datadog-apm-traces.md) to correlate with backend behavior. This is the bridge between frontend test failure and potential backend root cause.
221
+ **`traceId`** — when present on a failing instance (`attempts[].network.instances[].traceId`), you must follow [`references/datadog-apm-traces.md`](./references/datadog-apm-traces.md) to correlate with backend behavior. This is the bridge between frontend test failure and potential backend root cause.
222
222
 
223
- If the `network[]` array is full (200 entries) but contains only static assets, the capture is saturated and the relevant API calls may have been dropped — note this as a confidence-reducing factor.
223
+ Check `attempts[].network.summary` for saturation. Non-zero `instancesDroppedByGroupCap`, `instancesDroppedByInstanceCap`, or `instancesEvictedAfterAdmission` means retained content is a sample and the request you care about may have been dropped — note this as a confidence-reducing factor. `instancesDroppedByFilter` alone is expected (static assets are filtered by design). v3 caps: instances 500, groups 200, bodies 100 per attempt.
224
224
 
225
225
  ### 4Ef: Review test steps
226
226
 
@@ -231,10 +231,10 @@ Prefer the timeline view (4Ea) which interleaves steps with network and console.
231
231
  Do not propose a fix without concrete artifacts. At minimum, include:
232
232
 
233
233
  - One **error artifact** — from `tests[].errors[]` (assertion diff, timeout message) or a trace/log entry
234
- - One **network artifact** — from `tests[].network[]` or `attempts[].network[]` (response status, timing, headers)
234
+ - One **network artifact** — an instance from `attempts[].network.instances[]` (status, timing, trace ids) joined to its group via `attempts[].network.groups[instance.groupId]` (shape, `failureText`/`wasAborted`, occurrence counts), plus the body via `attempts[].network.bodies[instance.requestBodyRef | instance.responseBodyRef]` when relevant
235
235
  - A **specific code path** that consumed that state — use `tests[].location` to jump to the source
236
236
  - When available: **screenshot** from `failureArtifacts.screenshotBase64` showing page state at failure
237
- - When available: **Datadog trace** via `network[].traceId` showing backend behavior for the failing request
237
+ - When available: **Datadog trace** via `attempts[].network.instances[].traceId` showing backend behavior for the failing request
238
238
  - A **confidence score** from 1 to 5 rating how certain you are in the root cause diagnosis
239
239
 
240
240
  ### Confidence Score
@@ -4,11 +4,12 @@ Fetch and display the full APM trace for a given trace ID, or look up a specific
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- The `pup` CLI must be installed and authenticated. Verify with:
7
+ The `pup` CLI must be installed and authenticated. Two auth paths are supported:
8
8
 
9
- ```bash
10
- pup auth status 2>/dev/null | jq '.status' # Should show: "valid"
11
- ```
9
+ - **macOS Keychain** (via `pup auth login`) — the default on developer machines.
10
+ - **Environment variables** (`DD_API_KEY` + `DD_APP_KEY`) the path used in sandboxes and CI.
11
+
12
+ **Do not run `pup auth status` to verify auth.** It only reads the Keychain, so it fails in sandboxes even when env-var auth is working. Call `pup traces search …` directly — env-var auth takes effect there. If the query fails with an auth error, surface it then (check `DD_API_KEY` / `DD_APP_KEY` or run `pup auth login`).
12
13
 
13
14
  ## Key pup conventions
14
15