Skip to content

fix: preserve inspection state across reentrant updates - #10

Open
leiysky wants to merge 9 commits into
mainfrom
dev/fix-inspection-reentrancy
Open

leiysky wants to merge 9 commits into
mainfrom
dev/fix-inspection-reentrancy

Conversation

@leiysky

@leiysky leiysky commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Inspection callbacks could lose their source context during nested updates, hidden hierarchy focus could resolve against an obsolete scene, and nested viewport broadcasts could recurse or reach listeners in different orders.

Define the compatibility contract around three separate values: accepted logical state, the completed frame, and a notification's captured source snapshot. Nested synchronous commands update getters immediately; the current callback or DOM broadcast finishes with its captured payload before later reports run. Pending inspect/select values coalesce independently, preserving each entry's existing notification policy without promising an atomic pair across nested commands.

Use one interaction owner per chart for synchronous state changes, validated presentation effects and channel reports. Channels bind their compatibility order at creation. Both runtimes share keyboard reading transitions while retaining their own range input and Escape boundaries. Hierarchy commands resolve against the compiled tree and retain a complete positioning intent across zero-sized measurements; direct private fields replace redundant state-copy reducers. Metric rendering, reading and dismissal share one captured presentation path, with validation after renderer and popover hooks. Ready requires a completed frame from the current source, including when data is replaced in a hidden container.

Scene ownership, runtime lifetime separation and model-version checks reject stale layouts and failures. Document cleanup observes committed data, Canvas Escape has one owner, same-value acknowledgements quiesce, and changing-value feedback yields to the browser. Observer failures preserve other valid queued work. These policies and their regression map are documented in docs/headless.md and development/interaction-transactions.md.

Public factory signatures, session/runtime methods, event payloads, context types, pin behavior and entry-specific notification policies remain unchanged. Fixed metric entries omit aggregate switching; all existing bundle limits remain unchanged.

Validation:

  • pnpm verify: 364 unit tests, 130 Node tests, 16 bundle checks, 451 Chromium tests, and installed-package acceptance passed.
  • All 17 family/entry combinations cover retained unread snapshots in both callback channels after replacement/disposal, plus repeated-input compatibility. Component tests cover nested broadcasts, current getters, hidden replacement readiness and renderer reentry.
  • Existing regressions include 48 seeded independent last-intent reference runs, hidden/collapsed focus, changed measurements, nested keyboard input, viewport ordering, Escape boundaries, callback exceptions, stale layouts and runtime reuse.
  • Compared signatures and public members across all 20 exported entries with the previous PR head: no differences.
  • pnpm docs:build and git diff --check passed.
  • Existing bundle limits pass: headless consumer 39,927 bytes gzip; standalone script 39,524 bytes gzip, both below 39 KiB.

@leiysky leiysky changed the title fix: preserve inspection state across nested callbacks and navigation fix: make inspection updates and notifications transactional Oct 29, 2026
@leiysky leiysky changed the title fix: make inspection updates and notifications transactional fix: preserve inspection state across reentrant updates Oct 29, 2026

This branch was successfully deployed

1 active deployment
preview — 63774a86 Deployed Oct 29, 2026 by leiysky via Deploy preview #15
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