Skip to content

Redesign WebInspectorKit ownership and model APIs - #230

Merged
lynnswap merged 81 commits into
mainfrom
codex/rearchitect-inspector-kits
Jul 11, 2026
Merged

Redesign WebInspectorKit ownership and model APIs#230
lynnswap merged 81 commits into
mainfrom
codex/rearchitect-inspector-kits

Conversation

@lynnswap

@lynnswap lynnswap commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Purpose

Make WebInspectorDataKit and WebInspectorProxyKit easier to use and maintain by giving model state, command authority, event delivery, and lifecycle transitions explicit owners. This is an intentional breaking redesign targeting iOS 18.4 and macOS 15.4.

Changes

  • Replace enum-style domain clients and shared context forwarding with actor-confined model contexts, value-style domain handles, and protocol-backed structured event scopes.
  • Introduce snapshot-plus-delta model feeds for DOM, Network, Console, Runtime, and CSS state, with lossless authoritative replay and bounded auxiliary subscribers.
  • Centralize connection ownership, target replacement, reply lifecycle, capability leases, picker activation, and native attachment synchronization in ProxyKit.
  • Add concrete Network and Console query APIs with atomic fetched-results publications.
  • Make CSS declarations actor-confined observable identity models, serialize refresh and mutation work, and keep collection snapshots limited to row topology changes.
  • Match WebKit CSS ownership by keeping node-local property projections while storing inspector edit baselines once per model context and target-scoped style ID.
  • Preserve shared-rule edit highlighting across DOM-node selection, shorthand topology changes, stale responses, frame navigation, and target retirement.
  • Defer selected-style rendering until replacement Observation tracking is installed so a loaded state cannot be lost behind an empty placeholder.
  • Preserve CSS resource phases across cancellation without allowing a cancelled gate waiter to change an active load.
  • Update UI ownership, asynchronous custom tab resources, testing fixtures, compile contracts, migration guidance, and architecture documentation.
  • Raise deployment targets to iOS 18.4 and macOS 15.4 and adopt caller-actor lifecycle semantics enabled by isolated deinitialization.
  • Fix native inspector synchronization under large enable-time event bursts by registering the DataKit consumer before capability activation and publishing readiness only after activation completes.
  • Preserve accepted test-peer replies when their command completion immediately triggers owner-driven connection close.
  • Detach stale installed sessions conditionally and clear recorded DOM page highlights through the committed model-feed reset path.

Developer impact

This PR removes obsolete controllers, forwarding APIs, cold event APIs, and legacy semantic test backends. Existing clients must migrate to WebInspectorModelContext, domain handles, scoped event APIs, and the new query contracts described in Docs/MIGRATION.md. CSSStyleProperty is now an observable reference type; CSSStyleSection, CSSStyle, and CSSStyleRule are no longer Sendable.

Testing

  • xcodebuild test -workspace WebInspectorKit.xcworkspace -scheme WebInspectorKit -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest'
  • swift test --sanitize=thread: 318 tests passed with no reported race
  • CSS regression tests cover shared rules across nodes, target scope isolation, stale responses, frame-target reset, topology changes, and load cancellation
  • Contract and model-context confinement scripts passed
  • Monocly built, installed, and launched on iPad Pro 13-inch (M5), iPadOS 26.5
  • Native inspector attachment verified on a live X page with high-volume Network replay
  • codex-review completed with no findings

lynnswap added 30 commits July 10, 2026 05:49
Make fetched-results updates self-contained and newest-one bounded, remove the forwarding controller, and migrate Network UI to consume results directly.

Order NetworkRequestIndex mutations by contiguous sequence and retain per-result checkpoints so overlapping property updates cannot be lost.

BREAKING CHANGE: Remove WebInspectorFetchedResultsController and parameterize fetched-results transactions by item ID.
BREAKING CHANGE: domain event scopes now use connection-owned capability leases, bounded buffering, and fail-fast lifecycle semantics.
BREAKING CHANGE: DOM, CSS, Network, Console, Runtime, and Page are now target-scoped domain handles; nested Client types were removed.
lynnswap added 21 commits July 11, 2026 00:11
Start the DataKit consumer before capability activation and keep the authoritative model feed lossless so snapshot-to-delta continuity cannot fail under valid event bursts.

BREAKING CHANGE: WebInspectorModelContext.Failure no longer exposes feedBufferOverflow because the authoritative model feed no longer drops records.
Make each CSS declaration an actor-confined observable model, serialize refresh and mutation work, and update only the submitted property during a toggle.

Keep collection snapshots topology-only, rebind visible rows directly when positional backend IDs are reused, and reject stale declaration handles after structural edits.

BREAKING CHANGE: CSSStyleProperty is now an observable reference type, and CSSStyleSection, CSSStyle, and CSSStyleRule are no longer Sendable.
@lynnswap
lynnswap marked this pull request as ready for review July 11, 2026 03:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0955bd5af7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/WebInspectorUI/Containers/WebInspectorSession.swift
Comment thread Sources/WebInspectorDataKit/WebInspectorModelContext.swift

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: defd8dd5da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lynnswap
lynnswap merged commit 864bebb into main Jul 11, 2026
4 checks passed
@lynnswap
lynnswap deleted the codex/rearchitect-inspector-kits branch July 11, 2026 04:48
lynnswap added a commit that referenced this pull request Jul 28, 2026
Revert PR #230 while preserving the PR #229 baseline.\n\nThis reverts commit 864bebb.
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