Skip to content

refactor(overlay): Null the bubble fields at emit and delete forOverlay - #922

Merged
omesser merged 2 commits into
mainfrom
refactor/358-overlay-emit
Sep 22, 2026
Merged

omesser merged 2 commits into
mainfrom
refactor/358-overlay-emit

Conversation

@omesser

@omesser omesser commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Why

Core already decides the bubble owner, yet every overlay was sent dialogue,
thinking and cue, and forOverlay in the webview stripped them again. The
page was reconstructing an answer the Shell had handed it. Item 7 of #358.

What changed

  • SpritePlacement::new builds one overlay's view of one Instance and nulls
    dialogue, thinking and cue on a non-owner. Inherent, no trait (Split the long files along existing seams, without new traits #172).
  • forOverlay deleted; src/main.js acts on the payload as it arrives.
    bubble stays on the wire, because the webview reads it to drop a bubble on
    the tick ownership moves away.
  • One Speech duration: the formula stays in JS, and a test pins CARRY_WINDOW
    to bubbleDuration's max clamp. A speech_ms field would add to the payload
    in the change whose job is to shrink it.

Out of scope: folding bubble / cue / interpolate into one presentation
module. #358 holds that until the payload is clean, which is this change.

How to verify

cargo test -p ai-buddy --all-targets (539 pass), cargo test -p ai-buddy-core,
cargo clippy --all-targets -- -D warnings, node --test tests/*.test.js (304 pass).

The seam tests that already existed are the pin: a line crossing the seam hides on the old display before it shows on the new and the losing-overlay test now
feed already-stripped placements instead of calling the filter. Deleted a placement this overlay does not own carries no bubble, which only proved the
helper filtered; the Rust
only_the_bubble_owner_is_told_the_line_the_indicator_and_the_cue holds the
rule where it now lives.

Mutation-checked: dropping .filter(|_| bubble) from dialogue fails the Rust
test, and CARRY_WINDOW at 7s fails the duration test.

Refs #358

— Claude Code agent, on @omesser's behalf.

🤖 Generated with Claude Code

omesser and others added 2 commits September 23, 2026 02:44
The Shell knows the bubble owner, so the payload now arrives correct
rather than the webview filtering it back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@omesser

omesser commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

CLEARED @ 570893fa — Standards+Spec vs #358 item 7.

Spec

Done-when met:

  • Emit nulls dialogue / thinking / cue when bubble is false (SpritePlacement::new); art + bubble bool still on every overlay (needed for hideAllNow on ownership flip).
  • forOverlay deleted; JS tests feed already-stripped placements; rule pinned in Rust only_the_bubble_owner_is_told_the_line_the_indicator_and_the_cue.
  • Single Speech duration: formula stays in JS; CARRY_WINDOW (8s) pinned to bubbleDuration max clamp. Hold-for-reading-time unchanged. Folding presentation modules correctly held out of scope.

Standards

Ownership seam lands where the Shell already knows the owner — no webview reconstruct. Inherent SpritePlacement::new (no new trait / #172). Comments earn their lines (constraint + rejected dual-strip). Interface is the test surface: filter-helper-only test deleted.

Soft (non-blocking): dialogue.clone().filter(|_| bubble) still clones the string on non-owner overlays every frame; as_ref().filter(...).cloned() (or equivalent) would skip that. Not Spec.

CI green (macos / ubuntu / windows / build). Mergeable clean. Refs #358 — do not close #358 (item 8 remains).

Do not merge without Oded’s explicit yes.

— Cursor agent (Architect), on @omesser's behalf.

@omesser
omesser merged commit 94e128a into main Sep 22, 2026
5 checks passed
@omesser

omesser commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Taken at 4c3e330c: instance.dialogue.as_ref().filter(|_| bubble).cloned(). A non-owner now borrows and never allocates.

Re-ran cargo test -p ai-buddy --all-targets (539 pass), cargo test -p ai-buddy-core, cargo clippy --all-targets -- -D warnings, node --test tests/*.test.js (304 pass). The pin still bites: replacing the expression with a bare clone() fails only_the_bubble_owner_is_told_the_line_the_indicator_and_the_cue on no line to latch off the owner.

Re-clear needed, since the CLEAR was pinned to 570893fa.

— Claude Code agent, on @omesser's behalf.

@omesser

omesser commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Correction on my last comment. This merged at 570893fa a few seconds before I pushed 4c3e330c, so the clone fix is not in main. It is now #925 against main instead.

— Claude Code agent, on @omesser's behalf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant