Skip to content

fix: keep streaming terminal inside body - #558

Merged
Mohamed Mansour (mohamedmansour) merged 6 commits into
mainfrom
mohamedmansour/bump-v0.0.30
Sep 24, 2026
Merged

Mohamed Mansour (mohamedmansour) merged 6 commits into
mainfrom
mohamedmansour/bump-v0.0.30

Conversation

@mohamedmansour

@mohamedmansour Mohamed Mansour (mohamedmansour) commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Legitimacy: legit bug
  • Root cause: streaming terminal records were emitted only after traversal finished, so the parser had already written the raw </body></html> tail and the final boundary script landed after </html>.
  • Fix: emit the terminal record at the structural body_end hook after body injections and before the raw closing tags, then coalesce it with the closing tail in the existing final flush.
  • Docs: rewrote DESIGN.md into a compact high-level architecture/specification document and updated agent guidance so future changes keep it focused on durable contracts instead of implementation history.

Regression proof

  • Added streaming_terminal_record_emits_before_body_close, which fails on the previous behavior because the terminal [0,4,0,{}] record appeared after </body>/</html>.

Performance and memory

  • No new retained state, heap allocation, protocol field, or client JavaScript.
  • Preserves the previous final flush count by coalescing the terminal record with the raw closing-tag tail, avoiding an extra tiny transport write.

Validation

  • cargo test -p microsoft-webui-handler streaming_terminal_record_emits_before_body_close
  • cargo test -p microsoft-webui-handler streaming_
  • cargo test -p microsoft-webui-handler
  • cargo xtask check with process-local TEMP/TMP under D:\webui-windows\target\pr-build-temp

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
mddinbox

This comment was marked as outdated.

@mddinbox mddinbox 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.

Review Summary

  • Target: 8d0fc32d...1eb3f6f9 (base...head)
  • Coverage: complete diff (all 8 changed files), including running cargo test -p microsoft-webui-handler at head (36+ tests pass, including the new streaming_terminal_record_emits_before_body_close regression test)
  • Challenge: independent
  • Compatibility: the streaming code change is backward compatible (only reorders where the terminal record is written relative to </body>); the DESIGN.md rewrite is a spec/contract-documentation change, not a runtime compatibility break
  • Verdict: request-changes

Findings

[medium] DESIGN.md rewrite silently drops durable contracts unrelated to this fix

  • Location: DESIGN.md (whole-file rewrite, ~6848 -> ~333 lines)
  • Confidence: high

The streaming-terminal-placement fix itself (crates/webui-handler/src/streaming/{mod,checkpoint,vm}.rs, lib.rs) is correct and well tested — verified by running the full microsoft-webui-handler suite at head, all green, plus manual trace confirming body_end now emits the terminal record exactly once before the raw </body></html> tail is written, and ContinuationVm::finalize only flushes/ends without re-emitting. However, this PR bundles a large, unrelated rewrite of DESIGN.md (and .github/copilot-instructions.md / two SKILL.md files) that redefines DESIGN.md from an exhaustive living specification to a condensed architecture doc. That rewrite drops concrete durable contracts that are still true of the implementation and were not carried anywhere else, e.g. the $webui reserved-state-channel rule "$webui is stripped from the client hydration payload for both full and projected state, so boundary HTML is never re-serialized into the DOM" is present in the base version but has no equivalent in the new version. Per this repo's own (also-being-edited-in-this-PR) rule that DESIGN.md is the living/mandatory specification, deleting such contracts without an exhaustive audit risks future implementers silently violating them, and this scope is unrelated to a PR titled "fix: keep streaming terminal inside body."

Fix: Split the DESIGN.md/instructions/skill restructuring out of this bug-fix PR into its own PR, with an explicit accounting of every durable contract that is condensed vs. dropped (e.g. restore the $webui "never hydrated" invariant, and audit the rest of the ~6500 removed lines for similar losses) so it can be reviewed on its own merits.

Findings verification

  • Ran cargo test -p microsoft-webui-handler streaming_terminal and the full cargo test -p microsoft-webui-handler suite at PR head (1eb3f6f) in a scratch worktree: all pass.
  • Confirmed via git show that the terminal record is emitted exactly once (in process_streaming_signal's body_end handling) and ContinuationVm::finalize no longer re-emits it, ruling out double-emission.
  • Confirmed via git show diff of DESIGN.md at base vs. head that the $webui "Never hydrated" contract has no surviving equivalent in the new file.

…o mohamedmansour/bump-v0.0.30

# Conflicts:
#	DESIGN.md

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mohamedmansour

Copy link
Copy Markdown
Contributor Author

Addressed the changes-requested feedback by removing the DESIGN/guidance rewrite from the effective PR diff; the branch now carries only the streaming terminal placement fix plus its minimal spec update. I reran \cargo xtask check\ successfully before pushing.

@mddinbox mddinbox 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.

Re-reviewed the current head 86f9eb8 against base 4f0f45b. The prior documentation-scope finding is resolved by the revert commits; the remaining streaming change emits the terminal record exactly once at body_end before , preserves the client record contract, and has complete passing CI including Windows. No new issues found.

@mohamedmansour
Mohamed Mansour (mohamedmansour) merged commit 262f735 into main Sep 24, 2026
35 checks passed
@mohamedmansour
Mohamed Mansour (mohamedmansour) deleted the mohamedmansour/bump-v0.0.30 branch September 24, 2026 02:03
Mohamed Mansour (mohamedmansour) added a commit that referenced this pull request Sep 27, 2026
## Release

Bumps WebUI to `0.0.30` across Rust, npm, Python, and .NET package
metadata and updates desktop crate version examples. Native desktop and
Press support is distributed as opt-in, version-matched platform
packages; the former standalone `webui-press` npm command is replaced by
`webui press` without a Node command wrapper. The six new desktop
platform packages include READMEs. The native IPC fixture shares the
workspace lockfile after #568.

Previous release tag: `v0.0.29`

## Changes since `v0.0.29`

Features:

- WebUI Press ships native npm artifacts for macOS, Windows, and Linux
and runs through the opt-in `webui press` command (Add native npm
distribution for WebUI Press #555 by @copilot-swe-agent, fix: distribute
native desktop and Press sidecars #570 by @mohamedmansour).
- A lean Rust desktop SDK adds system webviews, app scaffolding, and
typed application IPC (feat: add lean Rust desktop SDK with typed IPC
#367 by @mohamedmansour).
- Opt-in native desktop npm packages make `webui desktop` available
without adding desktop webview dependencies to the base installation
(fix: distribute native desktop and Press sidecars #570 by
@mohamedmansour).
- Windows desktop apps gain native App SDK caption controls (feat: add
native Windows App SDK caption controls #560 by @mohamedmansour).
- Desktop apps can be configured without package metadata (feat:
configure desktop apps without package metadata #569 by
@mohamedmansour).

Fixes:

- Duplicate outlets at one route level produce an actionable build
warning instead of silently dropping later outlets (Warn on duplicate
outlets at the same route level #551 by @copilot-swe-agent).
- Press builds keep temporary inputs and outputs on the same filesystem
volume (fix: keep Press builds on one filesystem volume #552 by
@mohamedmansour).
- Streaming terminal markup stays inside the HTML body (fix: keep
streaming terminal inside body #558 by @mohamedmansour).
- The WebUI reference loader selects the correct source or
installed-package reference for the target project (fix: select WebUI
reference by target project #559 by @mohamedmansour).
- The Contact Book desktop icon displays correctly and header
double-click behavior is restored (fix: show Contact Book desktop icon
and restore header double-click #562 by @mohamedmansour).
- Linux desktop IPC preserves navigation and shutdown reasons when
retiring native requests (fix: preserve Linux IPC retirement reasons
before cancellation #566 by @mohamedmansour).
- Reactive callbacks wait until components are ready (fix: defer
reactive callbacks until components are ready #564 by @mohamedmansour).
- Windows desktop state reads tolerate transient file-open contention
while retaining atomic state replacement (fix: handle Windows state
contention and synchronize IPC tests #571 by @mohamedmansour).

Docs:

- Routing, project-specific reference installation, and interactivity
guidance were updated (Warn on duplicate outlets at the same route level
#551 by @copilot-swe-agent, fix: select WebUI reference by target
project #559 by @mohamedmansour, fix: defer reactive callbacks until
components are ready #564 by @mohamedmansour).
- Press installation and desktop SDK, caption control, icon,
configuration, and opt-in native sidecar documentation were expanded
(Add native npm distribution for WebUI Press #555 by @copilot-swe-agent,
feat: add lean Rust desktop SDK with typed IPC #367 by @mohamedmansour,
feat: add native Windows App SDK caption controls #560 by
@mohamedmansour, fix: show Contact Book desktop icon and restore header
double-click #562 by @mohamedmansour, feat: configure desktop apps
without package metadata #569 by @mohamedmansour, fix: distribute native
desktop and Press sidecars #570 by @mohamedmansour).
- Architecture and subsystem references were clarified, with the todo
tutorial kept aligned (chore: keep DESIGN.md architectural and preserve
internal contracts #563 by @mohamedmansour).

Maintenance:

- The WebUI Press npm package moved into the shared `packages/`
workspace (chore: move webui-press npm package #556 by @mohamedmansour).
- Desktop acceptance and native IPC test orchestration moved to Rust
xtask and the workspace Cargo lockfile (chore: migrate desktop
acceptance tests to Rust xtask #568 by @mohamedmansour).
- Desktop IPC capacity assertions now wait for the admitted handshake
worker to release its permit (test(desktop): wait for handshake capacity
before checking retired work #572 by @mohamedmansour).
- GitHub Actions dependencies were updated (chore(deps): bump the
github-actions group with 2 updates #565 by Dependabot).

## Validation

- `cargo xtask desktop-acceptance` and the full `cargo xtask check`
passed on the merged 0.0.30 tree.
- `cargo xtask publish-stage --target aarch64-apple-darwin
--native-only` staged core, Press, and desktop binaries. Seven local
0.0.30 tarballs were packed and installed offline in a fresh npm
consumer; installed binaries matched the staged release artifacts by
SHA-256.
- Installed `webui build` and `inspect` succeeded; `webui serve`
returned HTTP 200. Installed `webui press build` rendered a one-page
full site after installing its expected `esbuild`, TypeScript, and
framework peers. Installed `webui desktop init`, `build`, `package`, and
`run` succeeded. Both `desktop run` and the packaged macOS `.app` loaded
an image and executed page JavaScript that sent the expected heading to
a local probe. Core and desktop builds also passed with Node absent from
`PATH`.
- `pnpm --dir docs build` passed after refreshing the staged workspace
CLI. `cargo xtask native-ipc --timeout 60` passed source and packaged
macOS native IPC, including two BFCache restores in each mode, plus the
no-IPC fixture.
- PR Checks run 36299856666 finished green: Build (Linux) passed
unchanged on a targeted rerun after an intermittent packaged
history-navigation assertion; Build (macOS) passed on a targeted rerun
after GitHub reported its first hosted runner lost communication; Build
(Windows) and all six native npm platform jobs passed. All 41 current PR
checks are green. The deterministic acceptance-fixture correction for
the Linux race is separately green in #573 but is not yet part of this
release branch. Local npm smoke covers macOS arm64, not the full release
matrix.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants