Snapshot Diff
quality.snapshot_diff
Overview
You send the snapshot you saved and the one you just produced, as text or as JSON, and we show you the difference the way a code review would: hunks with a few lines of context, each line marked as kept, added, or removed. First we tidy both sides the same way, using only the steps you ask for — drop the fields that change every run, settle on one line ending, trim trailing spaces — and JSON is put in a canonical shape so key order never shows up as a change. You also get a hash of each tidied side. Nothing is saved and no change is ever approved for you.
Snapshot tests fail for two reasons — something really changed, or a timestamp moved — and telling those apart by eye is exactly the work you wanted automated.
Reliability
The same pair and the same steps always give the same hunks and the same hashes, and nothing leaves the platform. A json snapshot is always canonicalised before comparing — keys sorted throughout, indented two spaces, one line ending — so key order and formatting never register as a change, which also means the hash is stable across serialisers. Five failures can stop the call. INVALID_JSON_SNAPSHOT means a side declared json but does not parse: fix the value and send it again. SNAPSHOT_TYPE_MISMATCH means one side is text and the other json, so set both types the same. NORMALIZER_INVALID means a step is configured wrong — json_path_remove without a paths array, a pointer not starting with a slash, json_path_remove on a text snapshot, or a line_endings value that is not lf, crlf, or cr. NORMALIZER_UNSUPPORTED means a step's type is not one of those three. DIFF_COMPLEXITY_LIMIT_EXCEEDED means the two sides multiply out past 25000000 token pairs, which mostly happens at character granularity: move to word or line, or compare smaller pieces. All five need a change from you, so retrying unchanged fails identically. A difference itself is a normal successful answer — read equal and hunks.
Context footprint
The reply carries every token inside each hunk, so it grows with how much changed rather than how big the snapshots are; lower maxDiffHunks or contextLines to keep it tight. A successful call costs 1 execution credit.
When to use it
When two snapshots disagree and you want to see how, minus the noisy fields.
When you want the new snapshot saved, or a judgement on whether it is fine.
Scope
Non-goals
- Does not write or update a stored snapshot
- Does not decide that a change is acceptable
- Does not judge whether two different wordings mean the same thing
- Does not run pattern replacements you invent — only the three tidying steps named here
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| expected | object | Yes | Closed saved snapshot with optional type text or json and a value holding the body. |
| actual | object | Yes | Closed produced snapshot shaped like expected; its type must match the other side. |
| normalizers | array | No | Tidying steps applied to both sides in listed order, 0 through 32 closed objects; omit it to compare after JSON canonicalisation only. |
| options | object | No | Closed diff controls for token size, context and hunk cap; omit the object for line granularity, 3 context lines and 200 hunks. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| equal | boolean | Yes | True when the tidied sides matched. |
| hunks | array | Yes | Changed regions in order, 0 through 200 closed hunks; empty when the sides match. |
| summary | object | Yes | Closed totals with added, removed and changed token counts plus lowercase SHA-256 hashes of each tidied side. |
| appliedNormalizers | array | Yes | Tidying step types applied, 0 through 32 strings in application order; empty when none were asked. |
| _meta | object | Yes | Closed bookkeeping with the token granularity, named diff profile and whether hunks were truncated. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"quality.snapshot_diff","input":{"expected":{"type":"text","value":"a"},"actual":{"type":"text","value":"a"}}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("quality.snapshot_diff", {"actual":{"type":"text","value":"a\nc"},"expected":{"type":"text","value":"a\nb"}});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| INVALID_JSON_SNAPSHOT | 400 | No | The request payload failed this skill's input validation. |
| SNAPSHOT_TYPE_MISMATCH | 400 | No | The request payload failed this skill's input validation. |
| NORMALIZER_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| NORMALIZER_INVALID | 400 | No | The request payload failed this skill's input validation. |
| DIFF_COMPLEXITY_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not write or update a stored snapshot
- Does not decide that a change is acceptable
- Does not judge whether two different wordings mean the same thing
- Does not run pattern replacements you invent — only the three tidying steps named here
- Saving or approving the new snapshot
- Comparing prose for meaning rather than characters
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "quality.snapshot_diff",
"input": {
"actual": {
"type": "text",
"value": "a\nc"
},
"expected": {
"type": "text",
"value": "a\nb"
}
}
}Examples
A single line replaced, shown with its neighbour
{
"actual": {
"type": "text",
"value": "a\nc"
},
"expected": {
"type": "text",
"value": "a\nb"
}
}{
"equal": false,
"appliedNormalizers": [],
"_meta": {
"granularity": "line",
"diffProfile": "text-diff-1",
"truncated": false
},
"summary": {
"expectedHash": "7e18f737311b2dc3b2f269dd78396b0351f14fb66efa879f768cb23181883c78",
"added": 1,
"changed": 1,
"removed": 1,
"actualHash": "9e58d7137c654f526a7a7c9cbab79c2e859b4dfbb579d1d6dd3aa4113a8a909b"
},
"hunks": [
{
"newCount": 2,
"oldCount": 2,
"lines": [
{
"value": "a",
"op": "context"
},
{
"value": "b",
"op": "remove"
},
{
"value": "c",
"op": "add"
}
],
"newStart": 1,
"oldStart": 1
}
]
}Two snapshots that match, with matching hashes
{
"actual": {
"type": "text",
"value": "ok"
},
"expected": {
"type": "text",
"value": "ok"
}
}{
"equal": true,
"appliedNormalizers": [],
"_meta": {
"granularity": "line",
"diffProfile": "text-diff-1",
"truncated": false
},
"summary": {
"expectedHash": "2689367b205c16ce32ed4200942b8b8b1e262dfc70d9bc9fbc77c49699a4f1df",
"added": 0,
"changed": 0,
"removed": 0,
"actualHash": "2689367b205c16ce32ed4200942b8b8b1e262dfc70d9bc9fbc77c49699a4f1df"
},
"hunks": []
}Recommended use cases
- Fail a snapshot test and show the reviewer exactly what moved
- Compare a golden file while ignoring the timestamp inside it
- Store the hash of a tidied snapshot and notice when output drifts
Avoid for
- Saving or approving the new snapshot
- Comparing prose for meaning rather than characters
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.