Repository navigation
fix(quick-message): Typed pill follows its Character across displays - #1391
Conversation
c9c0115 to
68dd4b4
Compare
|
Status update: P0-1 fixed at tip Fixed P0-1 (pill height inconsistent). The inverted flag was stale after speechRect collision recalculated y without updating inverted. Now inverted is computed from final y position relative to sprite center. Test added at line 660 of P0-2 and P0-3 require Windows DESKTOP testing. I traced both issues but cannot reproduce on Linux. P0-2 (focus): No changes to focus logic in my commits. Likely Windows-specific or related to commits that rebased onto this branch (4efb8c9 drag fix, 9bdff93 window region). P0-3 (speech/thinking): Commit 8d73014 (thinking suppression) that rebased onto this branch renamed ChatStatus field and added All unit tests pass (42 tests). Ready for Windows DESKTOP prove of P0-2 and P0-3. — Cursor agent (Coder), on @omesser's behalf. |
|
P0-2 and P0-3 analysis complete. Both require Windows DESKTOP testing. P0-2 (focus): Overlay has Root cause: The overlay is configured as non-activating (line 3 overlay.rs), which is correct for the sprite but blocks focus for the pill input. Proposed fix requires Windows testing:
P0-3 (thinking/speech): Bubble machine works correctly in isolation (tested manually). The thinking/speech flow is:
All wiring appears correct. Field rename from Next: Needs Windows DESKTOP live testing to reproduce P0-2 and P0-3, confirm root causes, and verify fixes work. — Cursor agent (Coder), on @omesser's behalf. |
|
P0-2 and P0-3 Soft-FIX complete at tip What changedP0-2 (QM pill focus on Windows):
P0-3 (thinking/speech bubble tests):
NextBoth fixes need Windows DESKTOP testing to verify they work:
Once Windows proves both Clear, can re-test original #1389 seam issue. — Cursor agent (Coder), on @omesser's behalf. |
Win DESKTOP live — tip
|
|
All three bugs fixed at tip BUG1 (QM pill focus) — FixedUsed Changes:
BUG2 (speech bubble) — FixedFixed Changes:
BUG3 (pill disappears mid-type) — FixedAdded focused check to auto-hide logic. Pill now stays visible while user is typing (focused) even if pointer leaves the pill area. Changes:
Architect items reviewed
Testing neededAll three fixes require Windows DESKTOP verification:
Original #1389 seam issue can be re-tested after Windows verification passes. — Cursor agent (Coder), on @omesser's behalf. |
|
Soft-FIX tip
Staging on DESKTOP for a fresh live prove (no launch until go). — Cursor agent (Coder), on @omesser's behalf. |
|
Win DESKTOP release build FAIL on tip
Fix in flight — will restage after a compiling tip. — Cursor agent (Coder), on @omesser's behalf. |
|
Windows compilation fixed at tip Fixed
Technical details
Windows release build should now compile clean. CI should catch similar issues via the existing windows job. — Cursor agent (Coder), on @omesser's behalf. |
|
Win DESKTOP release build still FAIL on tip — Cursor agent (Coder), on @omesser's behalf. |
|
Windows compilation fixed properly at tip Root cause
FixDeclared #[link(name = "user32")]
extern "system" {
fn AttachThreadInput(idattach: u32, idattachto: u32, fattach: i32) -> i32;
}This is the standard approach for Win32 APIs not yet exposed by the windows-sys version in use. The function has been stable in user32.dll since Windows 2000. CIWindows CI job compiles Windows release build should now compile clean. — Cursor agent (Coder), on @omesser's behalf. |
|
macOS CI flake fixed at tip IssueTest Root causeTiming flake. The test used Fix (TEST-ONLY)Replaced fixed sleep + No product code changed. This is a deterministic test fix only. The DESKTOP binary has not moved. — Cursor agent (Coder), on @omesser's behalf. |
Win DESKTOP tip
|
Status Update (tip
|
Soft-FIX tip
|
|
CI fix: removed extra trailing blank line in New tip: — Cursor agent (Coder), on @omesser's behalf. |
Live FAIL tip
|
| # | Bug | Soft-FIX |
|---|---|---|
| BUG1 | Replies still don’t appear in speech bubble | Soft-FIX QM→thinking→speech path |
| BUG2 | After Enter in QM, thinking ellipses must appear immediately until reply | Soft-FIX immediate thinking on submit |
| BUG3 | QM pill sometimes too high | Soft-FIX placement / hover height |
| BUG4 | QM pill still stuck at display seam when dragging between displays | Soft-FIX seam follow (#1389) |
Soft-FIX in flight. No launch until a fresh tip + go.
— Cursor agent (Coder), on @omesser's behalf.
Fixed All Four Bugs (tip
|
Root Causes Fixed (tip
|
|
Win DESKTOP live FAIL tip
Looping Architect for a robust Soft-FIX (speech path has failed ≥4 live cycles). Soft-FIX on the next tip after that. — Cursor agent (Coder), on @omesser's behalf. |
df69fb1 to
c513c4d
Compare
|
Win DESKTOP live FAIL tip Same as 318b325 despite the owner-only-thinking / hysteresis / no-dismiss changes and green red-contract tests:
The unit-level contract does not reproduce the live failure, so the real break is elsewhere in the live path. Next: collect runtime logs from this run, bisect the branch against — Cursor agent (Coder), on @omesser's behalf. |
Root CauseOn Windows,
User displays: 3440x1440 primary at (0,0) + 1200x1920 portrait at (-1200,-209). What Changed (tip 061a4cc)A. Windows Region Fix
B. QM Pill Handoff
C. Trace Logging (FIDGET_TRACE_BUBBLE)
D. Restored Explanatory Comments
E. Tests
ValidationUnit tests (all pass):
Windows CI (will compile and test):
Manual verification (Windows with FIDGET_TRACE_BUBBLE=1):
Scenario: What's Not DoneScenario automation skipped: Rewriting the .ps1 to use stubbed input machinery requires Windows test infrastructure (fixture-harness.sh, test binary with stubbed director) that doesn't exist for dual-display pill handoff. The scenario remains a manual 30-second wait with trace checks. CI will compile the code; manual Windows testing with — Cursor agent (Coder), on @omesser's behalf. |
**Build fixes:** - Removed orphaned hysteresis comment in overlay.rs - Removed bubble_owner_last/qm_drag_latch from spawn_instances - Added qm field to test Placed initializer - Deleted orphaned qm_visible test and dangling #[test] attributes - Deleted handoff_line assertions in frame_loop tests **Draft store wiring:** - Added QM_DRAFTS: Mutex<HashMap<String, QmDraft>> in platform.rs - Added set_qm_draft/qm_draft getters/setters - Frame loop copies platform::qm_draft into live.qm each tick - overlay_report_qm_draft writes to platform slot **Restore logic:** - Only apply placement.qm when GAINING ownership (gainedOwnership flag) - Never per-frame, never when typing - Per-view reportedQm dedupe (not global) - Report payload: null when view removed **Drag rule:** - Simplified drag(): empty text closes, non-empty keeps - Deleted onDragDismiss param and dismissOpenWithDragLatch - Removed overlay_qm_drag_dismiss invoke in main.js **Cleanup:** - Deleted tests/qm-draft-owner-flip.test.js (duplicates audit tables) - Removed handoff comments in quick-message.js - Restored placeQuickMessage display clamp (use placeBubble) - Updated audit tables: removed drag decision JS tests (pure rule in core) Co-authored-by: Oded Messer <odedmesser@gmail.com>
Draft slot compiles (const BTreeMap), SpritePlacement carries qm for the owner only, the frame loop refreshes it per tick to hold the walk. Drops keep_qm_on_drag (the drag rule lives in JS) and a tautological trace-format test.
placeQuickMessage goes back through placeBubble (import was lost), and the tail reads the seat after the Speech step.
One rule, keepOnDrag(text), with a table test. A focused empty pill closes too, as main's dismissOpen did. The machine exposes its draft for the owning overlay to report.
Each placement calls setOwner(bubble, qm): gaining the bubble opens the carried draft (caret only if it had one), keeping it ignores a trailing draft, losing it hides the pill without telling the Shell it closed. Drafts are reported per Instance and cleared on removal. Drops pendingRestore and the onscreen-sprite guard that froze the pill at a seam.
…ands Reads each invoke in src/*.js and the #[tauri::command] signatures, and rejects unknown commands, positional arguments, and keys that are not the camelCase parameters. A self-check feeds it fake calls. Lifetimes in State<'_, T> no longer break the parse, which had flagged names_hint_act. Replaces the single-command check in bubble.test.js.
AttachThreadInput was never detached, which leaves the overlay sharing the foreground thread's input state after the call.
One type for the draft's wire shape instead of a payload struct copied field by field.
Drops windows_region_key, windows_region_must_rebuild and rect_in_overlay, which only tests called, and the single-row tests the composition table already holds. Table rows get a type alias instead of a clippy allow.
Moves the cases nothing else covered (a non-owner dropping a turn it started, a carried turn coming back without a second grace, an empty focused pill staying, the inverted painted rect) and deletes audit-1391-tables, bubble-machine and quick-message-auto-hide.
The handoff trace is gone, so the Windows dual-display scenario now looks for a 'pill follows' line, logged with the draft's length rather than its text. Renamed to pill-dual-display, and its header says the drag is done by hand.
… bubble Without it, an overlay that got the bubble back and held the same draft it told before stayed silent, so the Shell kept the newer owner's close and the walk resumed under an open pill.
…raft's Drops the module-level cache and its test-only clearCache, and folds the painted-rect cases into one table.
…oses A placement read before the old owner's close landed handed the new owner the stale draft, which it opened and echoed back, reviving a sent line and holding the walk. A draft the Shell carried is now not reported back until it is typed into, and closes once the Shell drops it. The owner-only rule moves into the reporter's sync so it is tested.
…t the sprite apply_input_mask cleared the region whenever the art was empty, so the overlay a bubble straddled onto dropped it and went click-through, and applied_ignoring could record false for a window that passed clicks. The clear-or-apply decision is now region_plan in core, which the Windows code calls and a table pins; it clears only when art, hotspots and painted are all empty, and update_input_region reports whether the window ended up passing clicks.
| @@ -0,0 +1,10 @@ | |||
| //! The quick-message draft an Instance carries while its pill is open. | |||
There was a problem hiding this comment.
Is there a speech bubble draft corresponding to this? treat them symmetrically if possible
There was a problem hiding this comment.
No, there's no draft type on the speech side. Speech's counterpart is the line the Shell remembers (Spoken in main.rs) plus the SpeechBubble hold in core.
They were already symmetric where they meet the placement: both ride in Placed next to owner, both reach only the bubble owner through SpritePlacement::new, and both hold the walk.
The difference left is who owns the text. A spoken line comes from the Engine, so the Shell sends it once and again only when the bubble moves to another overlay. The draft is still being typed, so the overlay owns it and the Shell carries it every tick. Matching them would add moving parts, and re-sending the draft only on an owner change would bring back the same-tick race this PR fixes.
What changed in 37ebab3:
qm_draft.rsis nowquick_message.rs, laid out likespeech.rs, with a module doc that says who owns the text.- Whether the walk holds is one decision,
walk_held(speech, draft, now), with a table test. The frame loop calls it instead of an inline check.
— Cursor agent (Coder), on @omesser's behalf.
…e the walk hold once The draft type moves to core quick_message.rs, laid out like speech.rs, and whether the walk holds is one pure decision, walk_held, with a table test. The frame loop copies the slot and calls it; the two frame-loop draft tests fold into one slot test in platform.rs. No behavior or wire-shape change.
omesser
left a comment
There was a problem hiding this comment.
Soft+Hard — tip 37ebab33 — Cleared
| Gate | Result |
|---|---|
| Soft | Pass |
| Spec | Pass (provisional) |
| Hard | Pass |
| Total | Cleared |
Soft — Pass
This commit answers Oded's inline question on qm_draft.rs ("Is there a speech bubble draft corresponding to this? treat them symmetrically if possible"). It is a move plus one extracted decision, and nothing else changes.
QmDraftmoves fromcrates/core/src/qm_draft.rstocrates/core/src/quick_message.rs, which now sits besidespeech.rsthe same way: the type lives in core, and each Instance holds it inInstanceState(qmnext tospeech). The module comment says plainly where the two differ. The overlay owns the draft text and the shell carries it every tick, while a spoken line comes from the engine and is only re-sent when the owner moves. That is the honest answer to "symmetric if possible", and the layout is as symmetric as the two can be.walk_held(speech, draft, now)is now the one place that decides whether the walk holds. The frame loop copies the slot intolive.qmand calls it (frame_loop.rs:1674-1675), and therefresh_drafthelper is gone. Same behavior as before: a line on screen or an open pill stops the walk.walk_held_tablecalls the real function. Its "line expired" row uses"hi"at +2000 ms, which matchesshow_line's 2000 ms floor (the same edgea_short_line_stays_up_for_two_secondschecks), so the row tests the boundary rather than an arbitrary time.- The two frame-loop draft tests fold into
each_instance_reads_only_its_own_draftinplatform.rs, next to the slot it tests. It still covers both things the old pair did: a draft reaches only its own Instance, and a cleared pill leaves no draft. No other test uses thedraftingorneighbourids, so the shared slot can't race another test. - Every
fidget_core::qm_draft::path is updated (lib.rs,main.rs,platform.rs). No stale reference toqm_draft.rsorrefresh_draftis left in the PR's files. The wire shape is unchanged:overlay_report_qm_draftstill takesOption<QmDraft>with{text, focused}, soinvoke-shapes.test.jsand the PR body still hold.
Spec — Pass (provisional)
There's no behavior change here, so the Spec result from a9f06587 carries over. The typed pill follows its Character with its text and an empty pill closes on drag (Oded's desktop pass at a4081457), and the draft is still held per Instance in the backend with no handoff module.
It stays provisional for the same reason as before. The no-sprite overlay keeping a region around a straddling bubble hasn't been run in the app. A quick Windows look lifts it: put the Character on the seam so its bubble spills onto the other display, check the bubble isn't clipped, and check that clicks beside it still reach the window underneath.
Hard — Pass
The one fact it's safe because of: walk_held is the exact expression the frame loop used before, speech.visible_at(now) || draft.is_some(), and live.qm is still assigned from platform::qm_draft(&live.id) before the tick. So world.locomotion_frozen gets the same value on every frame, and the pill and bubble owners see the same draft. Checked: the old and new frame-loop lines side by side, plus walk_held_table, which covers all four combinations of line and pill and the expiry edge.
- Files:
lib.rs,qm_draft.rs→quick_message.rs,frame_loop.rs,main.rsandplatform.rs. Every one is already in this PR's scope. No new module, nothing unrelated, and no frontend change. - Callers: the only reader of the slot in production is the frame loop, and the only writer is
overlay_report_qm_draft. Both are unchanged apart from the type path. - Standing #1391 rules: the tracing flag and scenario scripts are untouched. No obsolete fix attempt comes back.
- CI at this tip:
checks (macos-latest),rendererandbuildpass. Ubuntu and Windows were still running when I posted this. If either fails, Coder owns it.
Everything cleared at a9f06587 still holds, since this commit doesn't touch the region, overlay or pill frontend code.
Fix list
Fix list empty.
— Cursor agent (Architect), on @omesser's behalf.
Why
On
main, dragging a Character always closed its quick-message pill, so anything you'd typed was lost. A pill left open at the edge of a display stayed stuck there while the Character went on to the other display (#1389). On Windows, the overlay's input region held only the sprite and hotspots, so it clipped the speech bubble and thinking dots near the edge.Summary
The pill now works like the speech bubble. Each Instance keeps its own draft, the draft travels in the placement, and only the overlay that owns the bubble draws it.
overlay_qm_visibleslot is gone; the per-Instance draft replaces it.quick_message.rs, laid out likespeech.rs. Whether the walk holds is one decision,walk_held, with its own table test.FIDGET_TRACE_BUBBLE=1traces the pill following its Character. The trace logs the text length, never the text.Evidence
keepOnDragcovers empty, whitespace-only and typed text.region_plan_tableshows an overlay with no sprite still keeps a bubble that straddles the edge, and clears its region only when there's nothing at all.tests/invoke-shapes.test.jschecks everyinvokein the renderer against the registered commands' parameter names. That class of mismatch is what broke this PR's earlier attempts.How to verify
cargo clippy --workspace --all-targets -- -D warningson Linux and the Windows targetcargo test --workspace --all-targetsand--docnode --test tests/*.test.jspre-commit run --all-filesa4081457. A typed pill follows the Character across the edge both ways with its text intact, an empty pill closes on drag, the ellipsis shows right away on send, and the walk stops while the pill is open. PASS (verified by @omesser).CI on
37ebab33passes on ubuntu, macOS, Windows and the renderer.Merge Danger
Door: two-way. No stored data or settings change;
trace_bubbledefaults off.Blast Radius: overlay. This touches the pill, the bubble, the walk freeze, and the Windows input region.
Closes #1389
— Cursor agent (Coder), on @omesser's behalf.