@apilift/cli 1.8.4 → 1.8.6-dev.1793958804.41be6f6ba98bbc3aaa65f7ce7268465be396c257
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/dist/apilift-collector.js +1 -1
- package/dist/apilift-native-host.js +3 -2
- package/dist/apilift.js +129 -20
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/skills/discover/references/operation-contract.md +3 -1
- package/package.json +2 -2
|
@@ -164303,7 +164303,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
164303
164303
|
const transport = async (input2, init) => {
|
|
164304
164304
|
const method = init?.method ?? "GET";
|
|
164305
164305
|
const headers = new Headers(init?.headers);
|
|
164306
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1");
|
|
164306
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1");
|
|
164307
164307
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
164308
164308
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
164309
164309
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -30024,7 +30024,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
30024
30024
|
const transport = async (input2, init) => {
|
|
30025
30025
|
const method = init?.method ?? "GET";
|
|
30026
30026
|
const headers = new Headers(init?.headers);
|
|
30027
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1");
|
|
30027
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1");
|
|
30028
30028
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
30029
30029
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
30030
30030
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -31161,9 +31161,10 @@ function parseExpectedResults(value) {
|
|
|
31161
31161
|
issues.push({ path: path2, message: "Expected-result comparison must be an object" });
|
|
31162
31162
|
return;
|
|
31163
31163
|
}
|
|
31164
|
-
if (Object.keys(entry2).some((key) => !["path", "value", "input", "file", "from", "unordered", "unorderedAt"].includes(key))) issues.push({ path: path2, message: "Expected-result comparison contains unsupported fields" });
|
|
31164
|
+
if (Object.keys(entry2).some((key) => !["path", "value", "input", "file", "from", "unordered", "unorderedAt", "ignore"].includes(key))) issues.push({ path: path2, message: "Expected-result comparison contains unsupported fields" });
|
|
31165
31165
|
if (entry2.unordered !== void 0 && typeof entry2.unordered !== "boolean") issues.push({ path: `${path2}/unordered`, message: "Use a boolean; unordered comparison applies only to the selected array" });
|
|
31166
31166
|
if (entry2.unorderedAt !== void 0 && (!validPointer(entry2.unorderedAt) || entry2.unordered)) issues.push({ path: `${path2}/unorderedAt`, message: "Name one array within the selected value; do not combine unorderedAt with unordered" });
|
|
31167
|
+
if (entry2.ignore !== void 0 && (!Array.isArray(entry2.ignore) || !entry2.ignore.length || entry2.ignore.length > 16 || entry2.ignore.some((item) => !object2(item) || Object.keys(item).some((key) => !["path", "reason"].includes(key)) || !validPointer(item.path) || !item.path || item.path.endsWith("/*") || typeof item.reason !== "string" || item.reason.trim().length < 10 || item.reason.length > 600))) issues.push({ path: `${path2}/ignore`, message: "Declare at most 16 scalar field paths relative to the comparison, each with an evidence-based volatility reason; use * only for array members" });
|
|
31167
31168
|
if (!validPointer(entry2.path)) issues.push({ path: `${path2}/path`, message: "Use a JSON Pointer into the saved output" });
|
|
31168
31169
|
if (["value", "input", "file"].filter((key) => own2(entry2, key)).length !== 1) issues.push({ path: path2, message: "Choose exactly one expected source: value, input or file" });
|
|
31169
31170
|
if (own2(entry2, "value") && !json3(entry2.value)) issues.push({ path: `${path2}/value`, message: "Expected value must be JSON" });
|
package/dist/apilift.js
CHANGED
|
@@ -31198,9 +31198,10 @@ function parseExpectedResults(value) {
|
|
|
31198
31198
|
issues.push({ path: path2, message: "Expected-result comparison must be an object" });
|
|
31199
31199
|
return;
|
|
31200
31200
|
}
|
|
31201
|
-
if (Object.keys(entry2).some((key) => !["path", "value", "input", "file", "from", "unordered", "unorderedAt"].includes(key))) issues.push({ path: path2, message: "Expected-result comparison contains unsupported fields" });
|
|
31201
|
+
if (Object.keys(entry2).some((key) => !["path", "value", "input", "file", "from", "unordered", "unorderedAt", "ignore"].includes(key))) issues.push({ path: path2, message: "Expected-result comparison contains unsupported fields" });
|
|
31202
31202
|
if (entry2.unordered !== void 0 && typeof entry2.unordered !== "boolean") issues.push({ path: `${path2}/unordered`, message: "Use a boolean; unordered comparison applies only to the selected array" });
|
|
31203
31203
|
if (entry2.unorderedAt !== void 0 && (!validPointer(entry2.unorderedAt) || entry2.unordered)) issues.push({ path: `${path2}/unorderedAt`, message: "Name one array within the selected value; do not combine unorderedAt with unordered" });
|
|
31204
|
+
if (entry2.ignore !== void 0 && (!Array.isArray(entry2.ignore) || !entry2.ignore.length || entry2.ignore.length > 16 || entry2.ignore.some((item) => !object3(item) || Object.keys(item).some((key) => !["path", "reason"].includes(key)) || !validPointer(item.path) || !item.path || item.path.endsWith("/*") || typeof item.reason !== "string" || item.reason.trim().length < 10 || item.reason.length > 600))) issues.push({ path: `${path2}/ignore`, message: "Declare at most 16 scalar field paths relative to the comparison, each with an evidence-based volatility reason; use * only for array members" });
|
|
31204
31205
|
if (!validPointer(entry2.path)) issues.push({ path: `${path2}/path`, message: "Use a JSON Pointer into the saved output" });
|
|
31205
31206
|
if (["value", "input", "file"].filter((key) => own2(entry2, key)).length !== 1) issues.push({ path: path2, message: "Choose exactly one expected source: value, input or file" });
|
|
31206
31207
|
if (own2(entry2, "value") && !json3(entry2.value)) issues.push({ path: `${path2}/value`, message: "Expected value must be JSON" });
|
|
@@ -31210,6 +31211,29 @@ function parseExpectedResults(value) {
|
|
|
31210
31211
|
});
|
|
31211
31212
|
return issues.length ? { issues } : { comparisons: value, issues };
|
|
31212
31213
|
}
|
|
31214
|
+
function withoutVolatileFields(value, fields) {
|
|
31215
|
+
const copy = structuredClone(value);
|
|
31216
|
+
for (const field of fields) {
|
|
31217
|
+
const parts2 = field.path.slice(1).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
|
|
31218
|
+
const visit4 = (node2, index2) => {
|
|
31219
|
+
const key = parts2[index2];
|
|
31220
|
+
if (key === "*") {
|
|
31221
|
+
if (!Array.isArray(node2)) throw new Error("Volatile field wildcard must select array members");
|
|
31222
|
+
for (const item of node2) visit4(item, index2 + 1);
|
|
31223
|
+
} else {
|
|
31224
|
+
if (!object3(node2) && !Array.isArray(node2) || !Object.hasOwn(node2, key)) throw new Error("Volatile field is missing; both responses must retain every declared field");
|
|
31225
|
+
const parent2 = node2;
|
|
31226
|
+
if (index2 === parts2.length - 1) {
|
|
31227
|
+
if (Array.isArray(node2) || parent2[key] !== null && typeof parent2[key] === "object") throw new Error("Only scalar object fields can be excluded, never records, arrays or collection members");
|
|
31228
|
+
if (Object.keys(node2).length <= 1) throw new Error("Every compared record must retain stable fields");
|
|
31229
|
+
delete parent2[key];
|
|
31230
|
+
} else visit4(parent2[key], index2 + 1);
|
|
31231
|
+
}
|
|
31232
|
+
};
|
|
31233
|
+
visit4(copy, 0);
|
|
31234
|
+
}
|
|
31235
|
+
return copy;
|
|
31236
|
+
}
|
|
31213
31237
|
function checkExpectedResults(output2, inputs, comparisons, resultPath) {
|
|
31214
31238
|
const parsed = parseExpectedResults(comparisons);
|
|
31215
31239
|
if (parsed.issues.length) return parsed.issues;
|
|
@@ -31248,6 +31272,15 @@ function checkExpectedResults(output2, inputs, comparisons, resultPath) {
|
|
|
31248
31272
|
issues.push({ path: path2, message: "Expected source is missing from the verification inputs or independent evidence" });
|
|
31249
31273
|
continue;
|
|
31250
31274
|
}
|
|
31275
|
+
if (entry2.ignore) {
|
|
31276
|
+
try {
|
|
31277
|
+
actual.value = withoutVolatileFields(actual.value, entry2.ignore);
|
|
31278
|
+
expected.value = withoutVolatileFields(expected.value, entry2.ignore);
|
|
31279
|
+
} catch (error62) {
|
|
31280
|
+
issues.push({ path: `${path2}/ignore`, message: error62 instanceof Error ? error62.message : "Invalid volatile field projection" });
|
|
31281
|
+
continue;
|
|
31282
|
+
}
|
|
31283
|
+
}
|
|
31251
31284
|
if (entry2.unorderedAt !== void 0) {
|
|
31252
31285
|
const left = structuredClone(actual.value), right = structuredClone(expected.value);
|
|
31253
31286
|
const a = select(left, entry2.unorderedAt), b = select(right, entry2.unorderedAt);
|
|
@@ -31427,7 +31460,7 @@ function draftTemplate(kind) {
|
|
|
31427
31460
|
""
|
|
31428
31461
|
].join("\n") : "";
|
|
31429
31462
|
const tabGuidance = ["action", "transport"].includes(kind) ? "// capture.tab is a selector returned by browser tabs; it selects the same signed-in Chrome tab for capture and discover run, including connection probes. Leave other sessions' tabs untouched.\n" : "";
|
|
31430
|
-
const captureGuidance = kind === "action" ? '// effect is read, create, update or delete. Before the first run, build verification.inputs as the smallest advertised call from published sources: omit optional inputs together and exercise caller defaults. A configured author target does not prove an optional prerequisite: require its input or validate stored configuration with request.prepare. Every authored top-level default must match the test; revise unsupported defaults before dispatch. Missing sources are not arbitrary JSON.\n// Public descriptions explain behavior, consequences and limits; do not instruct consumers to repeat runtime proof or browser checks. Author verification is separate from consumer judgment.\n// HTML: response.format="html" requires html.marker and html.fields with observed CSS selectors; extraction is inert and produces JSON before schema validation. Form requests use request.form, excluding body; request.prepare performs one GET and supplies internal {"$prepared":"/path"} values for CSRF and preservation.\n// Declared response.continue rules follow at most five same-origin GET destinations from JSON path or HTML selector/attribute; rejected writes never navigate. Repair with proof-only, never repeat the write.\n// Request JSON/query uses typed {"$input":"name"} bindings; URL segments use {input.name}. Resolve every {unresolved.N} marker from retained evidence before running.\n// App-owned input source annotation: {"x-source":{"action":"ticket.list","path":"/*/id"}}. Run the source explicitly; it never runs implicitly.\n// Keep only invariant protocol values constant; selected app values are inputs, even when public. Generalize one action across its supported choices.\n// Materially different request shapes, conditional prerequisites, closed protocol enum choices and declared format variants need successful evidence or a constrained input schema. Broad date-time includes UTC and offset forms. Optional x-source inputs need presence and omission evidence, or declare them required. Keep app-owned catalog choices dynamic through sources; do not enumerate catalog IDs, all combinations or a second mutation. Constraints appear in consumer help. Use the existing test for the most consequential unresolved choice.\n// Trace the requested consumer path through existing-target lookup, configuration and the result needed next; publish verified prerequisites independently and require the complete path at task completion. Compare related actions by effect and choices, not endpoint.\n// For updates, choose populated non-default unrelated settings before the existing test; compare their before/after values. Already-empty settings cannot prove preservation. If the app resets them, document that observed behavior when authorized; do not claim preservation.\n// Require essential identity/result members in response.schema; leave incidental inferred types provisional and preserve extra observed keys. discover check and publish recheck compatible saved cases locally, including after edits and schema narrowing; do not write a duplicate schema-check script or repeat an app call. Preserve valid empty collections, optional fields, bodyless results and original value types.\n// Declare verification.outcome: {kind,path?,fields?,identity?,states?}. kind is record, collection, lookup, execution or usage. path defaults to the projected output root; fields are relative JSON Pointers. Record reads compare all required result fields and declared fields. Collection requires nonempty entire-collection equality and local empty-result schema acceptance. Use a naturally empty search/filter boundary when reachable; never mutate or enumerate to manufacture one. Local acceptance is not an observed app boundary. Lookup requires a whole positive record or all essentials, plus null/empty object/HTTP 404 absence. Arrays cannot use record.\n// Read verification.expect compares each path with exactly one input, value or independent file/from source; from selects the file subtree. Example entire-collection expectation: [{"path":"","file":"/absolute/independent-tickets.json"}]. Derive expectations from intended inputs, docs/UI or independent saved evidence, never copy actual output as expectation. A mutation record reuses proof.equals without duplicate verification.expect.\n// Execution outcome identity and distinct state/output fields refer to the saved selected proof record. Compare both with proof.equals; states lists allowed observed lifecycle states. A request acknowledgement does not establish actual started/completed execution. Usage fields require independent file-backed expectations; literals, input echoes and the same output do not reconcile actual usage/cost. A raw counter may use record only with honest limits and an explicit actual-cost gap.\n// Reuse saved primary and boundary cases first. Only for a missing read boundary, verification.boundary: {inputs:{query:"no matching ticket"},expect:[{path:"",value:[]}]} permits one automatic read-only probe through this action; status:404 with expect:[] declares an observed missing lookup. Never add a mutation boundary or repeat its write.\n// Local checks never accept semantic review. Accept verification.review only after comparing the promised result, configuration and preservation; review affected descriptions and source/result paths together. Complete the requested consumer path or state its real unresolved gap; never freeze one provider or account scope to conceal missing coverage.\n// A readback through POST requires proof.effect: "read" alongside proof.request; HTTP method alone does not determine semantic effect.\n// JSON object keys may use {input.name}, e.g. {"{input.attribute_id}":{"$input":"value"}}.\n// Discovery-only mutation proof compares a readback path with exactly one input, primary result path or internal JSON value: equals: [{"path":"/ready","value":true}]. Create/update must compare a meaningful body/form value or explicit changed state; URL/selection inputs and returned identity alone do not prove the change. Preserve false, 0, null and objects. Public literals require semantic review; fixed proof expectations are not caller flags.\n// Proof URLs bind returned identifiers with {result./id}; JSON bodies/query use {"$result":"/id"}. Readback pointers may use a complete {input.name} or {result./id} segment for a dynamic key; slashes and tildes in its value are escaped.\n// For one member of a nested array or object map: select: {"path":"/ticket/fields","where":[{"path":"/id","result":"/id"}]}; equals paths then refer to the single matching member. Compare identity and meaningful changed fields, not entire objects.\n// Select an object-map member by its key when values do not contain IDs: select: {path:"/items",key:{result:"/id"}} or key:{input:"item_id"}. Choose key or where, not both.\n// For deletion from an exhaustive array or map: proof.absent: true with select: {path:"/items",where:[{path:"/id",input:"item_id"}],complete:true}. complete:true declares the read exhaustive; never use a partial page. A targeted absence proof without select still requires HTTP 404.\n// For valid readback variants, keep identity equals and add proof.response: {path:"/state",schema:{enum:["ready","empty"]}}, relative to the selected member. Exclude pending states; use proof-only reads after completion.\n// Repair a failed response/proof with discover run --proof-only; it reuses the saved primary response and sends only context checks, remaining navigation reads and readback. Publication still needs a successful test and accepted semantic review.\n// For large collections, investigate native search/filter/detail routes before enumeration. Search saved results locally and inspect only matching records; preserve structured dynamic fields.\n// After selecting a captured request, discover capture auth runs a bounded default search without authField or authScope. Set either only to narrow an observed field or location; browser-managed cookies need no locator.\n' : "";
|
|
31463
|
+
const captureGuidance = kind === "action" ? '// effect is read, create, update or delete. Before the first run, build verification.inputs as the smallest advertised call from published sources: omit optional inputs together and exercise caller defaults. A configured author target does not prove an optional prerequisite: require its input or validate stored configuration with request.prepare. Every authored top-level default must match the test; revise unsupported defaults before dispatch. Missing sources are not arbitrary JSON.\n// Public descriptions explain behavior, consequences and limits; do not instruct consumers to repeat runtime proof or browser checks. Author verification is separate from consumer judgment.\n// String values may compose scalars, e.g. request.body: {filters:["queue.eq({input.queue_id})"]}; constrain inputs to the observed grammar. Whole values use {"$input":"name"}; URL templates percent-encode, JSON strings are JSON-escaped once. Missing or structured operands fail before dispatch.\n// Independent collection comparisons may declare ignore:[{path:"/*/score",reason:"Ranking is recalculated per request."}]. Ignore only observed volatile scalar fields, never identity or promised outcome fields; full schema validation, stable fields, membership and order remain checked.\n// HTML: response.format="html" requires html.marker and html.fields with observed CSS selectors; extraction is inert and produces JSON before schema validation. Form requests use request.form, excluding body; request.prepare performs one GET and supplies internal {"$prepared":"/path"} values for CSRF and preservation.\n// Declared response.continue rules follow at most five same-origin GET destinations from JSON path or HTML selector/attribute; rejected writes never navigate. Repair with proof-only, never repeat the write.\n// Request JSON/query uses typed {"$input":"name"} bindings; URL segments use {input.name}. Resolve every {unresolved.N} marker from retained evidence before running.\n// App-owned input source annotation: {"x-source":{"action":"ticket.list","path":"/*/id"}}. Run the source explicitly; it never runs implicitly.\n// Keep only invariant protocol values constant; selected app values are inputs, even when public. Generalize one action across its supported choices.\n// Materially different request shapes, conditional prerequisites, closed protocol enum choices and declared format variants need successful evidence or a constrained input schema. Broad date-time includes UTC and offset forms. Optional x-source inputs need presence and omission evidence, or declare them required. Keep app-owned catalog choices dynamic through sources; do not enumerate catalog IDs, all combinations or a second mutation. Constraints appear in consumer help. Use the existing test for the most consequential unresolved choice.\n// Trace the requested consumer path through existing-target lookup, configuration and the result needed next; publish verified prerequisites independently and require the complete path at task completion. Compare related actions by effect and choices, not endpoint.\n// For updates, choose populated non-default unrelated settings before the existing test; compare their before/after values. Already-empty settings cannot prove preservation. If the app resets them, document that observed behavior when authorized; do not claim preservation.\n// Require essential identity/result members in response.schema; leave incidental inferred types provisional and preserve extra observed keys. discover check and publish recheck compatible saved cases locally, including after edits and schema narrowing; do not write a duplicate schema-check script or repeat an app call. Preserve valid empty collections, optional fields, bodyless results and original value types.\n// Declare verification.outcome: {kind,path?,fields?,identity?,states?}. kind is record, collection, lookup, execution or usage. path defaults to the projected output root; fields are relative JSON Pointers. Record reads compare all required result fields and declared fields. Collection requires nonempty entire-collection equality and local empty-result schema acceptance. Use a naturally empty search/filter boundary when reachable; never mutate or enumerate to manufacture one. Local acceptance is not an observed app boundary. Lookup requires a whole positive record or all essentials, plus null/empty object/HTTP 404 absence. Arrays cannot use record.\n// Read verification.expect compares each path with exactly one input, value or independent file/from source; from selects the file subtree. Example entire-collection expectation: [{"path":"","file":"/absolute/independent-tickets.json"}]. Derive expectations from intended inputs, docs/UI or independent saved evidence, never copy actual output as expectation. A mutation record reuses proof.equals without duplicate verification.expect.\n// Execution outcome identity and distinct state/output fields refer to the saved selected proof record. Compare both with proof.equals; states lists allowed observed lifecycle states. A request acknowledgement does not establish actual started/completed execution. Usage fields require independent file-backed expectations; literals, input echoes and the same output do not reconcile actual usage/cost. A raw counter may use record only with honest limits and an explicit actual-cost gap.\n// Reuse saved primary and boundary cases first. Only for a missing read boundary, verification.boundary: {inputs:{query:"no matching ticket"},expect:[{path:"",value:[]}]} permits one automatic read-only probe through this action; status:404 with expect:[] declares an observed missing lookup. Never add a mutation boundary or repeat its write.\n// Local checks never accept semantic review. Accept verification.review only after comparing the promised result, configuration and preservation; review affected descriptions and source/result paths together. Complete the requested consumer path or state its real unresolved gap; never freeze one provider or account scope to conceal missing coverage.\n// A readback through POST requires proof.effect: "read" alongside proof.request; HTTP method alone does not determine semantic effect.\n// JSON object keys may use {input.name}, e.g. {"{input.attribute_id}":{"$input":"value"}}.\n// Discovery-only mutation proof compares a readback path with exactly one input, primary result path or internal JSON value: equals: [{"path":"/ready","value":true}]. Create/update must compare a meaningful body/form value or explicit changed state; URL/selection inputs and returned identity alone do not prove the change. Preserve false, 0, null and objects. Public literals require semantic review; fixed proof expectations are not caller flags.\n// Proof URLs bind returned identifiers with {result./id}; JSON bodies/query use {"$result":"/id"}. Readback pointers may use a complete {input.name} or {result./id} segment for a dynamic key; slashes and tildes in its value are escaped.\n// For one member of a nested array or object map: select: {"path":"/ticket/fields","where":[{"path":"/id","result":"/id"}]}; equals paths then refer to the single matching member. Compare identity and meaningful changed fields, not entire objects.\n// Select an object-map member by its key when values do not contain IDs: select: {path:"/items",key:{result:"/id"}} or key:{input:"item_id"}. Choose key or where, not both.\n// For deletion from an exhaustive array or map: proof.absent: true with select: {path:"/items",where:[{path:"/id",input:"item_id"}],complete:true}. complete:true declares the read exhaustive; never use a partial page. A targeted absence proof without select still requires HTTP 404.\n// For valid readback variants, keep identity equals and add proof.response: {path:"/state",schema:{enum:["ready","empty"]}}, relative to the selected member. Exclude pending states; use proof-only reads after completion.\n// Repair a failed response/proof with discover run --proof-only; it reuses the saved primary response and sends only context checks, remaining navigation reads and readback. Publication still needs a successful test and accepted semantic review.\n// For large collections, investigate native search/filter/detail routes before enumeration. Search saved results locally and inspect only matching records; preserve structured dynamic fields.\n// After selecting a captured request, discover capture auth runs a bounded default search without authField or authScope. Set either only to narrow an observed field or location; browser-managed cookies need no locator.\n' : "";
|
|
31431
31464
|
return `${head}${metadataGuidance(kind)}${visibilityGuidance}${probeGuidance}${tabGuidance}${captureGuidance}${JSON.stringify(templates[kind], null, 2)}
|
|
31432
31465
|
`;
|
|
31433
31466
|
}
|
|
@@ -31907,7 +31940,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
31907
31940
|
const transport = async (input2, init) => {
|
|
31908
31941
|
const method = init?.method ?? "GET";
|
|
31909
31942
|
const headers = new Headers(init?.headers);
|
|
31910
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1");
|
|
31943
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1");
|
|
31911
31944
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
31912
31945
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
31913
31946
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -40767,6 +40800,11 @@ function bind(value, inputs, generated, output2, preserveEmptyObject = false, pr
|
|
|
40767
40800
|
if (!Object.keys(target).length && Object.keys(object28).length && !preserveEmptyObject) return omit2;
|
|
40768
40801
|
return target;
|
|
40769
40802
|
}
|
|
40803
|
+
if (typeof value === "string") return value.replace(/\{(input|generated|result)\.([^{}]*)\}/gu, (_, kind, ref) => {
|
|
40804
|
+
const selected = kind === "input" ? inputs[ref] : kind === "generated" ? generated[ref] : pointer4(output2, ref);
|
|
40805
|
+
if (!["string", "number", "boolean"].includes(typeof selected) || typeof selected === "number" && !Number.isFinite(selected)) throw new Error(`String binding ${kind}.${ref} needs a supplied string, number or boolean`);
|
|
40806
|
+
return String(selected);
|
|
40807
|
+
});
|
|
40770
40808
|
return value;
|
|
40771
40809
|
}
|
|
40772
40810
|
function urlTemplate(value, inputs, generated, output2) {
|
|
@@ -41559,10 +41597,10 @@ async function executeDraftVerification(input2) {
|
|
|
41559
41597
|
}
|
|
41560
41598
|
}, credential2, credentialDraftId, allowNonJsonProbe, void 0, { tab: input2.browserTab || input2.state.browserTab(input2.session.id, input2.appId), appSlug: input2.appSlug, prefix: input2.commandPrefix, ownerSession: input2.session.id, client: liveBrowser, execution: browserExecution });
|
|
41561
41599
|
} catch (error62) {
|
|
41562
|
-
if (
|
|
41563
|
-
|
|
41564
|
-
dispatched = false;
|
|
41600
|
+
if (prior && input2.kind === "action" && action && "effect" in action && action.effect !== "read") {
|
|
41601
|
+
throw new BrowserControlError(`The mutation was already dispatched; its browser readback failed. Repair the browser connection, then ${input2.commandPrefix ?? "apilift"} discover run --proof-only; do not repeat the mutation`, error62?.code ?? "browser-readback-failed", true);
|
|
41565
41602
|
}
|
|
41603
|
+
if (error62 instanceof BrowserControlError && !error62.dispatched) dispatched = prior;
|
|
41566
41604
|
throw error62;
|
|
41567
41605
|
}
|
|
41568
41606
|
}
|
|
@@ -42422,6 +42460,26 @@ var init_credentials2 = __esm({
|
|
|
42422
42460
|
// src/discovery/api-observation.ts
|
|
42423
42461
|
import { createHash as createHash9 } from "node:crypto";
|
|
42424
42462
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
42463
|
+
function observationValidators(schema, name, property) {
|
|
42464
|
+
const signature = canonicalJson(schema);
|
|
42465
|
+
let compiler = inputCompilers.get(schema);
|
|
42466
|
+
if (!compiler || compiler.signature !== signature) {
|
|
42467
|
+
const ajv6 = new import__5.default({ strict: false, validateFormats: true });
|
|
42468
|
+
(0, import_ajv_formats2.default)(ajv6);
|
|
42469
|
+
compiler = { signature, ajv: ajv6, validators: /* @__PURE__ */ new Map() };
|
|
42470
|
+
inputCompilers.set(schema, compiler);
|
|
42471
|
+
}
|
|
42472
|
+
let compiled = compiler.validators.get(name);
|
|
42473
|
+
if (!compiled) {
|
|
42474
|
+
const shared = { ...object5(schema.$defs) ? { $defs: schema.$defs } : {}, ...object5(schema.definitions) ? { definitions: schema.definitions } : {} };
|
|
42475
|
+
compiled = {
|
|
42476
|
+
validate: compiler.ajv.compile({ ...shared, ...property }),
|
|
42477
|
+
...property.contentMediaType === "application/json" && object5(property.contentSchema) ? { content: compiler.ajv.compile({ ...shared, ...property.contentSchema }) } : {}
|
|
42478
|
+
};
|
|
42479
|
+
compiler.validators.set(name, compiled);
|
|
42480
|
+
}
|
|
42481
|
+
return compiled;
|
|
42482
|
+
}
|
|
42425
42483
|
function compileObservation(raw, definition2, load2) {
|
|
42426
42484
|
if (!object5(raw) || typeof raw.file !== "string" || !raw.file || Object.keys(raw).some((k) => !["file", "path", "unordered", "unorderedAt", "sha256"].includes(k))) throw Error("Observation needs file and optional path, unordered, unorderedAt and sha256");
|
|
42427
42485
|
if (raw.path !== void 0 && typeof raw.path !== "string" || raw.unordered !== void 0 && typeof raw.unordered !== "boolean") throw Error("Observation path must be a JSON Pointer and unordered a boolean");
|
|
@@ -42438,13 +42496,11 @@ function compileObservation(raw, definition2, load2) {
|
|
|
42438
42496
|
if (!object5(record3) || record3.method !== request2.method || typeof record3.path !== "string" || !object5(record3.query) || !Number.isInteger(record3.status) || Number(record3.status) < 200 || Number(record3.status) >= 300 || !Object.hasOwn(record3, "body")) throw Error("Observation needs the matching method, path, query, successful status and body");
|
|
42439
42497
|
const schema = object5(definition2.inputs) ? definition2.inputs : { type: "object", properties: {} };
|
|
42440
42498
|
const properties = object5(schema.properties) ? schema.properties : {};
|
|
42441
|
-
const ajv6 = new import__5.default({ strict: false, validateFormats: true });
|
|
42442
|
-
(0, import_ajv_formats2.default)(ajv6);
|
|
42443
42499
|
const inputs = {};
|
|
42444
42500
|
const input2 = (name, value2, encoding) => {
|
|
42445
42501
|
const property = properties[name];
|
|
42446
42502
|
if (!object5(property)) throw Error(`Observed input ${name} has no schema`);
|
|
42447
|
-
const
|
|
42503
|
+
const { validate: validate2, content } = observationValidators(schema, name, property);
|
|
42448
42504
|
const candidates = [value2];
|
|
42449
42505
|
if (typeof value2 === "string") {
|
|
42450
42506
|
if (["json", "json-content"].includes(String(encoding))) {
|
|
@@ -42457,7 +42513,6 @@ function compileObservation(raw, definition2, load2) {
|
|
|
42457
42513
|
if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/u.test(value2)) candidates.push(Number(value2));
|
|
42458
42514
|
if (value2 === "true" || value2 === "false") candidates.push(value2 === "true");
|
|
42459
42515
|
}
|
|
42460
|
-
const content = property.contentMediaType === "application/json" && object5(property.contentSchema) ? ajv6.compile({ ...object5(schema.$defs) ? { $defs: schema.$defs } : {}, ...object5(schema.definitions) ? { definitions: schema.definitions } : {}, ...property.contentSchema }) : void 0;
|
|
42461
42516
|
const matching = candidates.filter((candidate2) => {
|
|
42462
42517
|
if (!validate2(candidate2)) return false;
|
|
42463
42518
|
if (content && typeof candidate2 === "string") {
|
|
@@ -42518,13 +42573,15 @@ function jsonObservationCases(definition2, compiled) {
|
|
|
42518
42573
|
}
|
|
42519
42574
|
return variants;
|
|
42520
42575
|
}
|
|
42521
|
-
var import__5, import_ajv_formats2, object5, pointer5;
|
|
42576
|
+
var import__5, import_ajv_formats2, object5, inputCompilers, pointer5;
|
|
42522
42577
|
var init_api_observation = __esm({
|
|
42523
42578
|
"src/discovery/api-observation.ts"() {
|
|
42524
42579
|
"use strict";
|
|
42525
42580
|
import__5 = __toESM(require__(), 1);
|
|
42526
42581
|
import_ajv_formats2 = __toESM(require_dist(), 1);
|
|
42582
|
+
init_json();
|
|
42527
42583
|
object5 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
42584
|
+
inputCompilers = /* @__PURE__ */ new WeakMap();
|
|
42528
42585
|
pointer5 = (root2, path2) => {
|
|
42529
42586
|
if (path2 !== "" && (!path2.startsWith("/") || /~(?![01])/u.test(path2))) throw Error("Observation projection must be a JSON Pointer");
|
|
42530
42587
|
let value = root2;
|
|
@@ -46761,9 +46818,24 @@ var init_response_examples = __esm({
|
|
|
46761
46818
|
|
|
46762
46819
|
// src/discovery/input-coverage.ts
|
|
46763
46820
|
import { isDeepStrictEqual as isDeepStrictEqual6 } from "node:util";
|
|
46821
|
+
function rememberCompilation(key, valid2) {
|
|
46822
|
+
if (key === void 0) return;
|
|
46823
|
+
if (documentedCompilations.size >= 32) documentedCompilations.delete(documentedCompilations.keys().next().value);
|
|
46824
|
+
documentedCompilations.set(key, valid2);
|
|
46825
|
+
}
|
|
46764
46826
|
function inputCoverageIssues(schema, successfulInputs, policy = "observed") {
|
|
46765
46827
|
if (!object26(schema)) return [];
|
|
46766
46828
|
const issues = [];
|
|
46829
|
+
let compilationKey;
|
|
46830
|
+
if (policy === "documented") {
|
|
46831
|
+
try {
|
|
46832
|
+
const key = canonicalJson(schema);
|
|
46833
|
+
if (Buffer.byteLength(key) <= 64 * 1024) compilationKey = key;
|
|
46834
|
+
} catch {
|
|
46835
|
+
}
|
|
46836
|
+
const compiled = compilationKey === void 0 ? void 0 : documentedCompilations.get(compilationKey);
|
|
46837
|
+
if (compiled !== void 0) return compiled ? [] : compilationIssues();
|
|
46838
|
+
}
|
|
46767
46839
|
const ajv6 = new import__14.default({ strict: false, allErrors: false, validateFormats: true });
|
|
46768
46840
|
(0, import_ajv_formats11.default)(ajv6);
|
|
46769
46841
|
const root2 = { ...schema };
|
|
@@ -46777,9 +46849,13 @@ function inputCoverageIssues(schema, successfulInputs, policy = "observed") {
|
|
|
46777
46849
|
ajv6.addSchema({ ...references2(root2), $id: rootId }, rootId);
|
|
46778
46850
|
ajv6.getSchema(rootId);
|
|
46779
46851
|
} catch {
|
|
46780
|
-
|
|
46852
|
+
rememberCompilation(compilationKey, false);
|
|
46853
|
+
return compilationIssues();
|
|
46854
|
+
}
|
|
46855
|
+
if (policy === "documented") {
|
|
46856
|
+
rememberCompilation(compilationKey, true);
|
|
46857
|
+
return [];
|
|
46781
46858
|
}
|
|
46782
|
-
if (policy === "documented") return [];
|
|
46783
46859
|
const validators = /* @__PURE__ */ new Map();
|
|
46784
46860
|
const valid2 = (candidate2, value) => {
|
|
46785
46861
|
try {
|
|
@@ -46917,7 +46993,7 @@ function inputCoverageIssues(schema, successfulInputs, policy = "observed") {
|
|
|
46917
46993
|
walk(root2, examples, "/definition/inputs", /* @__PURE__ */ new Set(), 0);
|
|
46918
46994
|
return issues;
|
|
46919
46995
|
}
|
|
46920
|
-
var import__14, import_ajv_formats11, object26, escape5;
|
|
46996
|
+
var import__14, import_ajv_formats11, object26, escape5, documentedCompilations, compilationIssues;
|
|
46921
46997
|
var init_input_coverage = __esm({
|
|
46922
46998
|
"src/discovery/input-coverage.ts"() {
|
|
46923
46999
|
"use strict";
|
|
@@ -46926,6 +47002,8 @@ var init_input_coverage = __esm({
|
|
|
46926
47002
|
import_ajv_formats11 = __toESM(require_dist(), 1);
|
|
46927
47003
|
object26 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
46928
47004
|
escape5 = (value) => value.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
47005
|
+
documentedCompilations = /* @__PURE__ */ new Map();
|
|
47006
|
+
compilationIssues = () => [{ path: "/definition/inputs", message: "Input evidence cannot be checked until the input schema compiles" }];
|
|
46929
47007
|
}
|
|
46930
47008
|
});
|
|
46931
47009
|
|
|
@@ -46975,7 +47053,15 @@ function outcomeIssues(action, outcomeValue, cases, phase = "evidence", document
|
|
|
46975
47053
|
if (!pointer10(path2) || outcome.identity !== void 0 && !pointer10(outcome.identity)) return [{ path: goalPath, message: "Use JSON Pointers for the outcome path, fields and identity" }];
|
|
46976
47054
|
const fields = outcome.fields ?? [];
|
|
46977
47055
|
const successful = cases.filter((test) => test.status === void 0 || test.status >= 200 && test.status < 300);
|
|
46978
|
-
const expectationsCover = (test, field, fileOnly = false) => test.expect.some((expected) =>
|
|
47056
|
+
const expectationsCover = (test, field, fileOnly = false) => test.expect.some((expected) => {
|
|
47057
|
+
if (!pointer10(expected.path) || !covers(expected.path, field) || fileOnly && typeof expected.file !== "string") return false;
|
|
47058
|
+
const target = field.slice(expected.path.length).split("/");
|
|
47059
|
+
return !(expected.ignore ?? []).some((ignored2) => {
|
|
47060
|
+
const parts2 = ignored2.path.split("/");
|
|
47061
|
+
if (outcome.kind === "collection" && field === path2 && parts2.length > target.length) return false;
|
|
47062
|
+
return parts2.slice(0, Math.min(parts2.length, target.length)).every((part, index2) => part === target[index2] || part === "*" && /^(?:0|[1-9][0-9]*)$/u.test(target[index2] ?? ""));
|
|
47063
|
+
});
|
|
47064
|
+
});
|
|
46979
47065
|
const resultSchema = object27(definition2.response) ? definition2.response.schema : void 0;
|
|
46980
47066
|
const schemaAt = (target) => {
|
|
46981
47067
|
let node2 = resultSchema;
|
|
@@ -47120,7 +47206,26 @@ var init_outcome_review = __esm({
|
|
|
47120
47206
|
});
|
|
47121
47207
|
|
|
47122
47208
|
// src/discovery/capture-derivation.ts
|
|
47209
|
+
function requestEncoding(entry2) {
|
|
47210
|
+
const raw = String(Object.entries(entry2.reqHeaders ?? {}).find(([name]) => name.toLowerCase() === "content-type")?.[1] ?? "");
|
|
47211
|
+
const type = raw.split(";", 1)[0].trim().toLowerCase();
|
|
47212
|
+
const mediaType = /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u.test(type) && type.length <= 100 ? type : "unknown";
|
|
47213
|
+
if (mediaType === "application/x-www-form-urlencoded") return { mediaType, encoding: "urlencoded", reason: "Scalar and repeated form fields are supported" };
|
|
47214
|
+
if (mediaType.startsWith("multipart/")) return { mediaType, encoding: "multipart", reason: "Multipart parts and file uploads are not supported; Chrome may omit file bytes" };
|
|
47215
|
+
try {
|
|
47216
|
+
JSON.parse(String(entry2.reqBody));
|
|
47217
|
+
if (typeof entry2.reqBody === "string") return { mediaType, encoding: "json", reason: "JSON body is supported" };
|
|
47218
|
+
} catch {
|
|
47219
|
+
}
|
|
47220
|
+
return { mediaType, encoding: mediaType === "application/json" || mediaType.endsWith("+json") ? "invalid-json" : "unsupported", reason: "No complete JSON or declared URL-encoded body is available; do not guess a replay body or repeat a mutation" };
|
|
47221
|
+
}
|
|
47123
47222
|
function deriveRequest(entry2, inputs) {
|
|
47223
|
+
const state = entry2.reqBodyState;
|
|
47224
|
+
if (entry2.pending || state !== void 0 && !["complete", "absent"].includes(String(state))) {
|
|
47225
|
+
const encoding = requestEncoding(entry2);
|
|
47226
|
+
throw new Error(`Captured request body is ${entry2.pending ? "collecting" : String(state)} (media type: ${encoding.mediaType}; encoding: ${encoding.encoding}). Use retained evidence or an authorized alternative; do not repeat a mutation`);
|
|
47227
|
+
}
|
|
47228
|
+
if (entry2.reqBody == null && Number(entry2.reqHeaders?.["content-length"]) > 0) throw new Error("Captured request declares a nonempty body but retained no body. Do not author a bodyless replay or repeat the mutation");
|
|
47124
47229
|
const url3 = new URL(String(entry2.url));
|
|
47125
47230
|
const unresolved2 = [];
|
|
47126
47231
|
const secrets = new Set(Object.entries(entry2.reqHeaders ?? {}).filter(([name]) => sensitive.test(name)).flatMap(([, value]) => typeof value === "string" ? [value, value.replace(/^(Bearer|Basic) /i, "")] : []));
|
|
@@ -47168,8 +47273,8 @@ function deriveRequest(entry2, inputs) {
|
|
|
47168
47273
|
}
|
|
47169
47274
|
if (Object.keys(query).length) request2.query = query;
|
|
47170
47275
|
if (typeof entry2.reqBody === "string" && entry2.reqBody.length) {
|
|
47171
|
-
const
|
|
47172
|
-
if (
|
|
47276
|
+
const encoding = requestEncoding(entry2);
|
|
47277
|
+
if (encoding.encoding === "urlencoded") {
|
|
47173
47278
|
const fields = new URLSearchParams(entry2.reqBody), form = /* @__PURE__ */ Object.create(null);
|
|
47174
47279
|
for (const name of new Set(fields.keys())) {
|
|
47175
47280
|
const values = fields.getAll(name);
|
|
@@ -47181,7 +47286,7 @@ function deriveRequest(entry2, inputs) {
|
|
|
47181
47286
|
try {
|
|
47182
47287
|
body = JSON.parse(entry2.reqBody);
|
|
47183
47288
|
} catch {
|
|
47184
|
-
throw new Error(
|
|
47289
|
+
throw new Error(`Captured request cannot be authored (media type: ${encoding.mediaType}; encoding: ${encoding.encoding}). ${encoding.reason}`);
|
|
47185
47290
|
}
|
|
47186
47291
|
request2.body = bind2(body, "/request/body");
|
|
47187
47292
|
}
|
|
@@ -48758,7 +48863,7 @@ async function captureView(item, part, pointer11, scopeId, root2, invocation) {
|
|
|
48758
48863
|
`;
|
|
48759
48864
|
})() : "";
|
|
48760
48865
|
const artifact = entry2[part === "request" ? "reqBodyArtifact" : "resBodyArtifact"];
|
|
48761
|
-
if ((artifact ||
|
|
48866
|
+
if ((artifact || entry2.pending) && body === null) return fail5(`Captured ${part} body for c${item.seq} is still collecting. Retry ${command4(invocation, `discover capture show c${item.seq}${part === "request" ? " --part request" : ""}`)}; no app request is sent.
|
|
48762
48867
|
`, 12);
|
|
48763
48868
|
if (typeof body !== "string" && part === "request") return ok4(`Captured request metadata for c${item.seq}; body is ${String(unavailable ?? "absent")}.
|
|
48764
48869
|
${redactionReason}${candidateLine(item)}
|
|
@@ -48781,8 +48886,12 @@ ${redactionReason}`);
|
|
|
48781
48886
|
${JSON.stringify(inspectHtml(body, invocation.options.selector), null, 2)}
|
|
48782
48887
|
Inspect at most 20 matching elements with --selector <CSS-selector>. This reads retained evidence; it sends no app request.
|
|
48783
48888
|
`);
|
|
48784
|
-
} else
|
|
48889
|
+
} else {
|
|
48890
|
+
const encoding = requestEncoding(part === "request" ? entry2 : { reqHeaders: headers, reqBody: body });
|
|
48891
|
+
return fail5(`Captured ${part} for c${item.seq} cannot be authored. Media type: ${encoding.mediaType}; encoding: ${encoding.encoding}. ${encoding.reason}.
|
|
48892
|
+
Metadata: ${candidateLine(item)}
|
|
48785
48893
|
`);
|
|
48894
|
+
}
|
|
48786
48895
|
}
|
|
48787
48896
|
if (pointer11) {
|
|
48788
48897
|
if (!pointer11.startsWith("/")) return fail5("--pointer must be a JSON pointer beginning with /.\n");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Name a precise domain `entity.verb` for the requested outcome. Before transport capture, define its entity, semantic effect, caller decisions, useful returned result, and independent proof of a mutation. Compare related published actions by effect and supported choices before drafting; extend the same operation rather than duplicate a selection, but do not merge distinct effects merely because they share an endpoint. Do not expand one read into general CRUD coverage. Check whether returned objects are the requested entities or containers requiring traversal and pagination. HTTP success and a matching title do not establish complete coverage.
|
|
4
4
|
|
|
5
|
-
An action's published `definition` describes its effect, JSON Schema `inputs`, request, response and, for a mutation, readback proof. `dependencies.transport` selects one published connection and is translated to the action's selected transport at publication. Request fields include method, URL, optional headers, query and either JSON body or URL-encoded `form`. Use typed `{"$input":"name"}` and
|
|
5
|
+
An action's published `definition` describes its effect, JSON Schema `inputs`, request, response and, for a mutation, readback proof. `dependencies.transport` selects one published connection and is translated to the action's selected transport at publication. Request fields include method, URL, optional headers, query and either JSON body or URL-encoded `form`. Use typed `{"$input":"name"}` for whole JSON values. Inside JSON strings, forms, query values and headers, `{input.name}` composes a supplied string, number or Boolean once; URL templates percent-encode the value. For example, `{"filters":["opened.in({input.start_date}..{input.end_date})","queue.eq({input.queue_id})"]}` preserves fixed delimiters and JSON-escapes the completed string. Constrain dates and identifiers with input formats or patterns matching the observed filter grammar; arbitrary text is not automatically escaped for an app-specific filter language. Missing, null or structured string operands fail before dispatch. Constants must be invariant for the operation: a public catalog selection is still an input. Generalize the same action when selections vary instead of adding example-specific or generic duplicates. Captured account identifiers, credential values and local defaults are not protocol constants. Use generated bindings for fresh request identifiers, never a caller flag invented from a captured identifier.
|
|
6
6
|
|
|
7
7
|
Public action names and descriptions state actual behavior, consequences and limits. Review the affected actions and dependencies together: source and result instructions must match consumer-visible paths, app/entity prose must distinguish domain capabilities from available coverage, and transport instructions must describe supported access requirements. Author verification establishes publication evidence; published execution validates the response without automatic readback. Consumers decide whether their task needs state confirmation through a published read; do not prescribe routine browser inspection.
|
|
8
8
|
|
|
@@ -22,6 +22,8 @@ Before the action test, declare `verification.outcome: {kind,path?,fields?,ident
|
|
|
22
22
|
|
|
23
23
|
For read cases, `verification.expect` compares saved output with exactly one expected source: input, literal value or independent saved JSON file. Each `path` selects saved output; `from` selects a file subtree and defaults to its root. For example, a complete ticket collection can use `[{path:"",file:"/absolute/independent-tickets.json"}]`; a record can compare both `[{path:"/id",input:"ticket_id"},{path:"/active",value:false}]`. Derive expectations from the intended outcome, documentation, UI or independent evidence, never by copying the actual response. Mutation record `proof.equals` comparisons supply their existing proof; do not duplicate them. Run, local check and publication use the same applicable definition and saved-evidence checks. Local check and publication check expectations locally without app calls; their success does not accept semantic review. Use `discover check` after local response projection or schema repairs; it rechecks the retained raw response and current expectations without another app request. Otherwise follow the returned recovery command, not a routine check step. Stop dependent commands after failure; apply the skill’s resource-level batch recovery without tracebacks or false success.
|
|
24
24
|
|
|
25
|
+
When independent responses differ only in an observed volatile scalar, add a narrow exclusion to that comparison: `{path:"",file:"/absolute/independent-articles.json",ignore:[{path:"/*/score",reason:"The app recalculates this ranking score per request."}]}`. Exclusion paths are relative to the selected comparison; `*` traverses array members. Keep identifiers, stable fields, membership and ordering compared. Each excluded field must remain present, and records or arrays cannot be excluded. The raw response and full response-schema validation remain intact. Do not exclude a field that establishes the promised outcome. Use `unordered:true` separately only for a genuinely unordered collection.
|
|
26
|
+
|
|
25
27
|
Reuse the existing primary case and compatible saved evidence before adding a read. If only the collection-empty or lookup-missing boundary is absent, `verification.boundary: {inputs:{query:"no matching ticket"},expect:[{path:"",value:[]}]}` permits one automatic read-only probe through the same action. For an observed missing-record response, declare `status:404` with its boundary inputs and `expect:[]`; the saved HTTP status supplies absence evidence. Do not add boundary probes to mutations. Boundary evidence supplements the primary result; it does not replace nonempty collection or positive lookup evidence. Successful cases remain available across edits and schema narrowing when their request and effective inputs remain compatible; local gates recheck the current contract without repeating app calls.
|
|
26
28
|
|
|
27
29
|
During discovery, a mutation needs a separate read-only proof request and meaningful comparisons to the intended state. A create must compare a meaningful created value, and an update must compare a requested body or form value or an explicit changed state. Selector inputs used in the URL or proof selection and returned-identity checks alone do not prove the change; preserve `false`, `0`, `null` and structured values in comparisons. An update changes only requested settings: omitted values preserve existing state unless the contract explicitly describes replacement or reset semantics. Compare the readback for the intended change and preservation of settings the request could overwrite; preservation claims must match the saved before/after evidence. Full replacement requires a consumer-accessible complete state; do not copy create defaults or unrelated empty objects into a narrow update. Do not try undocumented update fields to rescue preservation; investigate docs or UI first and declare observed replacement behavior only if scope permits. A proof failure leaves the write possibly applied. Repair the proof and use `apilift discover run --proof-only` against the saved primary response; this sends only context checks, remaining declared navigation reads and readback. Never repeat a possibly sent write just to get stronger proof. For a delete, an explicit absence proof may establish success. A readback or probe using POST may declare semantic `effect: "read"`; method alone is not the effect.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apilift/cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6-dev.1793958804.41be6f6ba98bbc3aaa65f7ce7268465be396c257",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=24.16.0 <27"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "41be6f6ba98bbc3aaa65f7ce7268465be396c257",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/egor-sergeev/apilift.git",
|