cornhsu-parity 0.13.1 → 1.0.0

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.
Files changed (2) hide show
  1. package/README.md +25 -4
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  ## GitHub Action
12
12
 
13
13
  ```yaml
14
- - uses: HSU-YU-MING/cornhsu-parity@v0.13.0 # pin exact versions while 0.x; a floating @v1 arrives with 1.0
14
+ - uses: HSU-YU-MING/cornhsu-parity@v1 # @v1 tracks the latest 1.x (interfaces frozen since 1.0)
15
15
  with:
16
16
  config: parity.config.json # optional, defaults to parity.config.json
17
17
  target: /pricing # optional, check only this route (omit for all)
@@ -63,11 +63,11 @@ PR comment, updating the same comment rather than adding new ones.
63
63
 
64
64
  | | |
65
65
  |---|---|
66
- | Releases | 22 on NuGet (v0.1.0 → v0.12.0). Pushing a tag publishes via OIDC Trusted Publishing — zero long-lived keys in the repo |
66
+ | Releases | 26 on NuGet (v0.1.0 → v1.0.0). Pushing a tag publishes via OIDC Trusted Publishing — zero long-lived keys in the repo |
67
67
  | Compared properties | Size, padding, spacing, typography, color (CIEDE2000 ΔE), relative position — **absolute coordinates are deliberately excluded** (they are guaranteed false positives in a flexible layout) |
68
68
  | Design sources | 4: the Figma API, a rendering snapshot, an image + annotations (pixel sampling — any tool that exports a PNG works), or JSON |
69
69
  | Implementation sources | The web (including **shadow DOM, same-origin iframes, and multiple responsive breakpoints**) plus **Electron** (attached to the live window over CDP) |
70
- | Tests | **160**, covering the CIEDE2000 reference data set (Sharma), match disambiguation, position false-positive guards, and image sampling |
70
+ | Tests | **202**, covering the CIEDE2000 reference data set (Sharma), match disambiguation, position false-positive guards, image sampling, and real-browser capture regressions |
71
71
  | Proven in CI | The GitHub Action is validated by **real PRs in an external repo**: blocking the PR, commenting automatically (updating in place), and baseline regression gating |
72
72
  | Proven in production | **All 21 pages of cornhsu.com are gated by Parity itself** — dogfooding has already found and fixed three flaky root causes (most recently a scroll-triggered entrance animation; see 0.11.1) |
73
73
 
@@ -184,6 +184,14 @@ parity snapshot # 1. Freeze the current rendering (writes parity.snap
184
184
  parity check # 2. Refactor fearlessly; 3. check proves it still matches the snapshot
185
185
  ```
186
186
 
187
+ ## Picking a Figma frame: three lessons from wild testing
188
+
189
+ Everything below was measured on public design-system files (IBM Carbon, Ant Design, Wikimedia Codex — method and full findings in `docs/野生實查-2026-08-11-路線B-figma方言.md`):
190
+
191
+ 1. **Pick a frame that draws *one screen*, not the component master sheet.** Design-system kits lay every variant out on a single sheet; that sheet shares no structure with any real page, so the match rate will hug the floor (measured: 0.2% on Carbon's Button sheet, 5.8% on Codex's) — that is the matcher being honest, not broken. To check a single component, pair a **single variant node** against a single Storybook story or one component on a demo page.
192
+ 2. **If the kit's text is placeholder text, go straight to the map file.** Auto-matching leans on text anchoring (same text on both sides), but library components often say "Button text" — which no real page ever does. Skip auto-matching and write `parity.map.json` directly (measured on Codex: all 129 Button variants use placeholder text; one map line completed the pairing).
193
+ 3. **Free-plan API quota is measured in *days* — spend it on new frames only.** Figma's free-plan quota is plan-level: one or two queries against a large file can drain it, and `Retry-After` comes back counted in days (hit twice during testing: 4.3 and 3.7 days). Frames you have fetched live on in `.parity/cache`, so reruns and offline compares cost nothing — the quota only goes to frames you have never fetched.
194
+
187
195
  ## What gets compared, and what does not
188
196
 
189
197
  Only the things that should hold no matter how the layout flows:
@@ -318,7 +326,7 @@ jobs:
318
326
  - run: |
319
327
  npm ci && npm run build
320
328
  npm run preview & # e.g. serving on localhost:8080
321
- - uses: HSU-YU-MING/cornhsu-parity@v0.13.0 # pin exact versions while 0.x
329
+ - uses: HSU-YU-MING/cornhsu-parity@v1 # @v1 tracks the latest 1.x
322
330
  with:
323
331
  config: parity.config.json
324
332
  figma-token: ${{ secrets.FIGMA_TOKEN }} # omit when the design source is a local JSON file
@@ -340,6 +348,12 @@ Action inputs: `config` / `target` / `working-directory` / `version` / `figma-to
340
348
  > nuget.org). This repo's own `.github/workflows/ci.yml` instead **builds from source** and runs
341
349
  > the offline demo as a self-check, so it does not depend on a published release.
342
350
 
351
+ ## Report vocabulary (for anyone parsing `report.json`)
352
+
353
+ - `severity` — **closed set** (spelling and membership frozen): `none` / `minor` / `medium` / `serious` / `critical`. `status`: `mismatch` / `missing`.
354
+ - `unmatched[].reason` — **open set**: parsers must tolerate unknown values; known spellings never change. Currently: `no-anchor`, `ambiguous-or-missing-text`, `randomized-id`, `size-implausible`.
355
+ - `nodes[].matchedBy` — **open set**, same rule. Currently: `selector`, `explicit`, `auto-text`, `auto-name`, `auto-container`.
356
+
343
357
  ## Regression gating: baselines (M5)
344
358
 
345
359
  A project that already has a pile of gaps cannot start at "zero gaps or no merge". A baseline
@@ -387,6 +401,13 @@ file is released immediately), and the engine's `BaselineComparer` is a pure, un
387
401
 
388
402
  ## See also
389
403
 
404
+ [**設計還原度怎麼自動檢查**](https://cornhsu.com/articles/figma-design-fidelity-check)
405
+ (in Traditional Chinese) — background on the whole category rather than this tool: what overlays,
406
+ pixel regression and property-level comparison each actually answer, why colour needs CIEDE2000
407
+ instead of hex equality, why absolute coordinates cannot be compared at all, and where this class
408
+ of tool does not help (SVG paths, font rasterisation, shadows, image cropping). It names the other
409
+ tools in the space and says when to pick one of them over this one.
410
+
390
411
  [**XamlContrast**](https://github.com/HSU-YU-MING/cornhsu-xamlcontrast) — a sibling project by the
391
412
  same author, built on the same philosophy: numeric checks that gate CI. Parity answers "**does the
392
413
  implementation match the design?**" (fidelity); XamlContrast answers "**can anyone actually see
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cornhsu-parity",
3
- "version": "0.13.1",
3
+ "version": "1.0.0",
4
4
  "description": "Property-Level Design QA that can gate your CI. Compares real numeric values from your Figma file against the rendered UI and fails the PR when the implementation drifts from the design.",
5
5
  "keywords": [
6
6
  "figma",
@@ -34,11 +34,11 @@
34
34
  "node": ">=18"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@cornhsu/parity-win32-x64": "0.13.1",
38
- "@cornhsu/parity-win32-arm64": "0.13.1",
39
- "@cornhsu/parity-linux-x64": "0.13.1",
40
- "@cornhsu/parity-linux-arm64": "0.13.1",
41
- "@cornhsu/parity-darwin-x64": "0.13.1",
42
- "@cornhsu/parity-darwin-arm64": "0.13.1"
37
+ "@cornhsu/parity-win32-x64": "1.0.0",
38
+ "@cornhsu/parity-win32-arm64": "1.0.0",
39
+ "@cornhsu/parity-linux-x64": "1.0.0",
40
+ "@cornhsu/parity-linux-arm64": "1.0.0",
41
+ "@cornhsu/parity-darwin-x64": "1.0.0",
42
+ "@cornhsu/parity-darwin-arm64": "1.0.0"
43
43
  }
44
44
  }