State Machine Debugging for Multi-Room Scan Interactions

    This article examines the interaction issues that surface when users scan multiple indoor spaces in sequence, and explains why they are engineering problems rather than UI glitches. It covers quality gate failures, session lifecycle conflicts, and result-page information overload, then shows how to model continuous scanning as an explicit state machine with verifiable transition rules. It also explains why surface-level UI cleanup is easy while deep debugging is hard, and closes with a reusable manual review checklist and conclusions on state consistency.

    1. Background: Interaction Cracks Exposed by Continuous Multi-Room Scanning

    In indoor space scanning applications, the single-room flow is usually straightforward: start scanning, capture, save, generate results. Real usage, however, often involves scanning several spaces back to back, with state shifting frequently among “capturing,” “saved,” “relocating across spaces,” and “editing results.” When states are not clearly defined, the UI can look fine while the underlying logic is broken.

    Three kinds of symptoms are typical.

    The first is a failed quality gate: a room yields only an incomplete fragment of roughly 0.3 square meters, yet the system still prompts the user to move on to the next room.

    The second is a lifecycle conflict: the capture session is reclaimed by the system when the user reaches the doorway, and after resuming, the app demands a return to the original room. Worse, an incorrect action can split the current space into a newly created one, making it impossible to stitch it with the earlier data.

    The third is information overload on the results page: more than twenty wall IDs are displayed at once, covering the main body of the floor plan.

    These are not purely UI problems. They are engineering problems caused by the state machine, session lifecycle, data ownership, and rendering strategy acting together.

    2. Modeling the Interaction as a State Machine: Define First, Implement Later

    Continuous scanning should be modeled as an explicit state machine rather than a set of boolean variables scattered across page lifecycle callbacks. A sketch of the model:

    1. State:
    2. IDLE
    3. SCANNING(roomId)
    4. PAUSED(reason)
    5. RELOCATING(fromRoomId, toRoomId)
    6. SAVED(roomId)
    7. RESULT_EDITING
    8. Event:
    9. START(roomId)
    10. QUALITY_CHECK(area, coverage, confidence)
    11. BACKGROUND_RESUME
    12. SAVE
    13. GOTO_NEXT
    14. REATTACH(targetRoomId)

    The key constraints should be written as verifiable rules:

    • GOTO_NEXT must not fire if area, coverage, or confidence fails to meet the threshold.
    • After BACKGROUND_RESUME, transition to PAUSED first, and let the user confirm whether to REATTACH or continue the current room.
    • Relocation must carry the original roomId; creating a new room by default is forbidden.
    • The results page aggregates wall IDs by default and shows them only when selected or hovered.

    3. Why Surface Optimization Is Easy but Deep Debugging Is Hard

    Reducing UI noise is a local optimization: fewer labels, adjusted transparency, a comparison view. The input is clear, the feedback is immediate, and most AI coding tools will produce similar proposals.

    Deep debugging is different. It requires the model to understand the page code, the camera lifecycle, the room data model, and the user’s action sequence at the same time, and to reason through failure paths.

    So a review prompt should not contain screenshots alone. It should also ask the model to output a state transition table, a list of exceptional events, the code location for each defect, a proposed fix, and regression cases. Only then does a proposal that “looks good” become an engineering plan that can be implemented and accepted.

    4. A Reusable Manual Review Checklist

    1. Is incomplete capture blocked by the quality gate?
    2. Does background resume enter a recoverable state instead of forcing a rollback?
    3. Does relocation preserve ownership of the original space?
    4. Are save and create-new operations idempotent?
    5. Do result-page annotations support tiered display?
    6. Can duplicate events cause a state regression?

    5. Conclusion

    The core of multi-space scanning is not any single feature but state consistency. Developers should first constrain behavior with a state machine and an event model, then use AI coding tools to generate comparison options, and finally complete manual acceptance with a checklist of cases. This is how hidden defects can be found reliably in complex interaction scenarios and product reliability can be improved.