@riddledc/riddle-proof 0.7.110 → 0.7.112

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.
@@ -654,6 +654,48 @@ function normalizeNetworkMocks(value) {
654
654
  if (!Array.isArray(value)) throw new Error("target.network_mocks must be an array.");
655
655
  return value.map(normalizeNetworkMock);
656
656
  }
657
+ function profileStringList(value) {
658
+ return Array.isArray(value) ? value.map((item) => String(item)).filter(Boolean) : [];
659
+ }
660
+ function responseHasRequestBodyContract(response) {
661
+ if (!response) return false;
662
+ return profileStringList(response.request_body_contains).length > 0 || profileStringList(response.request_body_patterns).length > 0 || profileStringList(response.request_body_not_contains).length > 0 || profileStringList(response.request_body_not_patterns).length > 0;
663
+ }
664
+ function responseHasOnlyPositiveTextSelector(response) {
665
+ if (!response) return false;
666
+ return profileStringList(response.request_body_contains).length > 0 && profileStringList(response.request_body_patterns).length === 0 && profileStringList(response.request_body_not_contains).length === 0 && profileStringList(response.request_body_not_patterns).length === 0;
667
+ }
668
+ function responseMayShadowLaterRequestBodyMatch(earlier, later) {
669
+ if (!responseHasOnlyPositiveTextSelector(earlier) || !responseHasRequestBodyContract(later)) return false;
670
+ const earlierContains = profileStringList(earlier.request_body_contains);
671
+ const laterContains = profileStringList(later.request_body_contains);
672
+ if (!laterContains.length) return false;
673
+ return earlierContains.every((fragment) => laterContains.includes(fragment));
674
+ }
675
+ function responseLabel(response, index) {
676
+ return response.label ? `"${response.label}"` : `responses[${index}]`;
677
+ }
678
+ function collectRiddleProofProfileWarnings(profile) {
679
+ const warnings = [];
680
+ for (const [mockIndex, mock] of (profile.target.network_mocks || []).entries()) {
681
+ const responses = Array.isArray(mock.responses) ? mock.responses : [];
682
+ if (responses.length < 2) continue;
683
+ for (let laterIndex = 1; laterIndex < responses.length; laterIndex += 1) {
684
+ const later = responses[laterIndex];
685
+ if (!responseHasRequestBodyContract(later)) continue;
686
+ for (let earlierIndex = 0; earlierIndex < laterIndex; earlierIndex += 1) {
687
+ const earlier = responses[earlierIndex];
688
+ if (!responseMayShadowLaterRequestBodyMatch(earlier, later)) continue;
689
+ const mockLabel = mock.label ? ` (${mock.label})` : "";
690
+ warnings.push(
691
+ `target.network_mocks[${mockIndex}]${mockLabel} ${responseLabel(earlier, earlierIndex)} can shadow ${responseLabel(later, laterIndex)} because the earlier request_body_contains fragments are a subset of the later response and have no negative or pattern disambiguator. First matching request-body response wins.`
692
+ );
693
+ break;
694
+ }
695
+ }
696
+ }
697
+ return warnings;
698
+ }
657
699
  function normalizeRouteInventoryPath(value, label) {
658
700
  const path = stringValue(value);
659
701
  if (!path) throw new Error(`${label} requires path.`);
@@ -2042,11 +2084,11 @@ function networkMockResponseHitsByLabel(events) {
2042
2084
  for (const event of events) {
2043
2085
  if (!event || event.ok === false) continue;
2044
2086
  const label = typeof event.label === "string" ? event.label : "";
2045
- const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
2046
- const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
2047
- if (!label || !responseLabel || !hasSequenceResponse) continue;
2087
+ const responseLabel2 = typeof event.response_label === "string" ? event.response_label : "";
2088
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel2 && responseLabel2 !== label);
2089
+ if (!label || !responseLabel2 || !hasSequenceResponse) continue;
2048
2090
  responseHits[label] || (responseHits[label] = {});
2049
- responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
2091
+ responseHits[label][responseLabel2] = (responseHits[label][responseLabel2] || 0) + 1;
2050
2092
  }
2051
2093
  return responseHits;
2052
2094
  }
@@ -2069,6 +2111,7 @@ function profileStatusFromEvidence(profile, evidence, checks) {
2069
2111
  }
2070
2112
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
2071
2113
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
2114
+ const warnings = collectRiddleProofProfileWarnings(profile);
2072
2115
  const checks = evidence ? [
2073
2116
  assessNetworkMocksFromEvidence(profile, evidence),
2074
2117
  assessSetupActionsFromEvidence(profile, evidence),
@@ -2094,6 +2137,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
2094
2137
  checks,
2095
2138
  summary: summarizeRiddleProofProfileResult({ profile_name: profile.name, status, checks, viewports: evidence?.viewports || [] }),
2096
2139
  captured_at: capturedAt,
2140
+ warnings: warnings.length ? warnings : void 0,
2097
2141
  evidence,
2098
2142
  riddle: options.riddle
2099
2143
  };
@@ -2142,6 +2186,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
2142
2186
  function createRiddleProofProfileEnvironmentBlockedResult(input) {
2143
2187
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
2144
2188
  const environmentBlocker = extractRiddleRunnerBlocker(message);
2189
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
2145
2190
  return {
2146
2191
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
2147
2192
  profile_name: input.profile.name,
@@ -2153,6 +2198,7 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
2153
2198
  checks: [],
2154
2199
  summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
2155
2200
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2201
+ warnings: warnings.length ? warnings : void 0,
2156
2202
  riddle: input.riddle,
2157
2203
  environment_blocker: environmentBlocker,
2158
2204
  error: message
@@ -2211,6 +2257,7 @@ function summarizeEnvironmentBlockedRunner(profileName, blocker) {
2211
2257
  }
2212
2258
  function createRiddleProofProfileInsufficientResult(input) {
2213
2259
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
2260
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
2214
2261
  return {
2215
2262
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
2216
2263
  profile_name: input.profile.name,
@@ -2222,6 +2269,7 @@ function createRiddleProofProfileInsufficientResult(input) {
2222
2269
  checks: [],
2223
2270
  summary: `${input.profile.name} did not produce enough evidence for a profile judgment.`,
2224
2271
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2272
+ warnings: warnings.length ? warnings : void 0,
2225
2273
  riddle: input.riddle,
2226
2274
  error: message
2227
2275
  };
@@ -3528,6 +3576,7 @@ function assessProfile(profile, evidence) {
3528
3576
  checks,
3529
3577
  summary,
3530
3578
  captured_at: evidence.captured_at,
3579
+ warnings: profileWarnings.length ? profileWarnings : undefined,
3531
3580
  evidence,
3532
3581
  };
3533
3582
  }
@@ -3536,11 +3585,14 @@ function assessProfile(profile, evidence) {
3536
3585
  function buildRiddleProofProfileScript(profile) {
3537
3586
  const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
3538
3587
  const slug = slugifyRiddleProofProfileName(profile.name);
3588
+ const profileWarnings = collectRiddleProofProfileWarnings(profile);
3539
3589
  const serializableProfile = JSON.stringify(profile);
3590
+ const serializableProfileWarnings = JSON.stringify(profileWarnings);
3540
3591
  const serializableTargetUrl = JSON.stringify(targetUrl);
3541
3592
  const serializableSlug = JSON.stringify(slug);
3542
3593
  return String.raw`
3543
3594
  const profile = ${serializableProfile};
3595
+ const profileWarnings = ${serializableProfileWarnings};
3544
3596
  const targetUrl = ${serializableTargetUrl};
3545
3597
  const profileSlug = ${serializableSlug};
3546
3598
  const capturedAt = new Date().toISOString();
@@ -5668,6 +5720,7 @@ export {
5668
5720
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
5669
5721
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
5670
5722
  slugifyRiddleProofProfileName,
5723
+ collectRiddleProofProfileWarnings,
5671
5724
  normalizeRiddleProofProfile,
5672
5725
  resolveRiddleProofProfileTargetUrl,
5673
5726
  resolveRiddleProofProfileTimeoutSec,
package/dist/cli.cjs CHANGED
@@ -7547,6 +7547,48 @@ function normalizeNetworkMocks(value) {
7547
7547
  if (!Array.isArray(value)) throw new Error("target.network_mocks must be an array.");
7548
7548
  return value.map(normalizeNetworkMock);
7549
7549
  }
7550
+ function profileStringList(value) {
7551
+ return Array.isArray(value) ? value.map((item) => String(item)).filter(Boolean) : [];
7552
+ }
7553
+ function responseHasRequestBodyContract(response) {
7554
+ if (!response) return false;
7555
+ return profileStringList(response.request_body_contains).length > 0 || profileStringList(response.request_body_patterns).length > 0 || profileStringList(response.request_body_not_contains).length > 0 || profileStringList(response.request_body_not_patterns).length > 0;
7556
+ }
7557
+ function responseHasOnlyPositiveTextSelector(response) {
7558
+ if (!response) return false;
7559
+ return profileStringList(response.request_body_contains).length > 0 && profileStringList(response.request_body_patterns).length === 0 && profileStringList(response.request_body_not_contains).length === 0 && profileStringList(response.request_body_not_patterns).length === 0;
7560
+ }
7561
+ function responseMayShadowLaterRequestBodyMatch(earlier, later) {
7562
+ if (!responseHasOnlyPositiveTextSelector(earlier) || !responseHasRequestBodyContract(later)) return false;
7563
+ const earlierContains = profileStringList(earlier.request_body_contains);
7564
+ const laterContains = profileStringList(later.request_body_contains);
7565
+ if (!laterContains.length) return false;
7566
+ return earlierContains.every((fragment) => laterContains.includes(fragment));
7567
+ }
7568
+ function responseLabel(response, index) {
7569
+ return response.label ? `"${response.label}"` : `responses[${index}]`;
7570
+ }
7571
+ function collectRiddleProofProfileWarnings(profile) {
7572
+ const warnings = [];
7573
+ for (const [mockIndex, mock] of (profile.target.network_mocks || []).entries()) {
7574
+ const responses = Array.isArray(mock.responses) ? mock.responses : [];
7575
+ if (responses.length < 2) continue;
7576
+ for (let laterIndex = 1; laterIndex < responses.length; laterIndex += 1) {
7577
+ const later = responses[laterIndex];
7578
+ if (!responseHasRequestBodyContract(later)) continue;
7579
+ for (let earlierIndex = 0; earlierIndex < laterIndex; earlierIndex += 1) {
7580
+ const earlier = responses[earlierIndex];
7581
+ if (!responseMayShadowLaterRequestBodyMatch(earlier, later)) continue;
7582
+ const mockLabel = mock.label ? ` (${mock.label})` : "";
7583
+ warnings.push(
7584
+ `target.network_mocks[${mockIndex}]${mockLabel} ${responseLabel(earlier, earlierIndex)} can shadow ${responseLabel(later, laterIndex)} because the earlier request_body_contains fragments are a subset of the later response and have no negative or pattern disambiguator. First matching request-body response wins.`
7585
+ );
7586
+ break;
7587
+ }
7588
+ }
7589
+ }
7590
+ return warnings;
7591
+ }
7550
7592
  function normalizeRouteInventoryPath(value, label) {
7551
7593
  const path7 = stringValue2(value);
7552
7594
  if (!path7) throw new Error(`${label} requires path.`);
@@ -8935,11 +8977,11 @@ function networkMockResponseHitsByLabel(events) {
8935
8977
  for (const event of events) {
8936
8978
  if (!event || event.ok === false) continue;
8937
8979
  const label = typeof event.label === "string" ? event.label : "";
8938
- const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
8939
- const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
8940
- if (!label || !responseLabel || !hasSequenceResponse) continue;
8980
+ const responseLabel2 = typeof event.response_label === "string" ? event.response_label : "";
8981
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel2 && responseLabel2 !== label);
8982
+ if (!label || !responseLabel2 || !hasSequenceResponse) continue;
8941
8983
  responseHits[label] || (responseHits[label] = {});
8942
- responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
8984
+ responseHits[label][responseLabel2] = (responseHits[label][responseLabel2] || 0) + 1;
8943
8985
  }
8944
8986
  return responseHits;
8945
8987
  }
@@ -8962,6 +9004,7 @@ function profileStatusFromEvidence(profile, evidence, checks) {
8962
9004
  }
8963
9005
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
8964
9006
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
9007
+ const warnings = collectRiddleProofProfileWarnings(profile);
8965
9008
  const checks = evidence ? [
8966
9009
  assessNetworkMocksFromEvidence(profile, evidence),
8967
9010
  assessSetupActionsFromEvidence(profile, evidence),
@@ -8987,6 +9030,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
8987
9030
  checks,
8988
9031
  summary: summarizeRiddleProofProfileResult({ profile_name: profile.name, status, checks, viewports: evidence?.viewports || [] }),
8989
9032
  captured_at: capturedAt,
9033
+ warnings: warnings.length ? warnings : void 0,
8990
9034
  evidence,
8991
9035
  riddle: options.riddle
8992
9036
  };
@@ -9019,6 +9063,7 @@ function profileStatusExitCode(profile, status) {
9019
9063
  function createRiddleProofProfileEnvironmentBlockedResult(input) {
9020
9064
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
9021
9065
  const environmentBlocker = extractRiddleRunnerBlocker(message);
9066
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
9022
9067
  return {
9023
9068
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
9024
9069
  profile_name: input.profile.name,
@@ -9030,6 +9075,7 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
9030
9075
  checks: [],
9031
9076
  summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
9032
9077
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
9078
+ warnings: warnings.length ? warnings : void 0,
9033
9079
  riddle: input.riddle,
9034
9080
  environment_blocker: environmentBlocker,
9035
9081
  error: message
@@ -9088,6 +9134,7 @@ function summarizeEnvironmentBlockedRunner(profileName, blocker) {
9088
9134
  }
9089
9135
  function createRiddleProofProfileInsufficientResult(input) {
9090
9136
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
9137
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
9091
9138
  return {
9092
9139
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
9093
9140
  profile_name: input.profile.name,
@@ -9099,6 +9146,7 @@ function createRiddleProofProfileInsufficientResult(input) {
9099
9146
  checks: [],
9100
9147
  summary: `${input.profile.name} did not produce enough evidence for a profile judgment.`,
9101
9148
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
9149
+ warnings: warnings.length ? warnings : void 0,
9102
9150
  riddle: input.riddle,
9103
9151
  error: message
9104
9152
  };
@@ -10405,6 +10453,7 @@ function assessProfile(profile, evidence) {
10405
10453
  checks,
10406
10454
  summary,
10407
10455
  captured_at: evidence.captured_at,
10456
+ warnings: profileWarnings.length ? profileWarnings : undefined,
10408
10457
  evidence,
10409
10458
  };
10410
10459
  }
@@ -10413,11 +10462,14 @@ function assessProfile(profile, evidence) {
10413
10462
  function buildRiddleProofProfileScript(profile) {
10414
10463
  const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
10415
10464
  const slug = slugifyRiddleProofProfileName(profile.name);
10465
+ const profileWarnings = collectRiddleProofProfileWarnings(profile);
10416
10466
  const serializableProfile = JSON.stringify(profile);
10467
+ const serializableProfileWarnings = JSON.stringify(profileWarnings);
10417
10468
  const serializableTargetUrl = JSON.stringify(targetUrl);
10418
10469
  const serializableSlug = JSON.stringify(slug);
10419
10470
  return String.raw`
10420
10471
  const profile = ${serializableProfile};
10472
+ const profileWarnings = ${serializableProfileWarnings};
10421
10473
  const targetUrl = ${serializableTargetUrl};
10422
10474
  const profileSlug = ${serializableSlug};
10423
10475
  const capturedAt = new Date().toISOString();
@@ -12824,10 +12876,17 @@ function profileResultMarkdown(result) {
12824
12876
  `Captured: ${result.captured_at}`,
12825
12877
  "",
12826
12878
  result.summary,
12827
- "",
12828
- "## Checks",
12829
12879
  ""
12830
12880
  ];
12881
+ if (Array.isArray(result.warnings) && result.warnings.length) {
12882
+ lines.push("## Profile Warnings", "");
12883
+ for (const warning of result.warnings.slice(0, 12)) {
12884
+ lines.push(`- ${warning}`);
12885
+ }
12886
+ if (result.warnings.length > 12) lines.push(`- ${result.warnings.length - 12} additional warning(s) omitted.`);
12887
+ lines.push("");
12888
+ }
12889
+ lines.push("## Checks", "");
12831
12890
  for (const check of result.checks) {
12832
12891
  lines.push(`- ${check.status}: ${profileCheckMarkdownLabel(check)}`);
12833
12892
  if (check.message) lines.push(` ${check.message}`);
@@ -12951,7 +13010,14 @@ function profileCheckMarkdownTarget(check) {
12951
13010
  return maxOverflow !== void 0 ? `<= ${maxOverflow}px` : void 0;
12952
13011
  }
12953
13012
  if (check.type === "no_fatal_console_errors") {
12954
- return "0 unallowed fatal errors";
13013
+ const fatalCount = cliFiniteNumber(evidence.console_fatal_count) ?? cliFiniteNumber(evidence.fatal_error_count) ?? 0;
13014
+ const totalConsoleCount = cliFiniteNumber(evidence.total_console_fatal_count);
13015
+ const allowedConsoleCount = cliFiniteNumber(evidence.allowed_console_fatal_count);
13016
+ const parts = [`${fatalCount} unallowed fatal error${fatalCount === 1 ? "" : "s"}`];
13017
+ if (totalConsoleCount !== void 0 && allowedConsoleCount !== void 0) {
13018
+ parts.push(`${allowedConsoleCount}/${totalConsoleCount} console fatal allowed`);
13019
+ }
13020
+ return parts.join(", ");
12955
13021
  }
12956
13022
  if (check.type === "no_console_warnings") {
12957
13023
  const warningCount = cliFiniteNumber(evidence.console_warning_count) ?? 0;
@@ -13095,7 +13161,7 @@ function profileNetworkMockSummaryMarkdown(result) {
13095
13161
  const responseHits = cliRecord(responseHitsByLabel[label]);
13096
13162
  const responseLabels = responseHits ? Object.keys(responseHits).sort() : [];
13097
13163
  if (responseHits && responseLabels.length) {
13098
- const responseParts = responseLabels.slice(0, 8).map((responseLabel) => `${responseLabel} ${cliRecordNumber(responseHits, responseLabel) ?? 0}`);
13164
+ const responseParts = responseLabels.slice(0, 8).map((responseLabel2) => `${responseLabel2} ${cliRecordNumber(responseHits, responseLabel2) ?? 0}`);
13099
13165
  const omitted = responseLabels.length > 8 ? `; ${responseLabels.length - 8} additional response label(s) omitted` : "";
13100
13166
  lines.push(`- ${label} responses: ${responseParts.join("; ")}${omitted}`);
13101
13167
  }
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  profileStatusExitCode,
11
11
  resolveRiddleProofProfileTargetUrl,
12
12
  resolveRiddleProofProfileTimeoutSec
13
- } from "./chunk-KKH76HIA.js";
13
+ } from "./chunk-2ZZS7RD5.js";
14
14
  import {
15
15
  createRiddleApiClient,
16
16
  parseRiddleViewport
@@ -322,10 +322,17 @@ function profileResultMarkdown(result) {
322
322
  `Captured: ${result.captured_at}`,
323
323
  "",
324
324
  result.summary,
325
- "",
326
- "## Checks",
327
325
  ""
328
326
  ];
327
+ if (Array.isArray(result.warnings) && result.warnings.length) {
328
+ lines.push("## Profile Warnings", "");
329
+ for (const warning of result.warnings.slice(0, 12)) {
330
+ lines.push(`- ${warning}`);
331
+ }
332
+ if (result.warnings.length > 12) lines.push(`- ${result.warnings.length - 12} additional warning(s) omitted.`);
333
+ lines.push("");
334
+ }
335
+ lines.push("## Checks", "");
329
336
  for (const check of result.checks) {
330
337
  lines.push(`- ${check.status}: ${profileCheckMarkdownLabel(check)}`);
331
338
  if (check.message) lines.push(` ${check.message}`);
@@ -449,7 +456,14 @@ function profileCheckMarkdownTarget(check) {
449
456
  return maxOverflow !== void 0 ? `<= ${maxOverflow}px` : void 0;
450
457
  }
451
458
  if (check.type === "no_fatal_console_errors") {
452
- return "0 unallowed fatal errors";
459
+ const fatalCount = cliFiniteNumber(evidence.console_fatal_count) ?? cliFiniteNumber(evidence.fatal_error_count) ?? 0;
460
+ const totalConsoleCount = cliFiniteNumber(evidence.total_console_fatal_count);
461
+ const allowedConsoleCount = cliFiniteNumber(evidence.allowed_console_fatal_count);
462
+ const parts = [`${fatalCount} unallowed fatal error${fatalCount === 1 ? "" : "s"}`];
463
+ if (totalConsoleCount !== void 0 && allowedConsoleCount !== void 0) {
464
+ parts.push(`${allowedConsoleCount}/${totalConsoleCount} console fatal allowed`);
465
+ }
466
+ return parts.join(", ");
453
467
  }
454
468
  if (check.type === "no_console_warnings") {
455
469
  const warningCount = cliFiniteNumber(evidence.console_warning_count) ?? 0;
package/dist/index.cjs CHANGED
@@ -2948,6 +2948,7 @@ __export(index_exports, {
2948
2948
  checkpointResponseIdentity: () => checkpointResponseIdentity,
2949
2949
  checkpointSummaryFromState: () => checkpointSummaryFromState,
2950
2950
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
2951
+ collectRiddleProofProfileWarnings: () => collectRiddleProofProfileWarnings,
2951
2952
  compactBasicGameplayText: () => compactBasicGameplayText,
2952
2953
  compactRecord: () => compactRecord,
2953
2954
  compareVisualProofSessionFingerprint: () => compareVisualProofSessionFingerprint,
@@ -9383,6 +9384,48 @@ function normalizeNetworkMocks(value) {
9383
9384
  if (!Array.isArray(value)) throw new Error("target.network_mocks must be an array.");
9384
9385
  return value.map(normalizeNetworkMock);
9385
9386
  }
9387
+ function profileStringList(value) {
9388
+ return Array.isArray(value) ? value.map((item) => String(item)).filter(Boolean) : [];
9389
+ }
9390
+ function responseHasRequestBodyContract(response) {
9391
+ if (!response) return false;
9392
+ return profileStringList(response.request_body_contains).length > 0 || profileStringList(response.request_body_patterns).length > 0 || profileStringList(response.request_body_not_contains).length > 0 || profileStringList(response.request_body_not_patterns).length > 0;
9393
+ }
9394
+ function responseHasOnlyPositiveTextSelector(response) {
9395
+ if (!response) return false;
9396
+ return profileStringList(response.request_body_contains).length > 0 && profileStringList(response.request_body_patterns).length === 0 && profileStringList(response.request_body_not_contains).length === 0 && profileStringList(response.request_body_not_patterns).length === 0;
9397
+ }
9398
+ function responseMayShadowLaterRequestBodyMatch(earlier, later) {
9399
+ if (!responseHasOnlyPositiveTextSelector(earlier) || !responseHasRequestBodyContract(later)) return false;
9400
+ const earlierContains = profileStringList(earlier.request_body_contains);
9401
+ const laterContains = profileStringList(later.request_body_contains);
9402
+ if (!laterContains.length) return false;
9403
+ return earlierContains.every((fragment) => laterContains.includes(fragment));
9404
+ }
9405
+ function responseLabel(response, index) {
9406
+ return response.label ? `"${response.label}"` : `responses[${index}]`;
9407
+ }
9408
+ function collectRiddleProofProfileWarnings(profile) {
9409
+ const warnings = [];
9410
+ for (const [mockIndex, mock] of (profile.target.network_mocks || []).entries()) {
9411
+ const responses = Array.isArray(mock.responses) ? mock.responses : [];
9412
+ if (responses.length < 2) continue;
9413
+ for (let laterIndex = 1; laterIndex < responses.length; laterIndex += 1) {
9414
+ const later = responses[laterIndex];
9415
+ if (!responseHasRequestBodyContract(later)) continue;
9416
+ for (let earlierIndex = 0; earlierIndex < laterIndex; earlierIndex += 1) {
9417
+ const earlier = responses[earlierIndex];
9418
+ if (!responseMayShadowLaterRequestBodyMatch(earlier, later)) continue;
9419
+ const mockLabel = mock.label ? ` (${mock.label})` : "";
9420
+ warnings.push(
9421
+ `target.network_mocks[${mockIndex}]${mockLabel} ${responseLabel(earlier, earlierIndex)} can shadow ${responseLabel(later, laterIndex)} because the earlier request_body_contains fragments are a subset of the later response and have no negative or pattern disambiguator. First matching request-body response wins.`
9422
+ );
9423
+ break;
9424
+ }
9425
+ }
9426
+ }
9427
+ return warnings;
9428
+ }
9386
9429
  function normalizeRouteInventoryPath(value, label) {
9387
9430
  const path6 = stringValue5(value);
9388
9431
  if (!path6) throw new Error(`${label} requires path.`);
@@ -10771,11 +10814,11 @@ function networkMockResponseHitsByLabel(events) {
10771
10814
  for (const event of events) {
10772
10815
  if (!event || event.ok === false) continue;
10773
10816
  const label = typeof event.label === "string" ? event.label : "";
10774
- const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
10775
- const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
10776
- if (!label || !responseLabel || !hasSequenceResponse) continue;
10817
+ const responseLabel2 = typeof event.response_label === "string" ? event.response_label : "";
10818
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel2 && responseLabel2 !== label);
10819
+ if (!label || !responseLabel2 || !hasSequenceResponse) continue;
10777
10820
  responseHits[label] || (responseHits[label] = {});
10778
- responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
10821
+ responseHits[label][responseLabel2] = (responseHits[label][responseLabel2] || 0) + 1;
10779
10822
  }
10780
10823
  return responseHits;
10781
10824
  }
@@ -10798,6 +10841,7 @@ function profileStatusFromEvidence(profile, evidence, checks) {
10798
10841
  }
10799
10842
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
10800
10843
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
10844
+ const warnings = collectRiddleProofProfileWarnings(profile);
10801
10845
  const checks = evidence ? [
10802
10846
  assessNetworkMocksFromEvidence(profile, evidence),
10803
10847
  assessSetupActionsFromEvidence(profile, evidence),
@@ -10823,6 +10867,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
10823
10867
  checks,
10824
10868
  summary: summarizeRiddleProofProfileResult({ profile_name: profile.name, status, checks, viewports: evidence?.viewports || [] }),
10825
10869
  captured_at: capturedAt,
10870
+ warnings: warnings.length ? warnings : void 0,
10826
10871
  evidence,
10827
10872
  riddle: options.riddle
10828
10873
  };
@@ -10871,6 +10916,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
10871
10916
  function createRiddleProofProfileEnvironmentBlockedResult(input) {
10872
10917
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
10873
10918
  const environmentBlocker = extractRiddleRunnerBlocker(message);
10919
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
10874
10920
  return {
10875
10921
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
10876
10922
  profile_name: input.profile.name,
@@ -10882,6 +10928,7 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
10882
10928
  checks: [],
10883
10929
  summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
10884
10930
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
10931
+ warnings: warnings.length ? warnings : void 0,
10885
10932
  riddle: input.riddle,
10886
10933
  environment_blocker: environmentBlocker,
10887
10934
  error: message
@@ -10940,6 +10987,7 @@ function summarizeEnvironmentBlockedRunner(profileName, blocker) {
10940
10987
  }
10941
10988
  function createRiddleProofProfileInsufficientResult(input) {
10942
10989
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
10990
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
10943
10991
  return {
10944
10992
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
10945
10993
  profile_name: input.profile.name,
@@ -10951,6 +10999,7 @@ function createRiddleProofProfileInsufficientResult(input) {
10951
10999
  checks: [],
10952
11000
  summary: `${input.profile.name} did not produce enough evidence for a profile judgment.`,
10953
11001
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
11002
+ warnings: warnings.length ? warnings : void 0,
10954
11003
  riddle: input.riddle,
10955
11004
  error: message
10956
11005
  };
@@ -12257,6 +12306,7 @@ function assessProfile(profile, evidence) {
12257
12306
  checks,
12258
12307
  summary,
12259
12308
  captured_at: evidence.captured_at,
12309
+ warnings: profileWarnings.length ? profileWarnings : undefined,
12260
12310
  evidence,
12261
12311
  };
12262
12312
  }
@@ -12265,11 +12315,14 @@ function assessProfile(profile, evidence) {
12265
12315
  function buildRiddleProofProfileScript(profile) {
12266
12316
  const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
12267
12317
  const slug2 = slugifyRiddleProofProfileName(profile.name);
12318
+ const profileWarnings = collectRiddleProofProfileWarnings(profile);
12268
12319
  const serializableProfile = JSON.stringify(profile);
12320
+ const serializableProfileWarnings = JSON.stringify(profileWarnings);
12269
12321
  const serializableTargetUrl = JSON.stringify(targetUrl);
12270
12322
  const serializableSlug = JSON.stringify(slug2);
12271
12323
  return String.raw`
12272
12324
  const profile = ${serializableProfile};
12325
+ const profileWarnings = ${serializableProfileWarnings};
12273
12326
  const targetUrl = ${serializableTargetUrl};
12274
12327
  const profileSlug = ${serializableSlug};
12275
12328
  const capturedAt = new Date().toISOString();
@@ -14772,6 +14825,7 @@ function createRiddleApiClient(config = {}) {
14772
14825
  checkpointResponseIdentity,
14773
14826
  checkpointSummaryFromState,
14774
14827
  collectRiddleProfileArtifactRefs,
14828
+ collectRiddleProofProfileWarnings,
14775
14829
  compactBasicGameplayText,
14776
14830
  compactRecord,
14777
14831
  compareVisualProofSessionFingerprint,
package/dist/index.d.cts CHANGED
@@ -10,5 +10,5 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.cjs';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.cjs';
12
12
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.cjs';
13
- export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
13
+ export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
14
14
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
package/dist/index.d.ts CHANGED
@@ -10,5 +10,5 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.js';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.js';
12
12
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
13
- export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
13
+ export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
14
14
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployResult, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ import {
47
47
  assessRiddleProofProfileEvidence,
48
48
  buildRiddleProofProfileScript,
49
49
  collectRiddleProfileArtifactRefs,
50
+ collectRiddleProofProfileWarnings,
50
51
  createRiddleProofProfileConfigurationError,
51
52
  createRiddleProofProfileEnvironmentBlockedResult,
52
53
  createRiddleProofProfileInsufficientResult,
@@ -58,7 +59,7 @@ import {
58
59
  resolveRiddleProofProfileTimeoutSec,
59
60
  slugifyRiddleProofProfileName,
60
61
  summarizeRiddleProofProfileResult
61
- } from "./chunk-KKH76HIA.js";
62
+ } from "./chunk-2ZZS7RD5.js";
62
63
  import {
63
64
  DEFAULT_RIDDLE_API_BASE_URL,
64
65
  DEFAULT_RIDDLE_API_KEY_FILE,
@@ -188,6 +189,7 @@ export {
188
189
  checkpointResponseIdentity,
189
190
  checkpointSummaryFromState,
190
191
  collectRiddleProfileArtifactRefs,
192
+ collectRiddleProofProfileWarnings,
191
193
  compactBasicGameplayText,
192
194
  compactRecord,
193
195
  compareVisualProofSessionFingerprint,
package/dist/profile.cjs CHANGED
@@ -29,6 +29,7 @@ __export(profile_exports, {
29
29
  assessRiddleProofProfileEvidence: () => assessRiddleProofProfileEvidence,
30
30
  buildRiddleProofProfileScript: () => buildRiddleProofProfileScript,
31
31
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
32
+ collectRiddleProofProfileWarnings: () => collectRiddleProofProfileWarnings,
32
33
  createRiddleProofProfileConfigurationError: () => createRiddleProofProfileConfigurationError,
33
34
  createRiddleProofProfileEnvironmentBlockedResult: () => createRiddleProofProfileEnvironmentBlockedResult,
34
35
  createRiddleProofProfileInsufficientResult: () => createRiddleProofProfileInsufficientResult,
@@ -697,6 +698,48 @@ function normalizeNetworkMocks(value) {
697
698
  if (!Array.isArray(value)) throw new Error("target.network_mocks must be an array.");
698
699
  return value.map(normalizeNetworkMock);
699
700
  }
701
+ function profileStringList(value) {
702
+ return Array.isArray(value) ? value.map((item) => String(item)).filter(Boolean) : [];
703
+ }
704
+ function responseHasRequestBodyContract(response) {
705
+ if (!response) return false;
706
+ return profileStringList(response.request_body_contains).length > 0 || profileStringList(response.request_body_patterns).length > 0 || profileStringList(response.request_body_not_contains).length > 0 || profileStringList(response.request_body_not_patterns).length > 0;
707
+ }
708
+ function responseHasOnlyPositiveTextSelector(response) {
709
+ if (!response) return false;
710
+ return profileStringList(response.request_body_contains).length > 0 && profileStringList(response.request_body_patterns).length === 0 && profileStringList(response.request_body_not_contains).length === 0 && profileStringList(response.request_body_not_patterns).length === 0;
711
+ }
712
+ function responseMayShadowLaterRequestBodyMatch(earlier, later) {
713
+ if (!responseHasOnlyPositiveTextSelector(earlier) || !responseHasRequestBodyContract(later)) return false;
714
+ const earlierContains = profileStringList(earlier.request_body_contains);
715
+ const laterContains = profileStringList(later.request_body_contains);
716
+ if (!laterContains.length) return false;
717
+ return earlierContains.every((fragment) => laterContains.includes(fragment));
718
+ }
719
+ function responseLabel(response, index) {
720
+ return response.label ? `"${response.label}"` : `responses[${index}]`;
721
+ }
722
+ function collectRiddleProofProfileWarnings(profile) {
723
+ const warnings = [];
724
+ for (const [mockIndex, mock] of (profile.target.network_mocks || []).entries()) {
725
+ const responses = Array.isArray(mock.responses) ? mock.responses : [];
726
+ if (responses.length < 2) continue;
727
+ for (let laterIndex = 1; laterIndex < responses.length; laterIndex += 1) {
728
+ const later = responses[laterIndex];
729
+ if (!responseHasRequestBodyContract(later)) continue;
730
+ for (let earlierIndex = 0; earlierIndex < laterIndex; earlierIndex += 1) {
731
+ const earlier = responses[earlierIndex];
732
+ if (!responseMayShadowLaterRequestBodyMatch(earlier, later)) continue;
733
+ const mockLabel = mock.label ? ` (${mock.label})` : "";
734
+ warnings.push(
735
+ `target.network_mocks[${mockIndex}]${mockLabel} ${responseLabel(earlier, earlierIndex)} can shadow ${responseLabel(later, laterIndex)} because the earlier request_body_contains fragments are a subset of the later response and have no negative or pattern disambiguator. First matching request-body response wins.`
736
+ );
737
+ break;
738
+ }
739
+ }
740
+ }
741
+ return warnings;
742
+ }
700
743
  function normalizeRouteInventoryPath(value, label) {
701
744
  const path = stringValue(value);
702
745
  if (!path) throw new Error(`${label} requires path.`);
@@ -2085,11 +2128,11 @@ function networkMockResponseHitsByLabel(events) {
2085
2128
  for (const event of events) {
2086
2129
  if (!event || event.ok === false) continue;
2087
2130
  const label = typeof event.label === "string" ? event.label : "";
2088
- const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
2089
- const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
2090
- if (!label || !responseLabel || !hasSequenceResponse) continue;
2131
+ const responseLabel2 = typeof event.response_label === "string" ? event.response_label : "";
2132
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel2 && responseLabel2 !== label);
2133
+ if (!label || !responseLabel2 || !hasSequenceResponse) continue;
2091
2134
  responseHits[label] || (responseHits[label] = {});
2092
- responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
2135
+ responseHits[label][responseLabel2] = (responseHits[label][responseLabel2] || 0) + 1;
2093
2136
  }
2094
2137
  return responseHits;
2095
2138
  }
@@ -2112,6 +2155,7 @@ function profileStatusFromEvidence(profile, evidence, checks) {
2112
2155
  }
2113
2156
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
2114
2157
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
2158
+ const warnings = collectRiddleProofProfileWarnings(profile);
2115
2159
  const checks = evidence ? [
2116
2160
  assessNetworkMocksFromEvidence(profile, evidence),
2117
2161
  assessSetupActionsFromEvidence(profile, evidence),
@@ -2137,6 +2181,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
2137
2181
  checks,
2138
2182
  summary: summarizeRiddleProofProfileResult({ profile_name: profile.name, status, checks, viewports: evidence?.viewports || [] }),
2139
2183
  captured_at: capturedAt,
2184
+ warnings: warnings.length ? warnings : void 0,
2140
2185
  evidence,
2141
2186
  riddle: options.riddle
2142
2187
  };
@@ -2185,6 +2230,7 @@ function createRiddleProofProfileConfigurationError(name, error, runner = "riddl
2185
2230
  function createRiddleProofProfileEnvironmentBlockedResult(input) {
2186
2231
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "Riddle runner did not complete successfully.";
2187
2232
  const environmentBlocker = extractRiddleRunnerBlocker(message);
2233
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
2188
2234
  return {
2189
2235
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
2190
2236
  profile_name: input.profile.name,
@@ -2196,6 +2242,7 @@ function createRiddleProofProfileEnvironmentBlockedResult(input) {
2196
2242
  checks: [],
2197
2243
  summary: summarizeEnvironmentBlockedRunner(input.profile.name, environmentBlocker),
2198
2244
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2245
+ warnings: warnings.length ? warnings : void 0,
2199
2246
  riddle: input.riddle,
2200
2247
  environment_blocker: environmentBlocker,
2201
2248
  error: message
@@ -2254,6 +2301,7 @@ function summarizeEnvironmentBlockedRunner(profileName, blocker) {
2254
2301
  }
2255
2302
  function createRiddleProofProfileInsufficientResult(input) {
2256
2303
  const message = input.error instanceof Error ? input.error.message : input.error ? String(input.error) : "No proof.json profile result artifact was found.";
2304
+ const warnings = collectRiddleProofProfileWarnings(input.profile);
2257
2305
  return {
2258
2306
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
2259
2307
  profile_name: input.profile.name,
@@ -2265,6 +2313,7 @@ function createRiddleProofProfileInsufficientResult(input) {
2265
2313
  checks: [],
2266
2314
  summary: `${input.profile.name} did not produce enough evidence for a profile judgment.`,
2267
2315
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2316
+ warnings: warnings.length ? warnings : void 0,
2268
2317
  riddle: input.riddle,
2269
2318
  error: message
2270
2319
  };
@@ -3571,6 +3620,7 @@ function assessProfile(profile, evidence) {
3571
3620
  checks,
3572
3621
  summary,
3573
3622
  captured_at: evidence.captured_at,
3623
+ warnings: profileWarnings.length ? profileWarnings : undefined,
3574
3624
  evidence,
3575
3625
  };
3576
3626
  }
@@ -3579,11 +3629,14 @@ function assessProfile(profile, evidence) {
3579
3629
  function buildRiddleProofProfileScript(profile) {
3580
3630
  const targetUrl = resolveRiddleProofProfileTargetUrl(profile);
3581
3631
  const slug = slugifyRiddleProofProfileName(profile.name);
3632
+ const profileWarnings = collectRiddleProofProfileWarnings(profile);
3582
3633
  const serializableProfile = JSON.stringify(profile);
3634
+ const serializableProfileWarnings = JSON.stringify(profileWarnings);
3583
3635
  const serializableTargetUrl = JSON.stringify(targetUrl);
3584
3636
  const serializableSlug = JSON.stringify(slug);
3585
3637
  return String.raw`
3586
3638
  const profile = ${serializableProfile};
3639
+ const profileWarnings = ${serializableProfileWarnings};
3587
3640
  const targetUrl = ${serializableTargetUrl};
3588
3641
  const profileSlug = ${serializableSlug};
3589
3642
  const capturedAt = new Date().toISOString();
@@ -5713,6 +5766,7 @@ function extractRiddleProofProfileResult(input) {
5713
5766
  assessRiddleProofProfileEvidence,
5714
5767
  buildRiddleProofProfileScript,
5715
5768
  collectRiddleProfileArtifactRefs,
5769
+ collectRiddleProofProfileWarnings,
5716
5770
  createRiddleProofProfileConfigurationError,
5717
5771
  createRiddleProofProfileEnvironmentBlockedResult,
5718
5772
  createRiddleProofProfileInsufficientResult,
@@ -266,6 +266,7 @@ interface RiddleProofProfileResult {
266
266
  checks: RiddleProofProfileCheckResult[];
267
267
  summary: string;
268
268
  captured_at: string;
269
+ warnings?: string[];
269
270
  evidence?: RiddleProofProfileEvidence;
270
271
  riddle?: {
271
272
  job_id?: string;
@@ -289,6 +290,7 @@ interface NormalizeRiddleProofProfileOptions {
289
290
  viewports?: RiddleProofProfileViewport[];
290
291
  }
291
292
  declare function slugifyRiddleProofProfileName(value: string): string;
293
+ declare function collectRiddleProofProfileWarnings(profile: RiddleProofProfile): string[];
292
294
  declare function normalizeRiddleProofProfile(input: unknown, options?: NormalizeRiddleProofProfileOptions): RiddleProofProfile;
293
295
  declare function resolveRiddleProofProfileTargetUrl(profile: RiddleProofProfile): string;
294
296
  declare function resolveRiddleProofProfileTimeoutSec(profile: RiddleProofProfile, requestedTimeoutSec?: number): number | undefined;
@@ -324,4 +326,4 @@ declare function buildRiddleProofProfileScript(profile: RiddleProofProfile): str
324
326
  declare function collectRiddleProfileArtifactRefs(input: unknown): RiddleProofProfileArtifactRef[];
325
327
  declare function extractRiddleProofProfileResult(input: unknown): RiddleProofProfileResult | undefined;
326
328
 
327
- export { type NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
329
+ export { type NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
package/dist/profile.d.ts CHANGED
@@ -266,6 +266,7 @@ interface RiddleProofProfileResult {
266
266
  checks: RiddleProofProfileCheckResult[];
267
267
  summary: string;
268
268
  captured_at: string;
269
+ warnings?: string[];
269
270
  evidence?: RiddleProofProfileEvidence;
270
271
  riddle?: {
271
272
  job_id?: string;
@@ -289,6 +290,7 @@ interface NormalizeRiddleProofProfileOptions {
289
290
  viewports?: RiddleProofProfileViewport[];
290
291
  }
291
292
  declare function slugifyRiddleProofProfileName(value: string): string;
293
+ declare function collectRiddleProofProfileWarnings(profile: RiddleProofProfile): string[];
292
294
  declare function normalizeRiddleProofProfile(input: unknown, options?: NormalizeRiddleProofProfileOptions): RiddleProofProfile;
293
295
  declare function resolveRiddleProofProfileTargetUrl(profile: RiddleProofProfile): string;
294
296
  declare function resolveRiddleProofProfileTimeoutSec(profile: RiddleProofProfile, requestedTimeoutSec?: number): number | undefined;
@@ -324,4 +326,4 @@ declare function buildRiddleProofProfileScript(profile: RiddleProofProfile): str
324
326
  declare function collectRiddleProfileArtifactRefs(input: unknown): RiddleProofProfileArtifactRef[];
325
327
  declare function extractRiddleProofProfileResult(input: unknown): RiddleProofProfileResult | undefined;
326
328
 
327
- export { type NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
329
+ export { type NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
package/dist/profile.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  assessRiddleProofProfileEvidence,
9
9
  buildRiddleProofProfileScript,
10
10
  collectRiddleProfileArtifactRefs,
11
+ collectRiddleProofProfileWarnings,
11
12
  createRiddleProofProfileConfigurationError,
12
13
  createRiddleProofProfileEnvironmentBlockedResult,
13
14
  createRiddleProofProfileInsufficientResult,
@@ -19,7 +20,7 @@ import {
19
20
  resolveRiddleProofProfileTimeoutSec,
20
21
  slugifyRiddleProofProfileName,
21
22
  summarizeRiddleProofProfileResult
22
- } from "./chunk-KKH76HIA.js";
23
+ } from "./chunk-2ZZS7RD5.js";
23
24
  export {
24
25
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
25
26
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
@@ -30,6 +31,7 @@ export {
30
31
  assessRiddleProofProfileEvidence,
31
32
  buildRiddleProofProfileScript,
32
33
  collectRiddleProfileArtifactRefs,
34
+ collectRiddleProofProfileWarnings,
33
35
  createRiddleProofProfileConfigurationError,
34
36
  createRiddleProofProfileEnvironmentBlockedResult,
35
37
  createRiddleProofProfileInsufficientResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.110",
3
+ "version": "0.7.112",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",