Skip to content

Stop logging surface resize traffic in the raw messages panel - #292

Merged
jgindin merged 5 commits into
mainfrom
resizing/212-history-filter
Oct 23, 2026
Merged

jgindin merged 5 commits into
mainfrom
resizing/212-history-filter

Conversation

@jgindin

@jgindin jgindin commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Rebases and integrates PR #212 (preserving Suyang Wang's authorship on the original two commits) onto main:

  1. Exclude SURFACE_RESIZE and CONSOLE_LOG from HostCommunication.messageHistoryBuffer:
    • Adds UNBUFFERED_MESSAGE_TYPES (PreviewBridgeMessageType.SURFACE_RESIZE and PreviewBridgeMessageType.CONSOLE_LOG) and MAX_HISTORY_BUFFER_SIZE = 100 in HostCommunication.recordEnvelope so high-frequency resize telemetry does not evict protocol traffic (RENDERER_READY, RENDER_A2UI, DATA_MODEL_CHANGE, SEND_TO_SERVER) from the 100-entry history buffer before debug panels open.
  2. Preserve messageStream$ and latestEnvelope delivery for SURFACE_RESIZE:
    • Keeps this.latestEnvelopeSignal.set(envelope) and this.messageStreamSubject.next(envelope) unfiltered so RenderedFrame and RawFrame continue receiving SURFACE_RESIZE envelopes.
  3. Filter live SURFACE_RESIZE traffic in RawMessages and drop redundant history filtering:
    • Adds EXCLUDED_MESSAGE_TYPES (CONSOLE_LOG and SURFACE_RESIZE) in RawMessages.postMessageListener so live resize messages do not flood the open Raw Messages panel, and removes the redundant .filter(...) on this.hostComm.getEnvelopeHistory() in the RawMessages constructor.
  4. Document messageHistoryBuffer readers:
    • Updates the messageHistoryBuffer JSDoc comment to list all three debug panels that seed from getEnvelopeHistory() (RawMessages, Events, and DataModel).

Supersedes #212.

Pre-launch Checklist

  • I signed the [CLA].
  • I read the [Contributors Guide].
  • I read the [Style Guide].
  • I have added updates to the [CHANGELOG].
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on fork, I have verified that scripts/e2e_test.sh passes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prevents high-frequency SURFACE_RESIZE messages from evicting other protocol messages in the history buffer of HostCommunication while ensuring they are still broadcasted on the message stream. It also updates RawMessages to ignore these messages and adds comprehensive unit tests. The review feedback suggests removing a redundant filtering step of the history buffer in RawMessages and recommends explicitly adding CONSOLE_LOG to UNBUFFERED_MESSAGE_TYPES in HostCommunication to improve robustness and self-documentation.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit fc60c61):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

suyangw-g and others added 4 commits October 22, 2026 11:09
A guest reports SURFACE_RESIZE on every reflow of its content, and each
rendered surface runs its own guest, so one host layout change emits a
message per surface. During a streaming response these filled the
panel's 100 entry window and evicted the protocol traffic the view
exists to show.

The type is now excluded alongside CONSOLE_LOG through a single set,
applied both to the live stream and to the history replayed when the
panel opens.

HostCommunication keeps its own 100 entry buffer to seed that history,
so filtering in the panel alone would leave it showing nothing. Resize
messages are kept out of that buffer too, while still being broadcast
on messageStream$ because RenderedFrame uses them to size its iframe.
Keep `ignores SURFACE_RESIZE messages completely` focused strictly on
ignoring `SURFACE_RESIZE` (mirrors `CONSOLE_LOG`). Add a companion test
that emits all non-excluded `PreviewBridgeMessageType` values to ensure
none are accidentally ignored. Also replace `POST_MSG_1` in the seeded
history test with `PreviewBridgeMessageType.RENDER_A2UI`.
Adds a HostCommunication test that interleaves SURFACE_RESIZE with
SEND_TO_SERVER past the 100-entry history cap and checks all three
outputs of recordEnvelope together: the history holds only the newest
100 non-resize envelopes, messageStream$ still emits every resize,
and latestEnvelope still tracks the newest envelope, including a
resize. The existing test did not cover the latest-envelope signal or
the cap with resizes interleaved.
On main the envelope history seeds the raw messages, events, and data
model panels, not only raw messages. The comment now names all three
and states that unbuffered types still update latestEnvelope.
@jgindin
jgindin force-pushed the resizing/212-history-filter branch from ae5e210 to 62a8155 Compare October 22, 2026 16:32
@jgindin
jgindin requested a review from suyangw-g October 22, 2026 17:07

@wrenj wrenj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #292. Left comments on SURFACE_RESIZE still occupying slots in earlyMessageBuffer before iframe registration, RawMessages seeded-history filtering, and a minor doc/test note.

@jgindin
jgindin force-pushed the resizing/212-history-filter branch from 0bbfb4c to bd6b216 Compare October 22, 2026 22:35
Prevents pre-registration SURFACE_RESIZE messages from evicting
RENDERER_READY in earlyMessageBuffer, clarifies UNBUFFERED_MESSAGE_TYPES
doc comments, and consolidates the duplicate SURFACE_RESIZE history
test.
@jgindin
jgindin force-pushed the resizing/212-history-filter branch from bd6b216 to fc60c61 Compare October 23, 2026 14:06
@jgindin
jgindin merged commit 5fc60bd into main Oct 23, 2026
15 checks passed
@jgindin
jgindin deleted the resizing/212-history-filter branch October 23, 2026 15:16
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.

3 participants