App development and improvement workflow¶
A repeatable route from a useful idea or an existing app to a tested, maintainable CardputerZero Linux app. Use the common steps for every project and select only relevant peripheral recipes. A calculator does not need a supervisor, a network service or a radio checklist. For a small first screen, begin with the first-app exercise and return here when planning a real app.
This is the maintained home of the workflow. Link to this page from each app's handoff; keep app-specific commands, decisions, results and next actions in that app's repository. Do not create separately maintained copies of this guide.
1. Define the task and protect the working baseline¶
Write one sentence describing the user's useful outcome. Identify existing features, saved state and behavior that must survive. For improvements, describe an observable problem: slow opening, lost selection, stale data or an exit delay. Choose representative workloads and the criteria that will show success.
Read the project's instructions, recent history and handoff. Check the working tree and active work in other chats before editing. Identify the canonical source, installed version, device image and any intentional mirrors. Preserve unrelated edits. Coordinate device access: another app may own the display, input, camera, USB adapter or hardware service. Offline work can proceed while device use waits.
Keep: a baseline revision, known local changes, scope, acceptance checks and explicit deferrals. Back up real state privately before any later install or migration.
2. Evaluate official foundations before adding your own¶
Start with the official component comparison, UI/shell evaluation and input evaluation. Inspect the relevant official source and record the revision actually reviewed. For a new project or changed integration, compare current upstream changes with those pins before adopting them. Do not silently update dependencies or assume an earlier review covers new code.
| Decision | When it fits | Record |
|---|---|---|
| Use as provided | Official behavior meets the need | Source/revision and integration path |
| Adapt | Presentation or a focused extension is needed | Boundary preserved, change and tests |
| Deliberately depart | A requirement, preference or demonstrated defect warrants it | Reason, alternatives, costs and compatibility checks |
The reviewed official Template supplies an SDL desktop preview, LVGL platform integration and a small MVVM/reactive structure. The shared launcher runtime has its own runner, setup/teardown and external-app handoff. Choose one coherent integration path. These are established foundations, not missing features this workflow replaces. Sources: Template overview and launcher runtime flow.
The supplemental value here is the sequence of evidence, regression protection, private-data checks and handoff. It is not a new firmware, SDK or universal app architecture. Read the library principles before extracting components. Personal appearance choices do not override resource ownership, keyboard handling or lifecycle contracts. Evaluate a meaningful departure before deciding whether to share it upstream or keep it as a preference.
3. Design the smallest complete user task¶
Sketch the path from opening the app through completion, cancellation and return. Group fields needed for one task in one form. Give progress, empty, unavailable, pending, unknown and failure states honest meanings. Preserve unsaved input when an operation fails. Apply UI preferences only where desired; they are separate from platform requirements.
Choose state ownership explicitly. A screen displays state; a worker or service may own slow work or hardware when the app requires it. A single-process app is valid. Mesh's separate supervisor is a deliberate choice for one authority across UI, phone access and radio lifecycle, with IPC and packaging costs in exchange. Do not copy that architecture into apps that have no such need.
Keep: stable record/action identities, ownership and cleanup rules, expected persistence, resource access and recovery behavior. See architecture.
4. Build a safe, independent simulator workspace¶
Use separate build output, configuration, runtime/socket directory, temporary database and window identity for each preview. Use synthetic records with stable, nonempty IDs; otherwise a search-selection defect may be a broken fixture. Check isolation before starting more than one simulator. Never aim a preview at the owner's active socket or assume a renamed window isolates its backend.
Exercise empty, normal, long-list and malformed-data cases. Check both themes, small-screen clipping, scrolling, focus, overlays, typing and repeated open/close. Use the official keyboard map and real event-path tests. Text pasted into a field does not establish Fn/Sym translation. Qualify system actions for the chosen runtime without installing duplicate global handlers. Keep performance overlays optional; verify normal action footers without an overlay covering them.
For horizontal text, tick the native animation and check X movement without Y movement, cleanup and unchanged stored/editor values. Compare fixed screen chrome and routes as well as whole screenshots. Document expected changes when the owner changes presentation; inspect those regions rather than treating every pixel difference as a regression.
Boundary: synthetic UI checks do not prove physical keys, device fonts, peripherals, radio delivery or real-world performance.
5. Measure before optimizing, then make focused changes¶
Follow a user action through input, state, transport/storage, notification and rendering. Find repeated work and ownership mistakes in actual code. Prefer removing duplicate computation, notifications, disk writes and widget recreation before adding caches, workers or an abstraction layer.
Measure data preparation, row construction/layout and the complete key/menu action separately under the same fixture and build. Use warmups and repeated samples, and count work independently from elapsed time. A fast helper does not establish that the user's task is fixed: the NFC Tools example removed seconds from data preparation but still had slow full-menu layout. Native LVGL layout queries inside row construction can repeatedly flush the whole screen. Prepare shared data once, then bound pending layout work or retain an existing virtualized row window as appropriate; do not copy batch sizes.
| Recurring issue | Useful approach | Regression to preserve |
|---|---|---|
| A partial frame is rescanned after every read | Track consumed/searched offsets with explicit limits | Fragmentation, many records, malformed input, oversize and EOF handling |
| Reading a snapshot rewrites saved history | Persist at mutation boundaries | Failed write, retry/recovery, deletion/retention atomicity and no duplicate action |
| Every telemetry event rebuilds all rows | Update values in place; separate structural changes | Real changes, filtering, sorting, selection, cleanup and theme changes |
| An unchanged snapshot triggers redraw | Compare all semantically relevant fields | Delivery/errors/identity changes and new retention policy still notify |
| Map or age state stays stale after reducing events | Separate position changes from a presentation clock | Aging, lost fix, new fix, future timestamps and object destruction |
| Selection moves to the wrong record after sorting | Preserve stable identity and define tie ordering | Reorder, disappearance, wrap, visible selection and action target |
| Invalid readings reach formatting or integer casts | Validate type, finiteness, range and units first | Unknown remains unknown; extremes do not crash or fabricate a valid reading |
| Exit waits for a reconnect sleep | Use an interruptible wait with correct synchronization | Disconnect, repeated start/stop, wakeup and callback lifetime |
Add a targeted regression for the defect; when practical, demonstrate that the original implementation fails it. Prefer assertions about correctness and work performed (for example widget deletion counts) to fragile timing thresholds. Make a coherent change, review its impact, then rerun affected checks. Do not remove a notification or write until every mutation, policy-change and recovery path has been accounted for. Keep LVGL work on its owning UI thread.
Measure before and after sequentially with the same workload, build flags, data size and logging. Record medians, units and environment. A 256-row synthetic test measures that operation, not app launch time, device responsiveness or battery life. Validate the user's original symptom again on the actual device later. See UI persistence and redraws.
6. Validate behavior, failure and publication safety¶
Run the project's applicable native tests and sanitizers, backend tests and UI checks. Cover disconnects, timeouts, invalid and huge inputs, screen destruction, storage failure and concurrent callbacks where those paths exist. Use disposable state for fault injection. Explain disabled sanitizer checks rather than implying that they passed. Successful tests reduce risk; they do not guarantee no bugs.
Review permissions, service identity, socket trust boundaries, bounded queues, intent validation, executable/path selection and any network listener. Scan tracked files, staged changes and generated distribution assets for credentials, private channel URLs, real messages, identifiers, coordinates and private paths. If a secret was committed earlier, deleting it from the current tree is insufficient: rotate it and address the exposed history before publication. Preserve licenses and attribution. See security and publishing.
Keep: exact commands, test scope, failures and unresolved limits. Separate a sandbox/tool restriction from a reproduced application defect. Avoid repeating whole suites after docs-only changes; rerun for relevant code changes or uncertainty.
7. Build and test the actual Debian arm64 installer¶
Use the project's pinned build/dependency route. Prepare verified sources and caches separately, then run the offline container/package checks. Inspect actual archive content, executable dependencies, modes, units and install/remove hooks. Do not make a desktop-only success stand in for an arm64 package check.
Test clean installation, upgrade from a supported baseline and preservation of saved state in a disposable matching environment. Test offline startup if promised. Keep system libraries under the package manager; do not indiscriminately bundle the host system or private configuration. Record package hash, source revision, version, dependency provenance and corresponding-source/license assets. A dirty-tree development package is not an exact committed-source release. See building and packaging.
Boundary: a container install is not a fresh-image hardware test. Keep a missing spare-card check deferred rather than erasing a working installation.
8. Install and qualify when the device is available¶
Coordinate exclusive access, privately back up state and retain a known rollback installer. Follow the app's install runbook; do not improvise a root launch. Check installed bytes and the process actually running after the update. Test launch, exit, reopen, input, fonts, both themes, saved state and the user's full task. Old running processes can survive file replacement; a package version alone does not prove the new service or UI is active. See the worked upgrade and rollback.
Select hardware checks from the project recipes: actual GPS freshness and sky view, camera scan, adapter ownership, peer messaging or media input/output as applicable. Confirm attached hardware and safety conditions anew; never infer them from an old test report. Avoid changing saved transmit, privacy, VPN or system settings merely to make a test pass. Shared capabilities require coordinated ownership. Record observed outcomes and restore only the temporary changes the test deliberately made.
If device access is busy: stop at the offline-qualified candidate. Record what is ready and what remains; do not mark hardware acceptance or release complete.
9. Document, commit and publish deliberately¶
Update user-visible instructions when behavior changes, plus build/runbooks, current status, qualification and handoff. Record the distinction between local, committed, CI-tested, installed and publicly released source. Keep dated evidence; do not erase an intermittent failure because a later repeat passed.
Review the intended diff, secrets, licenses and generated artifacts. Synchronize only designated mirrors, retaining their independent notes and private state. Commit the intended project changes, push when authorized, and verify CI for the exact source. Publish an installer or submit to the Store only through the separate release/submission process. A push is not installation or Store approval.
Move transferable lessons into an existing guide chapter or recipe and link the app's evidence. Extract reusable code only after the official-source evaluation, real consumers, ownership and maintenance needs justify it. A documented pattern is not automatically a tested shared library.
What to avoid, and when an exception is justified¶
The Mesh review exposed avoidable work and fragile behavior in application code. These lessons supplement the official foundations; they are not claims that the official framework is defective. The specific candidate and its host/container results are recorded in Mesh's dated improvement report. That report and this update are prepared locally; the public link becomes available after their deferred publication. Device acceptance remains pending.
Rebuilding a whole list to change one highlight or reading¶
Avoid: deleting and recreating every row on each arrow press or ordinary telemetry update. This adds allocation/layout work and complicates focus and selection lifetime. In Mesh, row-deletion tests exposed this redundant work.
Instead: update the old/new selected rows or the changed values in place. Keep selection attached to a stable record ID and rebuild when structure changes. Exception: a short infrequently changed list may be simpler and entirely fast enough to rebuild. Membership, order, layout, theme or row-type changes can also justify reconstruction. Measure first; do not trade clear ownership for a cache.
Writing saved state merely because someone reads it¶
Avoid: rewriting healthy history for every snapshot or reconnect. Mesh was serializing retained history again even though mutation paths already saved it.
Instead: make persistence responsibility explicit at mutation boundaries, including retention/deletion and settings changes. Exception: a deliberate checkpoint, migration, reconciliation or failed-write recovery may need a write. Do not remove a write until those paths are traced and tested. A read optimization must not silently drop recovery or turn an unsaved change into apparent success.
Sending every event to every screen¶
Avoid: having unrelated readings force Map/list rebuilds, or suppressing all notifications as a shortcut. Mesh's position view did not need signal and battery changes to rebuild its objects.
Instead: observe the facts a view actually uses. Compare all meaningful fields before suppressing identical snapshots, and keep policy changes independently observable. Exception: a broad event can be a reasonable simple design for a small app. Narrow it only with evidence and coverage for genuine changes. Time passing still needs to age stale data even when no new event arrives.
Rescanning accumulated input and sleeping through shutdown¶
Avoid: searching an entire growing partial frame after every small read, or using a reconnect sleep that shutdown cannot interrupt. Both patterns added avoidable work or delay in Mesh's socket client.
Instead: track scan/consumption positions, retain size/queue bounds and use interruptible retry waits with correctly synchronized wakeups. Exception: a small fixed input may not benefit from incremental parsing; a standalone delay without cancellation requirements may be sufficient. Preserve framing, malformed input behavior and callback ownership rather than optimizing only the happy path.
Treating array position or a plausible number as trustworthy¶
Avoid: targeting a record by its current row number after a reorder, leaving synthetic record IDs empty, or converting unchecked telemetry directly to display integers. These can select the wrong item, break search tests or produce invalid numeric behavior.
Instead: use stable identities, deterministic tie ordering, and validation of type, range, finiteness and units. Missing or impossible readings remain unknown. Exception: an index is suitable for a fixed, immutable menu; clamping can be appropriate for a bounded visual gauge after semantic validity is established. It must not turn an invalid sensor reading into a believable measurement.
Letting preview conveniences become product assumptions¶
Avoid: sharing configuration/runtime sockets between simulators, allowing a debug overlay to cover actions, or assuming desktop fallback fonts match device fonts. The Mesh preview exposed footer obstruction and synthetic-fixture gaps; its remaining font differences are explicitly documented.
Instead: isolate preview state, make diagnostics opt-in and check actual device rendering later. Exception: intentional integration tests may connect a preview to a disposable backend with explicit ownership. That is a separate test setup, not an accidental connection to the owner's live hardware or saved data.
Adding infrastructure before demonstrating the need¶
Avoid: copying Mesh's supervisor, IPC, caches or a new shared library into every app simply because one app uses them. This is a design caution, not a conclusion that Mesh's modular boundary was a mistake.
Instead: reuse suitable official facilities, then add the smallest structure that meets the app's requirements. Exception: multiple interfaces, independent hardware lifetime or repeated well-understood consumers may justify modularity or extraction. Record the benefits, costs and use/adapt/depart decision under the library principles.
Turning a narrow passing test into a broad reliability claim¶
Avoid: presenting faster host microbenchmarks as faster device launch or longer battery life; treating a simulator/package install as physical acceptance; or claiming a later successful repeat explains an earlier intermittent failure.
Instead: state the exact workload, source and environment, preserve failed observations and explicitly defer unavailable checks. Exception: synthetic and container evidence is useful for local decisions and regression protection; it simply supports a narrower claim. Also distinguish a missing test dependency or sandbox restriction from an application defect.
Before applying any lesson, ask: Is this path relevant, have we observed a problem, and what behavior could the replacement accidentally remove? The goal is less unnecessary work with the same dependable behavior, not fewer lines at any cost.
Copyable project checklist and handoff¶
Copy this small record into the app's own WORK or HANDOFF file; link back here for explanations. Mark optional items not applicable with a reason.
Outcome and acceptance criteria:
Canonical repository / baseline revision / existing local edits:
Official sources reviewed (revisions), use/adapt/depart decisions:
Features, saved state and settings to preserve:
Simulator build/config/runtime isolation and synthetic workloads:
Changes and regression cases (including original failure evidence):
Before/after measurement conditions and limits:
Native/sanitizer/backend/UI results and exact commands:
Security/license/public-asset review:
arm64 package/install/upgrade/offline results:
Candidate version, source and installer SHA256:
Device availability, safe prerequisites and backup/rollback:
Actual installed/running-code and saved-data verification:
Physical task/peripheral results; failures and explicit deferrals:
Documentation and designated mirrors updated:
Commit / push / exact-source CI / release status (separate):
Next action, owner and blockers; link to this workflow:
A useful stopping point is explicit: ready for device acceptance is different from ready to release. Leave enough information for another builder to resume without the original chat or access to private logs.