Skip to content

NFC Tools: improve the whole task

This worked example applies the development workflow to an existing app while preserving its features, workflows and saved data. It records local emulator/container work on 2026-11-28, including the development candidate 0.10.4+workflow.20261128.2. The candidate was not installed on a device, committed, pushed or published. No RF, card read/write or physical-key acceptance is established here. Examples and workload records are synthetic.

Start with the existing foundation

The review inspected the official Template at 477fa6d217b683e3084c361a757f03dc8ca9f753 and LVGL at 85aa60d18b3d5e5588d7b247abf90198f07c8a63. The decision was to adapt the existing app's data preparation and presentation while retaining display/input lifecycle, task ownership, cancellation and confirmation contracts. No dependency upgrade or new UI framework was needed.

The first review fixed damaged-card import, export/report failures, invalid numbers and helper cleanup. A subsequent library pass removed repeated parsing and copying. At that intermediate stage, App::items() for a synthetic library of 256 messages and 64 NTAG213 captures fell from 5637.69 to 2.71 ms. That result described a data helper, not the whole menu interaction. The full menu still needed investigation. Do not combine baselines from different passes into one claimed end-to-end speedup.

Measure the complete action

The next pass followed menu data preparation, row construction, native layout and the Down-key handler separately. The following paired measurements use a quiet Mac Debug ASan/UBSan build, warmups and five-sample medians. They compare the later pass's own baseline and candidate, not the earlier helper benchmark.

Synthetic full-library operation Before (ms) After (ms)
Visible Groups data 897.73 4.86
Groups row construction and layout 1669.30 184.58
One Down-key action in Groups 2566.38 191.69
Saved-list row construction 189.84 204.83

The saved-list path was slightly slower with the preferred presentation. Report that tradeoff; do not claim every path became faster or infer device latency or battery-life improvements from host timings.

Consecutive menu actions regenerated the same source list; chevrons regenerated navigation again for individual rows. Preparing shared data/navigation once per render removed that repeated work without retaining a stale cross-render cache. The renderer also queried layout while creating each row. A query could flush pending native work across the screen, repeating work on earlier rows.

Bounded layout batches reduced Groups layout-completion events from 651 to 13 and saved-list events from 643 to 13. Work counts help explain the result independently of host timing. This was a focused change to NFC's existing all-row renderer. The App Shell already reuses three or four visible rows: retain that window rather than copying NFC's renderer or its batch size.

Implement and verify the text preference

The owner preferred horizontal scrolling over wrapped list/task text. Fixed-height rows now keep title and value lanes on one line; selected overflow uses LVGL's native horizontal animation, while inactive rows use static ellipses. Only display copies flatten embedded line breaks. Full stored records, editor values and structured reports retain their original data. Help, Up/Down, action footers, masked credentials and confirmation ownership remain intact.

The final local evidence covers:

  • 17 Mac sanitizer, 19 Linux sanitizer, 19 arm64 Release and 19 offline extracted-source test groups passing. These are test scopes, not hardware qualification.
  • 185 action routes and menu content matching the baseline; only the sampled live clock value was normalized for comparison.
  • 106 production previews: 67 intentional compact-row/overflow changes and 39 byte-identical images. Header/footer pixel regions were unchanged in all comparisons. A changed presentation needs reviewed differences, not equality with the old wrapped design.
  • 30 additional scenes covering maximum names and top/middle/end selection in both themes. Native animation tests verify X movement without Y movement, cleanup on view destruction and unchanged data/editor values.

A follow-up adoption in the Shell kept row reuse and added native animation checks. Actual rendering exposed two signed (0xFF << 24) expressions in pinned LVGL's NEON RGB888 renderer. The Shell applies an unsigned-literal correction to a hash-checked, build-local source copy, preserving the original license and leaving its shared dependency cache unchanged. NEON and sanitizer checks remain enabled. This is a local adaptation, not a claim of an upstream fix.

Expanded Shell redraw checks then exposed a Mac parallel-rendering stall during a selected-to-ellipsized transition: a queued task could encounter NUL before its recorded line end as DOT processing changed the label buffer. The Shell supplies immutable task-owned text through LVGL's public draw-task event, keeping worker count and native animation. The regression renders after selection/wrap/error changes, checks snapshot ownership and has a bounded test timeout. This follow-up lesson came from exercising the transition, not from assigning a long-mode flag.

Conditional reuse lessons

Apply these when the corresponding feature exists; they do not make a helper, NFC support or privileged service mandatory:

  • Validate full-width JSON integers, sign and range before narrowing. Validate complete block lengths and address order before masking data or using iterators. A damaged import must leave a valid original untouched.
  • Bound regular-file reads on the opened object and during reading, not only by checking a path's size. Use private atomic replacement, handle relative paths and failed writes, preserve unrelated settings, and keep persistence pending until successful. Test pre-commit failure separately from uncertain post-rename durability. See packaging/state checks.
  • Own fixed-helper descriptors and children through failures and cancellation. Bound request writes as well as response reads; close, terminate if needed and reap the owned child. Process cleanup alone does not prove hardware restoration. See the helper recipe.

Verify the artifact pair

One container-produced source archive contained three truncated root handoff files despite successful code builds. The exact cause was not established. Recreating the archive on the host and comparing every extracted file's bytes/ hash with the intended source caught and resolved the mismatch. The lesson is source comparison plus an offline extracted-source build, not a general claim that containers truncate files or that archives must always be created on a host.

The final local candidate pair was recorded with SHA-256:

  • Installer: 63cdd4e5ceeded4dea08670f8f98c560b14b5c64fb7f05c817609a1fe6c1cbb2
  • Source: 79bfebe62a2eeee9d7767b2aeaeb05148eeda44a365b26e89167bdbca287f19a

These identify local artifacts, not public release assets or source-to-binary attestation. App-specific commands and detailed evidence remain in the NFC checkout's docs/code-review-20261128.md, docs/library-improvement-20261128.md and docs/menu-improvement-20261128.md. Those working-tree reports are the provenance for this case; no public commit for the candidate is asserted.

Lesson index ยท UI preferences