Skip to content

fix(matching): accept 澤井製作所 card numbers of the DAH4… shape and 9-char part numbers (#129) - #130

Merged
rimtty merged 2 commits into
masterfrom
codex/sawai-card-number-and-short-part
Sep 8, 2026
Merged

rimtty merged 2 commits into
masterfrom
codex/sawai-card-number-and-short-part

Conversation

@rimtty

@rimtty rimtty commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Closes #129.

問題

TestFlight 1.0 (6)/(8) を配った現場で、澤井製作所のラベルが「納品書兼現品票のQRコードではありません」と拒否された。写真67枚(澤井41ペア / モルテン6ペア+現品票9枚 / デンソー7ペア)を Vision でデコードし、現行 masterScanModels.swift をそのままコンパイルしたハーネスで検証したところ、新ラベル27ペアは全て QR 段階で Destination.detect == nil だった。デンソー固有の処理は無関係。

  1. カード番号の正規表現が実データより狭い(27ペア全て): ^[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 以降の全ビルドで再現する。
  2. 9桁品番のラベル(27ペア中9ペア): 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)。写真そのものはコミットしない。
  • 「澤井では 4-2-3 を受理しない」と固定していたテストを反転(iOS testTagBarcodeRecordAcceptsFourTwoThreeForSawaiAndMolten / testFourTwoThreeBarcodeMatchesInSawaiSession、Android tagValidationAllowsFourTwoThreeForSawaiAndMolten / sawaiAndMoltenSessionsAcceptFourTwoFourAndFourTwoThreeTags / cameraFourTwoThreeTagGoesThroughStabilizerInSawaiAndMoltenSessions)。新規: …AcceptsAlphanumericCardCodeAndNineCharacterPart…SharedFieldLabels20260908PassBothScanBoundaries
  • docs: PRODUCT_SPEC / IMPLEMENTATION_GUIDE / IMPLEMENTATION_PLAN / STATUS / TEST_PARITY(行77・77a・77b・86)/ CLAUDE.md。git-ignored の顧客向け仕様書はローカルで §4.1 を追記し PDF を再生成済み(未追跡のまま)。
  • iOS CURRENT_PROJECT_VERSION 8 → 9。

検証

  • 修正後ソースのハーネス: 澤井41・モルテン6・デンソー7ペア全て match、現品票のみ9枚受理、X×66nil、6-4/4-2-2 の現品票は澤井で拒否、9桁/10桁の取り違えは mismatch
  • iOS: xcodebuild test -only-testing:CodeMatchTests(iPhone 17 Pro シミュレータ)180 件成功。
  • Android: ./gradlew lintDebug testDebugUnitTest 459 件成功、: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 を確認済み。
  • CLAUDE.md / shared/README / IMPLEMENTATION_GUIDE からリンク。

…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.
@rimtty
rimtty merged commit da83648 into master Sep 8, 2026
5 checks passed
@rimtty
rimtty deleted the codex/sawai-card-number-and-short-part branch September 8, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

澤井製作所: カード番号 DAH4… 型と9桁品番のラベルが QR/Code 128 段階で拒否される

1 participant