[NFC]: supported-card parsers have no test coverage and the unit-test harness cannot reach them

Author: mishamyteCreated Aug 21, 2026Updated Aug 21, 2026
Labelsarea/nfctype/enhancement

Describe the bug.

None of the 41 supported-card parsers in applications/main/nfc/plugins/supported_cards/ has any test coverage, and the existing harness cannot currently reach them. This is what allowed #1091 — a checker that rejected roughly nine of ten genuine cards — to ship for four releases undetected.

The gap is structural rather than neglect:

  1. The unit-test firmware does not contain the NFC app. FIRMWARE_APPS["unit_tests"] in fbt_options.py omits main_apps, which is what provides nfc. And applications/main/nfc is apptype=FlipperAppType.MENUEXTERNAL, registered with global_lookup=False in scripts/fbt/appmanifest.py, so it cannot be pulled in by appid the way js_app can.
  2. Parser internals are static and live in .fal plugins of that FAP, so no other translation unit can link them.
  3. Runtime plugin loading does not help. nfc_supported_cards.c resolves plugin imports through a CompositeApiResolver of the firmware API plus the NFC app's private table (applications/main/nfc/api/nfc_app_api_table.cpp). The unit-test app has no equivalent table, so a parser .fal would not resolve.
  4. CI never runs the suite anyway. None of the workflows in .github/workflows/ invokes scripts/testops.py run_units; it needs a dedicated firmware build, flashed by hand and driven over serial.

What does exist and works: applications/debug/unit_tests/ is a real minunit harness with roughly 30 suites, and .nfc fixtures are already supported — applications/debug/unit_tests/resources/unit_tests/nfc/ holds 14 dumps loaded via nfc_device_load(). There is also precedent for testing a pure function that lives in firmware core: mf_plus_crypto_cmac_rfc4493 works because the symbol is in lib/ and was hand-added to applications/debug/unit_tests/unit_test_api_table_i.h.

Reproduction

Not a runtime bug. grep -rni "supported_card\|social_moscow" applications/debug/unit_tests/ returns nothing.

Found in version

dev

Anything else?

Filed as a tracked gap rather than a proposal, because the fix is a real design decision and none of the options is obviously right:

  • Hoist the pure, testable arithmetic out of parsers into lib/ (where bit_lib_bytes_to_num_bcd already lives, already tested) and test it there. Cheapest, but covers helpers rather than parse logic.
  • Pull the NFC app into the unit-test firmware and export parser internals through a test API table. Invasive.
  • Host-side tests over saved dumps, outside the on-device harness. Needs new infrastructure, but is the only option CI could actually gate on.

Note that real card dumps make poor committed fixtures: the ones that exposed #1091 carry real card numbers and OMC numbers belonging to identifiable people, so any fixture would have to be synthesised with a recomputed check digit.

Found during review of #1092 / #1091.

Source: DarkFlippers/unleashed-firmware