fix(matching): accept 澤井製作所 card numbers of the DAH4… shape and 9-char part numbers (#129) - #130
Merged
Merged
Conversation
…r part numbers (#129) The first strict TestFlight build in the field rejected every 澤井製作所 slip because KanbanQRRecord required the card number to be [A-Z]{4}[0-9]{6} while real slips also carry DAH4093870 (an alphanumeric 4-char code + 6-digit serial). Nine of the labels additionally carry a nine-character part number (BCJH5281F left-justified in the 10-wide item field, suffix blank or 02) whose tag prints 4-2-3, which both the QR parse and the sawai tag pattern refused. Both platforms now accept card [A-Z0-9]{4}[0-9]{6}, an item field [A-Z0-9]{9}[A-Z0-9 ] stored trimmed, and a 4-2-3 or 4-2-4 sawai tag (the same pattern as molten). 66-char length, blank suffix and denso-first detection are unchanged, and X*66 junk is still rejected. The shared fixture grows to 63 cases with the 2026-09-08 field labels (12 matches incl. two boxes of one part, 4 mix-up mismatches); the tests that pinned "sawai rejects 4-2-3" are inverted; docs follow. iOS build number 9.
…rification tools (#129) docs/label-variation-playbook.html records what broke on 2026-09-08, why (rules over-fitted to a 12-label sample, then the strictness that used to absorb it was removed for other reasons, and tests pinned the assumption), the acceptance-rule principles, and the step-by-step procedure for the next label variation. shared/tools/decode_label_photos.swift decodes a directory of label photos with Vision into a TSV, and ios/scripts/verify_label_pairs.sh compiles the shipped ScanModels.swift with a driver that runs every decoded pair through the matching core, so the current and the fixed rules can be compared on the real labels without Xcode or the app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #129.
問題
TestFlight 1.0 (6)/(8) を配った現場で、澤井製作所のラベルが「納品書兼現品票のQRコードではありません」と拒否された。写真67枚(澤井41ペア / モルテン6ペア+現品票9枚 / デンソー7ペア)を Vision でデコードし、現行
masterのScanModels.swiftをそのままコンパイルしたハーネスで検証したところ、新ラベル27ペアは全て QR 段階でDestination.detect == nilだった。デンソー固有の処理は無関係。^[A-Z]{4}[0-9]{6}$はDAH4093870型(英数4桁のコード+6桁連番)を通さない。以前はカメラQRに内容検証がなく(Reject unrelated camera QR payloads before advancing #46/fix(ios): カメラQRの内容検証をBLEと統一、不一致結果中のトリガー通知、設定コマンドゲートの改名 (#45) #75)、比較も部分一致フォールバック(feat(matching): 仕向地「モルテン」の 61 桁 QR と 4-2-3 品番を照合コアに追加し、共通フィクスチャを schemaVersion 2 に拡張(#85) #93 で撤去)だったため、build 4 以降の全ビルドで再現する。BCJH-52-81Fなどは QR の 11〜20 桁目が「9桁+空白」、Code 128 が4-2-3@管理コード。QR は^[A-Z0-9]{10}$、Code 128 は澤井ロック中 4-2-4 のみで、どちらも拒否。変更
KanbanQRRecord/KanbanQrRecord: カード番号^[A-Z0-9]{4}[0-9]{6}$、品目番号欄^[A-Z0-9]{9}[A-Z0-9 ]$(末尾空白を除いて保持)。TagBarcodeRecordの澤井パターンはモルテンと同じ4-2-3/4-2-4。66桁固定長・枝番空白許容・デンソー先行判定は変更なし。X×66の無関係QRは引き続き拒否。shared/test-fixtures/matching-cases.json: 47 → 63 ケース。sawai-2026-09-08-の16ケース(一致12: 10桁品番5・9桁品番5・同一品番2箱、不一致4: 隣接シリーズ2・9桁/10桁の取り違え2)。写真そのものはコミットしない。testTagBarcodeRecordAcceptsFourTwoThreeForSawaiAndMolten/testFourTwoThreeBarcodeMatchesInSawaiSession、AndroidtagValidationAllowsFourTwoThreeForSawaiAndMolten/sawaiAndMoltenSessionsAcceptFourTwoFourAndFourTwoThreeTags/cameraFourTwoThreeTagGoesThroughStabilizerInSawaiAndMoltenSessions)。新規:…AcceptsAlphanumericCardCodeAndNineCharacterPart、…SharedFieldLabels20260908PassBothScanBoundaries。CURRENT_PROJECT_VERSION8 → 9。検証
match、現品票のみ9枚受理、X×66はnil、6-4/4-2-2 の現品票は澤井で拒否、9桁/10桁の取り違えはmismatch。xcodebuild test -only-testing:CodeMatchTests(iPhone 17 Pro シミュレータ)180 件成功。./gradlew lintDebug testDebugUnitTest459 件成功、:app:assembleRelease+verify-release-hardening.sh通過。🤖 Generated with Claude Code
追加(2回目のコミット)
docs/label-variation-playbook.html: 2026-09-08 の事象・根本原因・受理条件の原則・次のラベルバリエーションが来たときの手順(照合ログ回収 → 写真デコード → 現行ルールで検証 → 緩和 → フィクスチャ → テスト → docs → リリース)。shared/tools/decode_label_photos.swift: 写真ディレクトリを Vision で一括デコードして TSV を出す。ios/scripts/verify_label_pairs.sh+verify_label_pairs/main.swift: 出荷中のScanModels.swiftをそのままコンパイルし、デコード済みペアを照合コアに流して仕向地判定・形式検証・照合結果を表にする。今回の写真67枚で澤井41・モルテン6・デンソー7ペア全てmatchを確認済み。