pipwave-ekyc-uikit 3.1.4-beta.1 → 3.2.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.
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: Write a release message for the current branch's changes in our house style
3
+ argument-hint: <Fix|Enhancement|New> [target-branch] [--short]
4
+ ---
5
+
6
+ Write a release message for the changes on the CURRENT branch, which are merging
7
+ into a target branch. Do not repeat prompting overhead back to me — just produce
8
+ the message.
9
+
10
+ ## Inputs (from "$ARGUMENTS")
11
+ - **Type** (required): one of `Fix`, `Enhancement`, `New` (case-insensitive; also accept `Fixes`).
12
+ - **Target branch** (optional): the branch these changes merge INTO. Default `origin/master`.
13
+ - **`--short`** (optional flag): also/instead produce a tighter one-liner.
14
+
15
+ If the type is missing or ambiguous, ask me once; otherwise proceed without questions.
16
+
17
+ ## Steps
18
+ 1. Resolve the target branch (default `origin/master`). Run:
19
+ - `git log <target>..HEAD --oneline --no-merges`
20
+ - `git diff <target>...HEAD --stat`
21
+ - `git diff <target>...HEAD -- <the changed source files>` (skip `dist/`, lockfiles, version-only bumps)
22
+ 2. Read the actual source diff to understand the real user/merchant-facing impact — do not
23
+ paraphrase the commit subject; describe what changed and why it matters to the user.
24
+ 3. Pull the Shortcut ID (`sc-XXXXXX`) from the branch name or commit subjects.
25
+ 4. Output ONE sentence (may use commas/clauses), prefixed with `[sc-XXXXXX]`.
26
+
27
+ ## House style by type
28
+
29
+ **Fix** — state the symptom that was broken, then the fix.
30
+ Open with "Fixed" or "Fixes".
31
+ > [sc-338198] Fixed selfie auto-capturing off-center or too-close faces by adding real-time centering and distance guards that block capture until the face is properly framed.
32
+
33
+ **Enhancement** — improves existing behavior. Open with an action verb ("Changed",
34
+ "Increased", "Skipped") or "<feature> now ...".
35
+ > [sc-326139] Increased camera capture area size to enhance resolution of submitted document images.
36
+
37
+ **New** — a brand-new capability. Open with "Introduced", "Added", or "Implemented".
38
+ > [sc-334995] Real-time card edge detection that automatically captures the document the moment its edges are properly aligned within the frame, with live on-screen feedback so users no longer have to tap the capture button themselves.
39
+
40
+ ## Tone rules
41
+ - User/merchant-facing outcome first, mechanism second. Not a changelog of files touched.
42
+ - One sentence. Concrete (name the feature/page/behavior), not abstract.
43
+ - No em dash "—"; use a colon or comma.
44
+ - No bold, headers, emoji, or bullet lists in the message itself.
45
+ - If `--short`, also give a tighter variant that keeps the `[sc-XXXXXX]` prefix and the core outcome.
46
+
47
+ After the message, offer light follow-ups (shorter version, different type framing) rather than over-producing.
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node_modules/.bin/vitest run *)",
5
+ "Bash(ls -la CLAUDE.md .claude/)",
6
+ "Bash(ls .claude/commands)",
7
+ "Bash(ls .claude/skills)"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,102 @@
1
+ # Code Review — `feature-teojunjie-sc-345185-fix-face-detection-deadlock`
2
+
3
+ **Base:** `origin/master` · **Head:** `61f7559`
4
+ **Scope:** `src/plugins/face-detection.ts` (+105/-22), `src/plugins/face-detection.test.ts` (new, +227)
5
+
6
+ Two commits: (1) fix selfie face-detection deadlock + hint flicker via a per-frame
7
+ position-hint debounce (`confirmPositionState`) and one-sided top-containment slack;
8
+ (2) apply the forehead-overestimate correction to the fill-ratio checks too
9
+ (`FACE_HEIGHT_MULTIPLIER` 1.6 → 1.3).
10
+
11
+ The debounce logic, the `disableDetection`/reset wiring, and the cross-file surface
12
+ all check out — every changed method and event name is private to the SDK, and the
13
+ public `listenTo*` callback contracts are unchanged, so no external caller breaks.
14
+
15
+ ---
16
+
17
+ ## Findings
18
+
19
+ ### 1. Shipped failing test — `isFaceDetected` top-overflow guard is not actually enforced (CONFIRMED, high)
20
+
21
+ **File:** [src/plugins/face-detection.test.ts:72](src/plugins/face-detection.test.ts#L72) (root cause in [src/plugins/face-detection.ts:34](src/plugins/face-detection.ts#L34) / [:248](src/plugins/face-detection.ts#L248))
22
+
23
+ The new test `"still rejects a face with a genuine top overflow beyond estimate noise"`
24
+ asserts `isFaceDetected(pos)` is `false`, but it returns `true`. **`vitest run` fails
25
+ (1 failed / 7 passed).**
26
+
27
+ The test face has top landmark `y = 68`, `h = 170`. The new top check is:
28
+
29
+ ```
30
+ withinTop = posFace.y - foreheadPadding > posCircle.y - topSlack
31
+ = 68 - (170*0.6) > 0 - (170*0.3)
32
+ = 68 - 102 > -51
33
+ = -34 > -51 → true (face accepted)
34
+ ```
35
+
36
+ Reducing to the effective requirement: `posFace.y > posCircle.y + 0.3*h`. The `0.3`
37
+ slack cancels half of the `0.6` forehead padding, so the top-containment guard only
38
+ requires ~0.3h of forehead clearance, not 0.6h. The face the author considered a
39
+ "genuine top crop" (`y=68`) still passes.
40
+
41
+ This is two problems in one:
42
+ - **CI is red** — a failing test is being committed.
43
+ - The comment at [:32-33](src/plugins/face-detection.ts#L32-L33) claims "a genuine top
44
+ crop (well beyond estimate noise) still fails" — the test demonstrates it does not.
45
+ Either `TOP_CONTAINMENT_SLACK_RATIO` (0.3) is too large, or the test's coordinates
46
+ are wrong. Decide which behavior is intended and align code + test.
47
+
48
+ **Failure scenario:** run `npm test`; the suite fails. In production, a face whose top
49
+ sits well above the intended forehead margin is accepted as "in frame".
50
+
51
+ ---
52
+
53
+ ### 2. `TOP_CONTAINMENT_SLACK_RATIO` comment does not match its value (low, maintainability)
54
+
55
+ **File:** [src/plugins/face-detection.ts:30-34](src/plugins/face-detection.ts#L30-L34)
56
+
57
+ The comment justifies the constant as "~0.1 covers the padding's average-case
58
+ overestimate (0.6 - 0.5); the rest is margin," but the value is `0.3` — i.e. 0.1 of
59
+ correction and 0.2 of pure leniency. Because this same 0.3 is also what defeats half
60
+ the forehead padding (finding #1) and is folded into `FACE_HEIGHT_MULTIPLIER = 1 + 0.6
61
+ - 0.3 = 1.3`, the effective assumption becomes "forehead ≈ 0.3h" everywhere. That is
62
+ internally consistent, but the stated reasoning (overestimate is only ~0.1) argues for
63
+ a much smaller slack. Reconcile the comment with the number so the next tuner isn't
64
+ misled about how much margin is deliberate.
65
+
66
+ ---
67
+
68
+ ### 3. Sustained oscillation between two failing position states can strand a stale hint (PLAUSIBLE, low)
69
+
70
+ **File:** [src/plugins/face-detection.ts:402-412](src/plugins/face-detection.ts#L402-L412)
71
+
72
+ `confirmPositionState` resets `candidatePositionCount` to 1 whenever the candidate
73
+ differs from the previous frame. If two *different* failing checks alternate every
74
+ frame (e.g. `faceTooClose` ↔ `faceTooFar` near their thresholds), neither ever reaches
75
+ `STABLE_FRAMES_TO_CHANGE_POSITION = 2`, so no new hint is emitted and `lastHintEvent`
76
+ stays at whatever was shown last — potentially a stale smile-stage prompt
77
+ (`userNoSmile`) while the face is actually mispositioned.
78
+
79
+ **Failure scenario:** user hovers at a distance where jitter flips between "too close"
80
+ and "too far" frame-to-frame; the on-screen guidance freezes on the previous message
81
+ instead of prompting a correction. Lower likelihood (jitter usually stays in one
82
+ category), but worth a bounded fallback if observed in the field.
83
+
84
+ ---
85
+
86
+ ### 4. Formatting nits (trivial)
87
+
88
+ **File:** [src/plugins/face-detection.ts:413](src/plugins/face-detection.ts#L413), [:417](src/plugins/face-detection.ts#L417)
89
+
90
+ - Line 413 has trailing whitespace.
91
+ - Missing blank lines between `confirmPositionState`, `resetPositionDebounce`, and
92
+ `checkFace` (methods run together). Cosmetic; align with the spacing used elsewhere
93
+ in the class.
94
+
95
+ ---
96
+
97
+ ## Verification performed
98
+
99
+ - `vitest run src/plugins/face-detection.test.ts` under Node 22 → **1 failed, 7 passed**
100
+ (finding #1 reproduced directly).
101
+ - Cross-file caller trace (`uisdk.ts`, `face-camera.ts`): no signature/contract breakage;
102
+ only hint timing/thresholds shift, as intended.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipwave-ekyc-uikit",
3
- "version": "3.1.4-beta.1",
3
+ "version": "3.2.0",
4
4
  "description": "",
5
5
  "main": "dist/pw-bundle.js",
6
6
  "module": "dist/pw-bundle.mjs",