Skip to content

Adding Microsoft SECURITY.MD - #4

Merged
Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
users/GitHubPolicyService/74508f07-9c8a-47df-ae92-a376553d6b4d
Apr 17, 2026
Merged

Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
users/GitHubPolicyService/74508f07-9c8a-47df-ae92-a376553d6b4d

Conversation

@microsoft-github-policy-service

Copy link
Copy Markdown

Please accept this contribution adding the standard Microsoft SECURITY.MD 🔒 file to help the community understand the security policy and how to safely report security issues. GitHub uses the presence of this file to light-up security reminders and a link to the file. This pull request commits the latest official SECURITY.MD file from https://github.com/microsoft/repo-templates/blob/main/shared/SECURITY.md.

Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.

@codemonkeychris
Chris Anderson (codemonkeychris) merged commit 0b06701 into main Apr 17, 2026
1 check passed
Chris Anderson (codemonkeychris) added a commit that referenced this pull request Apr 18, 2026
…ames

Addresses the second-round AI-agent field feedback. Build still compiles
and 3708 unit tests pass.

- #2 Stable window id: WindowIdAllocator.Reserve pins the primary
  devtools window to "main" so the handle survives switchComponent
  changing the window title. Windows payload surfaces `currentComponent`.
- #4 Scroll units + readback: description explicitly calls out
  percentage-delta semantics; response now carries `scrollOffsetPx` and
  `scrollableSizePx` dug out of the underlying ScrollViewer, and the
  -1 sentinel is replaced with null when an axis isn't scrollable.
- #5 Accessible names at mount: the reconciler now mirrors visible
  captions into AutomationProperties.Name for Button, HyperlinkButton,
  RepeatButton, ToggleButton, DropDownButton, SplitButton,
  ToggleSplitButton, CheckBox, RadioButton, ToggleSwitch, TextField, and
  TextBlock. Author-supplied .AutomationName(...) still wins; the
  Update path handles label changes via a provenance-aware compare so
  author overrides are preserved.
- #6 includeReactorSource rejection: tree tool returns structured
  not-implemented instead of silently no-opping.
- #7 ComboBox expand/collapse: new `expand` / `collapse` MCP verbs
  wrap IExpandCollapseProvider; `select` auto-expands a closed
  container so the popup items resolve.
- #9 Fire lambda confusion: unknown-event payload lists
  reachableMethods and explains inline lambdas aren't reflectable;
  tool description warns upfront.
- Usability: GET /mcp self-describes (schema, protocolVersion, tools,
  selectorGrammar, events); tools/list adds _selectorGrammar +
  _treeSchemaVersion extensions so POST-based agents get the grammar
  without a second hop; components tool returns ComponentInfo[] with
  isNested/isPublic/namespace; AnnounceReady emits a
  {"event":"devtools-ready", ...} JSON sentinel alongside the human
  banner; full-view tree nodes carry supportedPatterns[] probed from
  the UIA peer.

#8 (state selector scoping) deferred — requires reconciler component
registry. The resolution table previously in the feedback doc is
superseded; the doc itself has been removed from the working tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request Apr 18, 2026
…ames

Addresses the second-round AI-agent field feedback. Build still compiles
and 3708 unit tests pass.

- #2 Stable window id: WindowIdAllocator.Reserve pins the primary
  devtools window to "main" so the handle survives switchComponent
  changing the window title. Windows payload surfaces `currentComponent`.
- #4 Scroll units + readback: description explicitly calls out
  percentage-delta semantics; response now carries `scrollOffsetPx` and
  `scrollableSizePx` dug out of the underlying ScrollViewer, and the
  -1 sentinel is replaced with null when an axis isn't scrollable.
- #5 Accessible names at mount: the reconciler now mirrors visible
  captions into AutomationProperties.Name for Button, HyperlinkButton,
  RepeatButton, ToggleButton, DropDownButton, SplitButton,
  ToggleSplitButton, CheckBox, RadioButton, ToggleSwitch, TextField, and
  TextBlock. Author-supplied .AutomationName(...) still wins; the
  Update path handles label changes via a provenance-aware compare so
  author overrides are preserved.
- #6 includeReactorSource rejection: tree tool returns structured
  not-implemented instead of silently no-opping.
- #7 ComboBox expand/collapse: new `expand` / `collapse` MCP verbs
  wrap IExpandCollapseProvider; `select` auto-expands a closed
  container so the popup items resolve.
- #9 Fire lambda confusion: unknown-event payload lists
  reachableMethods and explains inline lambdas aren't reflectable;
  tool description warns upfront.
- Usability: GET /mcp self-describes (schema, protocolVersion, tools,
  selectorGrammar, events); tools/list adds _selectorGrammar +
  _treeSchemaVersion extensions so POST-based agents get the grammar
  without a second hop; components tool returns ComponentInfo[] with
  isNested/isPublic/namespace; AnnounceReady emits a
  {"event":"devtools-ready", ...} JSON sentinel alongside the human
  banner; full-view tree nodes carry supportedPatterns[] probed from
  the UIA peer.

#8 (state selector scoping) deferred — requires reconciler component
registry. The resolution table previously in the feedback doc is
superseded; the doc itself has been removed from the working tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 11, 2026
… blocker

- Status snapshot at the top of the task list — Phase 0/1 code-complete on
  feat/038-mur-check, not merged to main, blocked on threshold tuning.
- Phase 0 (0.1–0.5) and Phase 1 (1.1–1.7) checkboxes ticked, with one-line
  notes on the four items deferred as follow-ups (Reactor-touching
  integration fixture, perf-trait wall-time test, full Hamming-vector
  overload ranking, CS0103 return-type filter).
- Data Checkpoint A re-audit (2026-05-10): Gap #1 (receiver_type), #2
  (dedup), #4 (cosmetic) all FIXED in the new harness output. Gap #3
  (ranker negative class) still NOT fixed — all 3 ranker-labels rows are
  positive class; for 3 runs the spec expects ~30–80 rows.
- Plus a fix_kind classifier nit: ButtonElement HorizontalAlignment →
  HAlign should be renamed_member, not other (receiver type unchanged,
  member name swapped).
- Recommendation against kicking off the 50-run sweep until Gap #3 lands;
  records that Data Checkpoint B is therefore still blocked.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 11, 2026
…c-count gate) (#243)

* docs(specs/038): add MSBuild passthrough via `--` to mur check CLI

Today's CheckCommand accepts only <path> and hardcodes --nologo,
-v:m, and -p:Platform={host arch}. Without an escape hatch the only
fallback for an agent that needs to override Platform, pick a
Configuration, skip restore, or pass arbitrary -p: properties is to
drop mur check and run dotnet build directly - which discards every
benefit the spec adds.

Adds a "CLI shape and MSBuild passthrough" subsection in §8
covering: the `mur check [path] [mur-flags] [-- <msbuild args>]`
shape, default-merging rules (auto-inject only if user did not
specify), boundary semantics (bare `--` is the unambiguous
separator; unknown mur-flags error), ranker-unchanged invariant
(passthrough alters the build, not diagnostic scoring), and trace
faithfulness (record effective command line). Adds an
implementation bullet to Phase 4.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(specs/038): add detailed implementation task list

Mirrors the convention from docs/specs/tasks/036-window-design-
implementation.md: phased checkboxes, "task is done only when"
gate, conventions header. Adapted for spec 038's external
dependency on spec 037's data corpus.

Adds three concepts not in earlier task lists because no other
spec needed them:

- Human Validation Gate: six-bar checklist every Tier 3 rule
  must clear before merge (frequency >=5%, count >=10, cross-
  agent reproducibility, >=3 positive fixtures, >=2 negative,
  independent reviewer signoff). Plus auto-suppression policy
  for rules whose telemetry accept-rate drops below 50%.

- Data Checkpoints A/B/C/D: staged hand-offs from spec 037's
  harness with explicit blocking relationships. A is the
  current 3-pair smoke (already landed); B/C/D gate Phase 1
  threshold tuning, Phase 3 rule authoring, and Phase 4 ranker
  training respectively.

- Eval Checkpoints EC1-EC4: 5xN batches on gpt-5.5 vs reactor-
  calc/kanban with predicted lift bands and pass criteria.
  EC1 after Tier 2 only; EC2 after deterministic ranker + 5
  rules; EC3 at V1 ship (10-15 rules); EC4 if learned ranker
  is pursued.

Quantity bars (per the user's question): 5 rules before EC2,
10-15 rules covering >=80% of fix events for V1 ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(spec-038): land Phase 0 + Phase 1 of `mur check` did-you-mean engine

Phase 0 (instrumentation, no behavior change):
- `mur check --trace <path>` writes one JSONL row per parsed diagnostic to
  <path> in addition to stdout. Schema: {ts, code, severity, file, line, col,
  msg, receiver_type?, member?, mode}. Source code text is never written;
  absolute paths outside the project root are redacted to "<external>"; rows
  are bounded to 2 KB.
- New folders src/Reactor.Cli/Check/{Suggesters,Rules}/ with README pointers
  to spec 038 §5/§6 and the Validation Gate.

Phase 1 (Tier-2 Roslyn semantic suggester):
- ISuggester contract + SymbolSuggester covering CS1061, CS0103, CS0117,
  CS1503, CS7036 against Microsoft.UI.Reactor.* symbols.
- CompilationLoader: csproj/source resolution, project.assets.json reference
  resolution, (csproj-path, file-mtime-hash) cache, symlink containment, perf
  budget cold ≤ 500 ms / warm ≤ 50 ms.
- FactoryIndex: pre-filter over Microsoft.UI.Reactor.Factories.* static
  methods with cached parameter-name arrays for named-argument suggestions.
- StringSimilarity (Jaro–Winkler) for fuzzy member-name matching.
- SuggesterOrchestrator wires the suggester into CheckCommand.Run; Tier-1
  HintFor still wins ties at the format layer (spec §9).
- MUR_TELEMETRY=1 opt-in: appends (code, suggester, confidence,
  evidence_short) to ~/.mur/telemetry/<yyyy-mm-dd>.jsonl. Fields bounded to
  256 bytes; no source text, file paths, or machine identifiers.
- Args parser recognises `--trace` and `--help`; rejects unknown flags
  rather than silently forwarding (full passthrough lands in Phase 2).

Tests:
- 66 unit tests under tests/Reactor.Tests/CheckCommandTests/ covering args
  parsing, trace schema/redaction/length cap, compilation loader, factory
  index, JaroWinkler, every suggester code path (positive + negative),
  orchestrator filtering (Reactor-touching gate), Tier-1-wins-ties, and
  telemetry opt-in/byte-bound.
- Integration smoke test exercising mur.exe end-to-end against a deliberately
  broken fixture under tests/Reactor.IntegrationTests/MurCheck/Fixtures/
  SmokeFixture/. Reactor-touching CS1061 fixture is scoped as a follow-up
  because it requires WindowsAppSDK restore.

Pause point per spec 038 task list:
- Phase 1.8 exit needs Data Checkpoint B (≥50 unique pairs from spec 037's
  harness) for per-code threshold tuning before merging to main.
- Phase 2 + 3 are blocked by Phase 1 merge / Data Checkpoint C respectively.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(specs/038): mark Phase 0 + Phase 1 complete; record harness Gap #3 blocker

- Status snapshot at the top of the task list — Phase 0/1 code-complete on
  feat/038-mur-check, not merged to main, blocked on threshold tuning.
- Phase 0 (0.1–0.5) and Phase 1 (1.1–1.7) checkboxes ticked, with one-line
  notes on the four items deferred as follow-ups (Reactor-touching
  integration fixture, perf-trait wall-time test, full Hamming-vector
  overload ranking, CS0103 return-type filter).
- Data Checkpoint A re-audit (2026-05-10): Gap #1 (receiver_type), #2
  (dedup), #4 (cosmetic) all FIXED in the new harness output. Gap #3
  (ranker negative class) still NOT fixed — all 3 ranker-labels rows are
  positive class; for 3 runs the spec expects ~30–80 rows.
- Plus a fix_kind classifier nit: ButtonElement HorizontalAlignment →
  HAlign should be renamed_member, not other (receiver type unchanged,
  member name swapped).
- Recommendation against kicking off the 50-run sweep until Gap #3 lands;
  records that Data Checkpoint B is therefore still blocked.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(specs/038): unblock Data Checkpoint B; record still_present_at_run_end as Phase-4 prereq

Audit pass 2 of the 6-row ranker-labels output (2026-05-10):

- Gap #3 (ranker negative class) is now FIXED. 4 positive / 2 negative on
  addressed_by_next_fix; harness emits per-build per-diagnostic rows; three
  CS8012 emissions in run 5d5fef… recorded as three independent training
  rows, exactly per spec 037 §3 "don't dedupe across builds".
- fix_kind classifier nit partially fixed — both pairs now classify as
  renamed_member; debatable for pair 2's structural rewrite but acceptable.
- New known limitation: still_present_at_run_end is uniformly false even
  when the diagnostic IS in the final build (CS8012 timing-tail
  fingerprint quirk). Primary ranker label addressed_by_next_fix is
  unaffected; auxiliary agent_ignored is corrupted, which breaks the
  spec 038 §11 auto-suppression-telemetry hook. Tracked as a Phase-4
  prerequisite — file with harness owner before Data Checkpoint D.

Status updates:

- Status snapshot at top: 50-run sweep cleared to start.
- Data Checkpoint B: status flipped from blocked to unblocked. Added a
  step-by-step "pickup procedure for the next session" so the next agent
  can run cold once the corpus lands (audit, threshold tuning, EC1, merge).
- Data Checkpoint D: documents still_present_at_run_end as the remaining
  prerequisite before training the learned ranker.
- Phase 1.8 exit criterion points at the pickup procedure instead of the
  stale "blocked" note.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(spec-038): tune Tier-2 SymbolSuggester thresholds against 50-run corpus

Phase 1 ship-gate calibration (Data Checkpoint B). Adds per-code emit
thresholds in src/Reactor.Cli/Check/Suggesters/Thresholds.cs, refactors
SymbolSuggester so the threshold gate has a single source of truth
(SuggestRaw exposes raw confidence; Suggest gates via Thresholds.For),
and removes the now-redundant duplicate cut from SuggesterOrchestrator.

Per-code values informed by tests/Reactor.Tests/CheckCommandTests/Tuning/
which runs the suggester against fixes.jsonl. Snapshot of the first run
is in docs/specs/tasks/038-tuning-reports/2026-05-10-50run.md:
  - CS1061 → 0.80 (only firing in corpus was at conf 0.43; raised
    threshold blocks structural-rewrite false positives)
  - CS0103 → 0.75 default (2/2 firings at conf 1.00 matched)
  - CS0117 / CS1503 / CS7036 → 0.75 default (insufficient signal in
    50-pair corpus; revisit at Data Checkpoint C, 500+ pairs)

Tuning harness is gated on env var MUR_TUNING_CORPUS so it skips
cleanly when the (sibling-repo) corpus isn't available.

Phase-1 next gate: Eval Checkpoint EC1 vs. main.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(specs/038): record EC1 5×N results; surface amortization-floor finding

EC1 5×N (n=5 paired rounds on gpt-5.5, round-3 prompt with reflection
ban + trust-the-suggestion + mur-check-is-the-build rules):

  kanban-variant — cost mean −24% / median −33% / CV 24% vs base 81%
                   wins 4 of 5 paired rounds; the suggestion mechanism
                   is itself a variance stabilizer.

  calc-variant   — cost mean +21% / wall mean +23%
                   real and consistent across the batch.

Diagnosis: ~5–8s per-invocation mur-check overhead does not amortize on
~150-LoC projects with no API exploration surface to skip. Validated
empirically — the prompt iterations that helped (round-2 reflection
ban, round-3 trust-mur-as-build) closed every explore-around-the-
suggestion loophole, but the floor remains.

Strict EC1 pass criterion ("tokens not regressed") fails on calc,
passes cleanly on kanban. Captured as:

  - spec 038 §11 risk row + §14 open question on a project-size /
    per-invocation-diagnostic-count gate
  - task doc EC1 results section with per-arm means/sd, paired comparisons
  - status snapshot updated; Phase 1 merge decision noted as pending

Decision options on the merge: (a) ship Phase 1 as-is and accept the
calc tax; (b) land the gate before merging. Either is product-side; this
commit only records the data and the design surface.

No code changes. SKILL.md intentionally left untouched — larger
mining sweep is running under the current SKILL.md to compare aided vs
un-aided baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(spec-038): scope Thresholds override to AsyncLocal to fix parallel-test race

ThresholdsTests.Each_handled_code_has_a_threshold_in_valid_range was flaking
because the tuner test (ThresholdTuningTests.Run_against_inline_one_row_corpus_produces_report)
temporarily writes Thresholds.PerCode to an all-zero map for its duration,
and xUnit's default cross-class parallelism let the validation tests observe
the zeroed state mid-tuner-run.

Switching the override channel to AsyncLocal isolates the tuner's scoped
change to its own logical thread; concurrent readers in other tests see
the immutable production defaults. Production code paths still go through
the same Thresholds.For(code) entry point — behaviour for the CLI is
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(spec-038): land diagnostic-count gate + Data Checkpoint C calibration

Two related changes:

1. Diagnostic-count gate (spec §11 risk row, §14 #8) — resolves the EC1
   calc-vs-kanban split where ~150-LoC calc regressed +21% cost while
   kanban won −24%. `CheckCommand.ShouldEmitSuggestions` skips Tier-2
   when an invocation surfaces fewer than `--suggest-threshold` unique
   CS-prefixed diagnostics; default 3, 0 disables. Counts the same
   dedup key `EmitDiagnostics` uses.

2. Data Checkpoint C — 525-pair mining corpus from spec 037's harness
   mirrored at `docs/specs/tasks/038-tuning-reports/2026-05-11-525run-source/`
   (1,027 fixes / 1,233 ranker rows / 104 clusters; `gpt-5.5` only).
   Tuning report at `2026-05-11-525run.md`.

The empirical CS-diagnostics-per-build distribution from the corpus
(43% of builds have 1 diagnostic, 28% have 2, 28.7% have ≥ 3) confirms
T=3 is the right initial cut-line. The 525-run corpus also surfaces
that JaroWinkler fuzzy match has near-0% empirical precision on
CS1061/CS0117 against Reactor types — the agent's typical mistake is
reaching for a WinUI-style name (`.VerticalAlignment`,
`Theme.AppBackground`) whose Reactor replacement is too far in
edit-distance to find, so we pick a wrong sibling. All per-code
thresholds held; systematic fix is Phase-3 rule authoring. Top three
rule targets identified in the report.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(spec-038): record EC1 re-run results; Phase 1 cleared to merge

5×N re-run on `feat/038-mur-check` @ aaa4cce (gate enabled, default
--suggest-threshold 3), same matrix as the prior EC1 batch.

  reactor-calc-mur-check  : cost -4%  (was +21%) — PASS
  reactor-kanban-mur-check: cost -33% (was -24%) — PASS, grew the win
  First-build OK 5/5 both variant arms.

Calc neutralized; kanban win preserved and grew. Phase 1 acceptance bar
met. Spec §11 risk row + §14 #8 updated to mark the mitigation validated.

Watch-item carried into Phase 2: kanban CV widened (24% prior -> 54%
this batch) because one of five runs hit 0 firings and tracked the
long-tail base path. Gate is path-dependent on agent's exploration
order, not just the project's static shape. Below Phase-1 blocker
threshold; Phase 2 telemetry should track per-run firing counts.

No code change in this commit — eval results + spec doc updates only.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(spec-038): add reference doc for `mur check` did-you-mean engine

Layered walkthrough of the system as shipped in this PR (Phase 0 + Phase 1
+ diagnostic-count gate): plain-language intro, four-tier architecture,
mining pipeline, threshold tuning, end-to-end recommendation flow, the
small-project gate, and a future-improvements section sketching Phases
2–4. Lives at docs/reference/ alongside the other developer-facing
references; points back to docs/specs/038… for decision history.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(spec-038): address CR feedback on PR #243

Addresses six review comments from Copilot reviewer on the Phase-1 PR:

1. Hoist CompilationLoader.Load to once per `mur check` invocation
   instead of once per emitted diagnostic. Even with the internal cache,
   Load() re-enumerates `.cs` files and recomputes the file-set hash on
   every call, so the prior wiring was O(diagnostics × files). Now O(1)
   per invocation via SuggesterOrchestrator.SuggestAgainst.

2. FindTreeFor suffix match required a path-separator boundary so a
   diagnostic on bare "Program.cs" no longer mis-binds to a sibling tree
   like "MyProgram.cs". Cross-platform: matches against both '/' and '\'
   prefixes since CSharpCompilation trees can carry either separator
   depending on the project's source-list. Added regression test.

3. Filter synthesized property/event accessors (get_X / set_X / add_X /
   remove_X) out of CollectStaticMembers + CollectInstanceMembers. The
   525-run calibration report flagged conf=0.88 emissions of
   `Theme.get_Background` — same hazard would surface on CS1061 against
   instance-member walks. Fixed at the source.

4. Telemetry.Truncate now enforces a true UTF-8 byte limit, not a char
   limit. Pure-ASCII content still hits the cheap fast path. New test
   covers a 200-glyph CJK string (600 bytes pre-truncation).

5. StringSimilarity header comment no longer claims "allocation-free on
   the hot path" — Jaro() allocates two bool[]s per call. Comment now
   reflects reality with a pointer to revisit via stackalloc if perf-
   trait tests show it on the hot path.

6. Drop the "`<path>` accepts a .cs file" claim from CheckArgs.HelpText
   and the CheckCommand.cs header. `dotnet build <single.cs>` doesn't
   work end-to-end so the help text was misleading. CompilationLoader
   still walks up to the nearest .csproj when seeded from a .cs file
   (tooling/test seam only).

Skipped: #6 (MurCheckSmokeTest.cs build-on-demand for mur.exe) — changes
the integration-tests CI contract and is cleanly scoped as a separate
follow-up.

Full suite: 7051/7097 pass (46 skipped — perf-trait + opt-in, unchanged).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(spec-038): adopt load-bearing framing; split Tier-3 rule classes; resolve symbol-binding

Doc-only updates across spec, task list, and reference doc to reflect the
decision that `mur check`'s did-you-mean engine is load-bearing
infrastructure for the next 1-3 years, not a token-saving stopgap base-
model improvements will erode.

Why now: Reactor will keep churning faster than models retrain, and WinUI
3 is structurally weak / cross-confused with WPF/Silverlight/WinUI 1/2 in
training data. The 525-run corpus directly evidences the confusion shape
(`.VerticalAlignment` on Reactor `*Element` types, `Theme.AppBackground`,
`.Style(...)`). Tier-2 fuzzy match cannot bridge those by edit distance;
only deterministic vocabulary-translation rules can.

Spec changes (038-mur-check-did-you-mean-design.md):
- §1: new "Why this is load-bearing" subsection with the two-condition
  argument and explicit sunset criterion (≥12mo API stability +
  ≥90% first-build-OK on ≥2 vendor-distinct models).
- §6: rename "induced pattern rules" → "induced and authored pattern
  rules"; split into Class A (induced, frequency-justified) and Class B
  (vocabulary-translation, structurally justified, frequency bar waived).
  Add the resolved symbol-binding decision: rules bind to Roslyn ISymbol
  references via RuleSymbolResolver, not name strings, with a CI gate
  that fails the build on unresolved rule targets.
- §11: two new risks — Reactor API churn invalidating rules/corpus, and
  data-pipeline SLA/owner — both with mitigations.
- §13 Phase 5: reframe from "only if needed" to "scheduled, deferred"
  pending Data Checkpoint D. Add explicit sunset criterion subsection.
- §14: resolve question #8 (symbol-binding decision recorded with
  rationale); add question #9 on vocab-table provenance; renumber
  project-size gate to #10.

Task list (tasks/038-mur-check-did-you-mean-implementation.md):
- Top: new "Framing (read this first)" section with the load-bearing
  argument and sunset criterion link.
- Phase 3: split rule template into Class A / Class B variants. Add §3.0
  pre-phase prerequisites (corpus-pipeline owner; minor-release refresh
  cadence; in-repo `038-vocab-table.csv`). Add §3.1a symbol-binding
  contract with CI gate. Update quantity gates + exit criterion for the
  two-class split.
- Phase 4: status change from "optional" to "scheduled, deferred until
  Data Checkpoint D"; escape hatch remains as the unexpected outcome.
- New "Maintenance (load-bearing operation)" section under cross-cutting
  concerns: API-churn protocol per Reactor minor; corpus freshness rule;
  per-rule accept-rate monitoring; annual sunset-readiness check.

Reference doc (docs/reference/mur-check-did-you-mean.md):
- §1: new "Why this is load-bearing" subsection mirrored from the spec.
- §9 Future improvements: new "The recurring failure mode: WinUI/WPF
  vocabulary confusion" subsection that names the structural failure
  shape, then reframes Phase 3 as Class A / Class B and Phase 4 as
  scheduled-not-optional. Symbol-binding decision called out.
- Out-of-scope (small LLM generator): reasoning now explicitly linked to
  the load-bearing argument (weak training data is why we need the
  system AND why a smaller model trained on it won't fix the gap).
- Glossary: new entries for Class A / Class B rule, Load-bearing,
  Sunset criterion. Validation Gate entry updated for the Class-B
  frequency-bar waiver.
- Closing: pointer to the new task-doc Maintenance section.

No code changes in this commit; all infrastructure decisions documented
here will land in Phase-3 rule PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(spec-038): address CR feedback round 2 on PR #243

Quality and self-consistency pass on the Phase-1 branch. All changes are
contained to Phase-1 surface; broader CR concerns about CS1061/CS0117 fuzzy
behavior, MSBuild-accurate loading, and per-code precision gating remain
scoped to Phase 2/3 per the spec's existing plan.

- CR #10: drop CS8602 warning in CompilationLoader by routing EmptyCompilation
  through a named factory method with explicit Array.Empty<> coalescing.
- CR #11: diagnostic regex now uses a reluctant file capture anchored on the
  (line,col): suffix so MSBuild lines with parenthesized path segments parse
  correctly. Added pipeline test.
- CR #8: TraceWriter.SanitizePath normalizes in-root absolute paths to
  project-relative (forward-slash) form so traces no longer carry
  `C:\Users\<name>\...` prefixes. Tests strengthened to assert no row is
  ever an absolute path.
- CR #13: replace misleading CS7036 tiebreak comment with accurate
  description; full Hamming-vector ranker stays a deferred follow-up per
  spec §1.5.
- CR #14: 525-run report reworded — "500-pair volume bar met, cross-agent
  bar NOT met"; Theme.get_Background note marked "fixed in this branch"
  with code reference.
- CR #2 (narrowed): tighten CS1061 factory-argument receiver check to
  require receiver IS-A factory return type only (dropped reverse
  IsAssignableFrom direction). Full AST-anchored receiver verification
  deferred to Phase-3 RuleSymbolResolver per §3.1a.
- Implementation doc deferred-follow-ups list updated to include
  receiver-anchoring (e) and Phase-2 loader/precision-gate work (f).

Verification: 98 CheckCommand unit tests pass (was 97 + new parens-path
test); MurCheck integration test passes; CS8602 warning eliminated.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 12, 2026
Append the EC3-final results subsection to the implementation tasks
doc; mark EC3-original as superseded (preserved as the historical
record of the typo-contaminated batch and the PASS-with-caveats
reasoning that drove the watch-item triage work).

EC3-final headline numbers (5×N landed 2026-05-12 on
eval/spec-038-ec3-2026-05-11 @ 053afe9):
  calc:   tokens −33.7% mean / −37.1% median, cost −25.6%,
          turns −2.2, CV 28.4%, first-build 5/5
  kanban: tokens −21.2% mean (median +31.7% is the
          distribution-tightening artifact, not a regression —
          base CV 74% bimodal vs variant CV 19.5% no-fat-tail),
          cost −25.7%, turns 0, first-build 5/5

The 4× kanban CV improvement is the load-bearing finding — second
batch in a row (after EC1-RR) where the predictability-as-a-feature
signal shows up, first batch where calc also tightens.

All four EC3 pass criteria cleared. Spec §12's "~−$0.70 per run"
prediction comfortably exceeded on both arms ($0.66 calc, $1.08
kanban). Spec EC3 row's "~−2 turns" prediction hits calc exactly.

One unresolved footnote: per-rule firing counts weren't broken out
in this batch. EC3-original was 0/10 on the three new Class-A rules;
this clean PASS may be carried entirely by the structural fixes +
template + skill changes with the three new rules still inert. The
verdict supersedes EC3-original regardless (rules are correct in
isolation, pass bars #1-#4 + #6, don't actively harm when silent),
but the targeted-prompt batch at C:\temp\mur-targeted-prompt-spec.md
remains the load-bearing follow-up for getting empirical token-
impact numbers on those three rules specifically.

Watch-items carried into V1 / Phase 4 review:
- Class-A rule exercise via targeted-prompt batch
- §11 risk-row guardrail retrofit (post-run mur check --final audit)
- Tier-2 SKILL.md trims (now empirically de-risked)
- rule_fired trace event addition

Verdict: PASS, clean. Phase 3 V1 cleared to ship. PR #250 updated
with the same verdict in its body.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 12, 2026
…plate typo fix (#250)

* Spec 038 Phase 3 — three Class-A rules + two critical correctness fixes

Three new Class-A induced rules, motivated by the cross-agent audit at
docs/specs/tasks/038-tuning-reports/2026-05-11-cross-agent-audit.md:

- GridSizeFactoryParensRule (CS1955; 146 events combined gpt-5.5 +
  sonnet-4.6; first cross-tier rule since CS1955 is outside Tier-2
  SupportedCodes): GridSize.Auto() -> GridSize.Auto (drop the parens).
- GridSizePxRenameRule (CS0117; 9 cross-agent events): GridSize.Pixel /
  Pixels / Fixed -> GridSize.Px (WPF/WinUI legacy name -> Reactor's Px).
- TextBlockStyleHintRule (CS1061/CS0117; 5 cross-agent events across
  both .Style(...) and `with { Style = ... }` shapes): hint toward
  Reactor's fluent text helpers since the element exposes no Style.

ThemeBackgroundSuffixRule reclassified Class-B -> Class-A (paperwork
only; cross-agent audit shows 27 events on the same key).

Two critical correctness fixes uncovered by end-to-end smoke testing —
both blocked any real-world rule firing before this commit:

1. CompilationLoader.ResolveReferences now walks libraries.<id> entries
   with type=project in project.assets.json and locates the most-recently
   -built matching .dll under that project's bin/ tree. Without this
   every rule's DeclaredTargets failed to resolve and the whole registry
   self-disabled on real mur check invocations (unit tests passed because
   they use synthetic in-memory compilations). Regression locked by
   CompilationLoaderTests.Resolves_ProjectReference_built_dll_from_project_assets_json.

2. SuggesterOrchestrator gains a tier2Enabled bool; CheckCommand.Run
   always builds the orchestrator (when the compilation loads) and passes
   the suggest-gate result in as tier2Enabled. Tier-3 rules always run
   when their diagnostic code surfaces; Tier-2 stays gated on small
   builds where its fuzzy match has near-0% precision (525-run
   calibration). This is the EC2 watch-item ("Phase-3 rules are the
   right lever — not Phase-2.x gate tuning") finally addressed in code.
   Two new orchestrator tests lock down both halves of the carve-out.

§3.1a per-rule performance bound test landed (was deferred until first
rule shipped): RulePerformanceTests.BestMatch_median_under_per_rule_budget
asserts symbol-resolution + TryMatch median <= 0.5 ms per rule per
diagnostic times 4 CI slack.

Status snapshot in the implementation tasks doc updated to record the
sonnet-4.6 corpus aggregation (368 fixes / 564 ranker rows / 41 clusters),
the cross-agent audit verdicts (3 STRONG Class-A targets, plus
TemplatedListView family that's STRONG-after-generalization-over-<T>,
plus the gpt-5.5-only CS1955/GridElement family deferred to a third
corpus drop), and the rule-PR queue with this commit's three Class-A
rules marked authored.

Branch is for spec 038 EC3 eval — see C:\temp\mur-ec3-handoff.md.

Full Reactor.Tests suite: 7175 passing / 46 expected skips.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(reference): expand mur-check did-you-mean doc through Phase 2 + 3

The reference doc was scoped to Phase 0+1 plus the suggest-gate. This
update extends it to cover everything shipping since:

- Phase 2 (merged): MSBuild passthrough via `--`, mode flags
  (--strict/--final/--quiet/--emit-threshold), the deterministic
  pre-emit policy table, and the suppress-to-error guardrail tool.
- Phase 3 (in flight on this branch): the IRulePattern infrastructure,
  RuleSymbolResolver / RuleRegistry, --disable-rule + --list-rules CLI
  surface, six authored rules (three Class-A induced + three Class-B
  vocabulary), the symbol-binding contract from §3.1a, and the
  per-rule perf bound test.
- Two critical correctness fixes uncovered during Phase 3 end-to-end
  smoke testing: CompilationLoader's ProjectReference resolution path
  and the suggest-gate carve-out for Tier-3 rules. Both get their own
  subsections in §3 explaining why unit tests passed while production
  silently no-op'd, since that failure mode generalises beyond this
  spec.
- The cross-agent mining drop (`claude-sonnet-4.6` × 525 runs) and the
  audit it produced. New subsection in §4 on comparing models to
  separate structural vocabulary-confusion signals from agent-specific
  idiosyncrasies; new subsection in §5 on what the second-agent corpus
  changed (B->A promotions, single-corpus deferrals, cross-syntactic-
  shape rule emergence).

§9 (Future improvements) tightened to what's actually left: remainder
of Phase 3 (more rules pending a third-agent corpus + Class-B catalog
expansion), Phase 4 (telemetry + learned ranker, blocked on Data
Checkpoint D), and a "what EC3 will tell us" subsection that frames
EC3 as a fresh measurement rather than an incremental delta on EC2.

Glossary gains: rule carve-out, pre-emit ranker, symbol-binding
contract, ProjectReference resolution, cross-agent audit, provenance.
TOC updated for the §8 rename ("in this PR" -> "so far").

Tone matches the existing doc: plain language first, then engineer
detail, then ML-practitioner detail. The same explanatory pattern
spec 038's design doc uses.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Spec 038 EC3 results — 5x2 paired batch landed 2026-05-11

PASS-with-caveats. Calc cleared the >=5% token-improvement bar
(-5.2% mean, -13.0% median); kanban regressed (+14.9% mean, +60.7%
median). The three Class-A rules added in this branch fired zero
times across all 10 variant runs - the EC3 delta did not exercise.
The calc improvement is plausibly driven by the CompilationLoader
+ gate carve-out fixes letting rules run at all, not by the new
rules.

Tool-call profile diff identifies the +3.2 turn delta on kanban:
variant agent does ~+1 skill load, +1 view, +1 apply_patch per run
vs base, consistent with a "verify-before-edit" loop triggered by
rule suggestions. Mechanism cited in handoff section 7.

Recommend: do not declare Phase 3 cleared on this batch alone.
Re-run with prompts that target GridSize/TextBlock patterns to
get Class-A rule exercise; investigate the kanban-base R1 outlier
(1.12M tokens, 3.4x median) before reading the kanban regression
as decisive.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* EC3 doc revision: per-call rg/view inspection retracts verify-before-edit framing

Per-call inspection of variant kanban rg patterns and view paths
doesn't support the earlier "verify-before-edit" hypothesis: ~11/12 rg
calls probe drag/drop and modifier APIs unrelated to mur output; view
calls are mostly the agent re-reading its own in-progress workspace
files. The two rule-fired runs (r1=Theme, r4=Align) are middle-of-the-
pack on turns and tools, not the heaviest. The variant mean is dragged
up by r5 (20 turns, 27 tool calls, 889K tokens, zero rule fires) which
looks like a generic long-tail trajectory comparable to base R1.

Reframing: rule fires correlate with normal token usage when they
happen; mur check can't help on builds where the agent's mistakes
fall outside the rule set's coverage. The kanban-prompt -> rule-
coverage gap is the underlying issue, not rule-induced verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Fix Micrsoft -> Microsoft typo in reactorapp template identity

Single-character bug in tools/Templates/templates/WinUIApp-CSharp/
.template.config/template.json lines 5-6: the template's identity and
groupIdentity were "Micrsoft.UI.Reactor.CSharp" / "Micrsoft.UI.Reactor"
(missing the second 'o'). Checked into the repo since at least Phase 1.

How it surfaced. The eval harness runs `dotnet new install ... --force`
on every setup. Multiple installs accumulate duplicate entries in the
user's ~/.templateengine/dotnetcli/<sdk>/templatecache.json under the
misspelled identity. The duplicate-match condition makes
`dotnet new reactorapp` resolve more than one template for the
"reactorapp" short name, throwing "Sequence contains more than one
matching element" with exit code 70. The EC3 5x2 batch hit this 20/20
runs across both arms — the spec doc's earlier framing ("agent typo,
at least one variant kanban run, didn't block the build") was wrong on
three counts; corrected in this commit.

Why the existing integration test (CreateTemplateTests) didn't catch
the typo: it installs the template into a per-test ephemeral
--debug:custom-hive, where the misspelled identity is the only entry
and `dotnet new` resolves correctly. The bug only surfaces against the
user's real (accumulating) cache. The new test (described below) is
content validation, not install/run behavior — orthogonal coverage
that catches the typo regardless of cache state.

Test added: tests/Reactor.Tests/TemplateMetadataTests.cs. Four xUnit
[Fact]s that load template.json directly:
  - Identity_is_canonical_brand_namespace: exact-match assertion
    against "Microsoft.UI.Reactor.CSharp".
  - GroupIdentity_is_canonical_brand_namespace: exact-match against
    "Microsoft.UI.Reactor".
  - File_contains_no_brand_typos: substring sweep for "Micrsoft"
    anywhere in the file (belt-and-suspenders catch for future typos
    in any new symbol/description/etc.).
  - ShortName_resolves_to_reactorapp: anchors the public CLI command
    name documented in SKILL.md and the wordpuzzle smoke pattern.

Workstation cache drained + reinstalled: `dotnet new uninstall
Microsoft.UI.Reactor.ProjectTemplates` repeated until empty, then
`mur pack-local` repacked against the fixed template, then
`dotnet new install` reinstalled. ~/.templateengine cache now carries
exactly one canonical "Microsoft.UI.Reactor.CSharp" entry across both
SDK versions on disk (10.0.104, 10.0.203).

Existing tests unaffected: Reactor.Tests 7179 passing / 46 expected
skips (up from 7175, +4 from the new template-metadata tests).
CreateTemplateTests integration smoke (`dotnet new reactorapp` + build
+ run + UI Automation find) passes 2/2 with the corrected identity.

EC3 verdict implication: both arms hit the typo equally, so the
relative deltas (calc -5.2%, kanban +14.9%) are not biased *by this
bug*. Absolute costs are inflated on every run; the long-tail outliers
(variant r5 = 889K tokens, base r1 = 1.12M tokens) likely had their
trajectories pushed further by `dotnet-new` thrash. The PASS-with-
caveats verdict still stands directionally; a re-run with the typo
fixed could materially shift the numbers in either direction. Spec doc
updated to reflect this.

Two harness-side mitigations deferred to separate follow-ups (the
source typo is the load-bearing fix; without it the harness mitigations
would still leak):
  1. `dotnet new uninstall Microsoft.UI.Reactor.ProjectTemplates`
     before `dotnet new install --force` in eval setup, so future
     typo-equivalent bugs can't accumulate.
  2. Propagate inner-command exit codes into the PowerShell tool
     wrapper's `success` field so `failedToolCalls` stops lying about
     dotnet-new failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* skill: trust the scaffolded .csproj after `dotnet new reactorapp`

EC3-post-typo-fix smoke trace analysis identified two reads following
the scaffold: `view App.cs` (essential — the file the agent is about
to apply_patch) and `view <project>.csproj` (defensive — the agent
checking that the scaffold produced a sane csproj). The .csproj read
is informational at best: the scaffold's stdout already showed the
file listing plus "Restore succeeded.", and a calc/kanban-shaped task
never modifies the .csproj.

Across the prior 10 variant runs, calc averaged 2.2 views/run and
kanban averaged 2.2 (r5's 4 reads pulling the kanban mean up). Two
views post-scaffold is the modal pattern, so a one-line skill note
landing on the defensive read should compress noticeably.

Added the same one-line note in two places so both skill consumers see
it:
- plugins/reactor/skills/reactor-getting-started/SKILL.md right after
  the canonical .csproj block (line ~102, next to the
  WindowsPackageType / UseWinUI MUST rules).
- SKILL.md (top-level, packed into the nupkg) right after the matching
  csproj block in the Project Setup section.

The wording explicitly carves out App.cs as still-necessary so the
note doesn't suppress useful reads. Estimated savings: one view + a
few hundred tokens per scaffold step. Small per-run, real across the
batch since every eval scaffolds.

Repacked Microsoft.UI.Reactor.0.0.0-local.nupkg so the bundled
agentkit/SKILL.md carries the update.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* template: drop ImplicitUsings + add explicit usings to App.cs; skill anti-probe + mur check pointer

Three related changes addressing the post-scaffold agent-confusion pattern
the EC3-post-typo-fix trace analysis identified:

1. tools/Templates/templates/WinUIApp-CSharp/Company.ReactorApp1.csproj
   removes <ImplicitUsings>enable</ImplicitUsings> and the three <Using
   Include="..."> items. Reactor's namespaces are now explicitly
   `using`-imported at the top of App.cs:
       using Microsoft.UI.Reactor;
       using Microsoft.UI.Reactor.Core;
       using static Microsoft.UI.Reactor.Factories;
   Why: with implicit usings on, the source file looks like it's missing
   namespace context — `VStack`, `Heading`, `Component` appear unqualified
   without a visible `using`, which confuses agents reasoning about where
   symbols come from. The agent has to read the csproj to find the global
   Using items, then mentally merge them into App.cs's namespace scope.
   Explicit usings make App.cs self-contained: every symbol's source is
   one of the three using directives at the top of the file. The skill
   text now says "App.cs has its own using directives at the top, which is
   the only place you add new namespaces" — which is true after this
   change.

2. SKILL.md + plugins/reactor/skills/reactor-getting-started/SKILL.md
   expand the existing "trust the scaffolded .csproj" note into an
   anti-probe paragraph that enumerates the exact post-scaffold file
   list: "the workspace contains exactly two source files: App.cs (entry
   point + initial component) and <Name>.csproj. There is no Program.cs
   and no GlobalUsings.cs — modify App.cs in place."
   Why: the eval orchestrator's trace analysis identified a recurring
   "agent probes for files that don't exist" pattern (sometimes asking
   for Program.cs, sometimes inspecting obj/GlobalUsings.g.cs). Pinning
   the file list in the skill is a one-paragraph fix.

3. Same two SKILL.md files add a 1-paragraph mur check pointer alongside
   the anti-probe note: "Verify your edits with mur check before
   declaring done... For anything more involved than the build/fix loop —
   strict-mode failures, custom diagnostic gating, MSBuild passthrough
   flags — load the reactor-build-and-check skill."
   Why: the deeper reactor-build-and-check skill is a heavy load (full
   --strict / --final / --quiet / --emit-threshold / --suppress-error
   surface plus the iter/final framing). Most agent runs just need the
   basic loop. Promoting mur check into getting-started with a one-liner
   for the basic case lets the agent stay in the lighter skill until
   they actually hit advanced behavior.

Verified: dotnet new reactorapp -n X builds clean in both the top-level-
program default and the --use-program-main true variant. Existing
CreateTemplateTests integration smoke (2/2) and TemplateMetadataTests
unit tests (4/4) pass. mur pack-local refreshes both nupkgs against the
new template + skill content.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* template: sync App.cs usings to skill's canonical Required imports set

The prior commit (94d563f) added three usings to App.cs (Microsoft.UI.
Reactor, .Core, static Factories) so the source is self-contained after
dropping <ImplicitUsings>. The skill's "Required imports" section
documents the full *canonical* set as five-plus-one — adding
Microsoft.UI.Reactor.Layout, Microsoft.UI.Xaml, and
Microsoft.UI.Xaml.Controls to the minimum three. The template and the
skill now diverged: the agent reading App.cs would see three usings
but the skill text says the canonical set is six.

Sync the template to the skill: App.cs now ships all five-plus-one
using directives, with the same `// FlexDirection, FlexJustify, ...`
inline comments the skill uses for each non-obvious namespace. The
starter App.cs still only uses three of them (Reactor, Core, static
Factories); the other three are there because the agent will reach
for them within the first ~5 turns of any real app (alignment enums,
InfoBarSeverity, FlexDirection).

Updated the SKILL.md anti-probe paragraph in both copies to point at
`using System.Linq;` as the example of "when you add a new namespace,
add it to App.cs's using block" — System.Linq is a real common add and
isn't in the canonical six, so the example stays accurate. The top-
level SKILL.md also explicitly names the canonical set so readers can
cross-reference without flipping to the imports section.

Verified: dotnet new reactorapp -n X builds clean in the default
variant. CreateTemplateTests integration smoke 2/2 and
TemplateMetadataTests 4/4 pass against the expanded usings.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* template: add `using System;` to App.cs + skill canonical-set

With ImplicitUsings disabled (template commit 94d563f) the agent doesn't
get System auto-imported. Common BCL surface — Action, Func, EventArgs,
DateTime, Math, TimeSpan, Random — all live there, and they show up
within the first few turns of any non-trivial app (event handlers,
timers, randomization, formatting). Adding `using System;` to the
template's App.cs eliminates the "Action does not exist in the current
context" miss that's otherwise the first thing the agent hits when
they author an event handler.

Synced the canonical set in three places so they stay coherent:
- tools/Templates/templates/WinUIApp-CSharp/App.cs (scaffold output)
- plugins/reactor/skills/reactor-getting-started/SKILL.md "Required
  imports" code block
- SKILL.md anti-probe note's parenthetical canonical-set list

Verified: scaffolded App.cs ships `using System;` at the top of the
canonical seven-line using block; default-variant build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* skill(getting-started): apply Tier-1 cuts — 509 → 415 lines

Five surgical removals identified by the analysis pass:

A. "Minimal app — single file" block (36 lines → 5). The single-file
   `dotnet run App.cs` flow is a side path now that `dotnet new
   reactorapp` is the primary entry; the canonical-shape teaching
   moved into the scaffolded App.cs. Kept a 1-paragraph pointer to
   reactor-build-and-check's single-file-scripts section for the
   demo case.

B. Standalone `.csproj` xml block (17 lines dropped). The xml taught
   the agent how to write a csproj from scratch — but the agent
   doesn't author one. `dotnet new reactorapp` produces it. Kept the
   "when to use a .csproj" framing + the WindowsPackageType /
   UseWinUI MUST-rules + the recently-added anti-probe + mur check
   paragraphs.

C. "Mode detection — selfhost vs. NuGet consumer" section (29 lines
   → 2). The top-level SKILL.md already owns selfhost/consumer
   bootstrap; re-explaining it here was a second copy. The new
   one-paragraph "Bootstrap" section breadcrumb-points readers to
   SKILL.md and keeps the load-bearing `mur pack-local` recovery
   tip inline.

D. "App entry point" section (13 lines → 0). The ReactorApp.Run<App>
   form is already in the scaffolded App.cs. The unique content was
   the inline-render-function form `ReactorApp.Run("T", ctx => ...)`
   — embedded that as a one-line addendum to §Components instead of
   carrying a whole section for it.

E. "Where the skill content comes from" package-cache directory tree
   (6 lines dropped). The literal `%USERPROFILE%\.nuget\...` block
   was reference material an agent can `find` on demand. Kept the
   plugin-channel framing + the api-index pointer + the "read once,
   cache in working memory" tip.

What's preserved unchanged:
- The React→Reactor table (highest-value block in the file)
- Components / Hooks / Common factories / Theme tokens / Critical
  gotchas (load-bearing reference content)
- The recent anti-probe + mur check paragraphs
- The trimmed sections still carry their breadcrumb pointers so
  agents looking for the removed content find their way to the
  right skill (reactor-build-and-check, top-level SKILL.md, etc.)

Tier 2 (move drag-and-drop to reactor-input, trim Context, drop
duplicate List/UseReducer callout) and Tier 3 (move ContentDialog +
Flyout to reactor-recipes) are follow-up considerations, not applied
in this commit — they want eval validation before landing.

Repacked Microsoft.UI.Reactor.0.0.0-local.nupkg so the bundled
agentkit/plugins/reactor/skills/reactor-getting-started/SKILL.md
carries the trimmed file (verified: nupkg copy is 415 lines, matches).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* EC3-final clean PASS results — Phase 3 cleared to ship V1

Append the EC3-final results subsection to the implementation tasks
doc; mark EC3-original as superseded (preserved as the historical
record of the typo-contaminated batch and the PASS-with-caveats
reasoning that drove the watch-item triage work).

EC3-final headline numbers (5×N landed 2026-05-12 on
eval/spec-038-ec3-2026-05-11 @ 053afe9):
  calc:   tokens −33.7% mean / −37.1% median, cost −25.6%,
          turns −2.2, CV 28.4%, first-build 5/5
  kanban: tokens −21.2% mean (median +31.7% is the
          distribution-tightening artifact, not a regression —
          base CV 74% bimodal vs variant CV 19.5% no-fat-tail),
          cost −25.7%, turns 0, first-build 5/5

The 4× kanban CV improvement is the load-bearing finding — second
batch in a row (after EC1-RR) where the predictability-as-a-feature
signal shows up, first batch where calc also tightens.

All four EC3 pass criteria cleared. Spec §12's "~−$0.70 per run"
prediction comfortably exceeded on both arms ($0.66 calc, $1.08
kanban). Spec EC3 row's "~−2 turns" prediction hits calc exactly.

One unresolved footnote: per-rule firing counts weren't broken out
in this batch. EC3-original was 0/10 on the three new Class-A rules;
this clean PASS may be carried entirely by the structural fixes +
template + skill changes with the three new rules still inert. The
verdict supersedes EC3-original regardless (rules are correct in
isolation, pass bars #1-#4 + #6, don't actively harm when silent),
but the targeted-prompt batch at C:\temp\mur-targeted-prompt-spec.md
remains the load-bearing follow-up for getting empirical token-
impact numbers on those three rules specifically.

Watch-items carried into V1 / Phase 4 review:
- Class-A rule exercise via targeted-prompt batch
- §11 risk-row guardrail retrofit (post-run mur check --final audit)
- Tier-2 SKILL.md trims (now empirically de-risked)
- rule_fired trace event addition

Verdict: PASS, clean. Phase 3 V1 cleared to ship. PR #250 updated
with the same verdict in its body.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Address PR #250 CR — perf-test stub coverage + skip compilation load on non-suggestable builds

Copilot review surfaced two substantive issues; both fixed.

(1) RulePerformanceTests CombinedStub only carried targets for the
three earlier Class-B rules. With RuleRegistry.Default now including
the three new Class-A rules (GridSizeFactoryParens, GridSizePxRename,
TextBlockStyleHint), those three were silently self-disabling during
the perf test — TargetsResolve failed against the stub's missing
GridSize and TextBlockElement types. The 'budget = 0.5ms × ruleCount'
assertion then scaled by registry.All.Length (six) while only
measuring three rules' actual cost, so the bound was 2× loose.

Fix: extended the stub with Microsoft.UI.Reactor.GridSize (record
struct with Auto/Star/Px matching the real shape) and
Microsoft.UI.Reactor.Core.TextBlockElement (record). Added a
stub-coverage guard at the top of the perf test that asserts every
rule in RuleRegistry.Default.All resolves its declared targets
against the test compilation — fails loudly with the missing target
name and rule name if someone adds a new rule without updating the
stub. Future-proofs the budget assertion.

(2) CheckCommand.Run unconditionally called
CompilationLoader.Instance.Load(path) after the EC3 gate carve-out
refactor, even when no parsed diagnostic could plausibly produce a
suggestion (no diagnostics at all; only Tier-2 codes with the gate
closed and no rule covering them; only nullable/XML-doc warnings).
The compilation load is 50–500 ms cold — .cs enumeration, file-set
hash, full reference resolution including the new ProjectReference
walk. Paying it on every clean mur check was wall-time regression
on the happy path.

Fix: added SuggesterOrchestrator.AnyDiagnosticIsSuggestable(diags,
tier2Enabled, rules) — flat scan over the (small) diagnostic list
against the union of Tier-2's SupportedCodes and every rule's
DiagnosticCodes. Microseconds. CheckCommand.Run now gates the
compilation load behind that pre-check: only loads when at least one
diagnostic could plausibly produce a suggestion.

Test coverage:
  - RulePerformanceTests: stub-coverage guard asserts every
    DeclaredTarget across RuleRegistry.Default.All resolves.
  - SuggesterOrchestratorRuleTests gains 5 new facts:
      * empty diag list → false (clean build skips load)
      * unrelated CS warnings (CS8602/CS8618) → false
      * CS1061 + tier2Enabled=true → true
      * CS1061 + tier2Enabled=false + no rule → false (gate-closed
        Tier-2-only path is non-suggestable)
      * CS1955 covered by rule + tier2Enabled=false → true (Tier-3
        always runs)

Verified:
  - Reactor.Tests 7184 passing / 46 expected skips (was 7179, +5).
  - CreateTemplateTests integration smoke 2/2.
  - Clean wordpuzzle mur check exits with no output (pre-check
    short-circuits — no compilation load).
  - Wordpuzzle with GridSize.Pixel(80) + GridSize.Auto() injected:
    both rules still fire under the default gate with full evidence
    suffixes. Pre-check correctly identifies the build as
    suggestable; nothing regressed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 16, 2026
Spec 039 §8 / §14 #4 universal gap. Adds snapshot-style
OnSelectionChanged to every collection element so Multiple / Extended
selection modes are reachable without dropping to .Set(...) +
SelectedItems iteration.

- ListViewElement / GridViewElement / ListBoxElement
  → Action<IReadOnlyList<int>>? OnSelectionChanged

- TemplatedListViewElement<T> / TemplatedGridViewElement<T> / ItemsViewElement<T>
  → Action<IReadOnlyList<T>>? OnSelectionChanged
  (typed peers materialize items from the SelectedItems indices via a new
   virtual InvokeMultiSelectionChanged on TemplatedListElementBase)

- TreeViewElement — deferred. WinUI's TreeView selection model is
  hierarchical and needs separate design (SelectionMode.Multiple over a
  tree differs in subtle ways from flat-list multi-select).

Snapshot semantics (not delta-style) match CalendarView's
OnSelectedDatesChanged from Phase 3.1 — the callback receives the FULL
current selection on every change, so component state can be a plain
IReadOnlyList without diffing.

Mount-time wiring is now unconditional for ListView/GridView/ListBox
SelectionChanged (handlers resolve via GetElementTag), so the previous
"lazy-wire on null→non-null" code in UpdateListView/UpdateGridView/
UpdateListBox is removed to avoid double-subscription. Tag refresh on
update keeps newly-attached handlers reachable.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 16, 2026
Add a spec-039 block under [Unreleased] / ### Added covering the
four required subheadings:

- New fluent extensions (single bullet referring to the inventory).
- Named-style helpers (.AccentButton / .SubtleButton / .TextLink,
  InfoBar severity helpers, Card factory, type-ramp factories).
- New events exposed (CalendarView, Frame, ScrollView, Popup,
  WebView2, MediaPlayerElement, ContentDialog, Image, ComboBox,
  DataGrid, universal collection multi-select).
- New init properties (single bullet referring to spec 039 §14 #4 —
  Phase 4 / Phase 5 inventory).

Naming aliases (RichText → RichTextBlock, ScrollViewer, ProgressBar)
remain in the existing "Breaking changes (deferred)" block where
Phase 6.1 / 6.5 / 6.6 originally landed them — they're already
described there, no duplication needed.

Also flips the Phase 9 task-file checkboxes to [x] and the tracker
"Docs updated (Phase 9)" line.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 16, 2026
… props, named styles (#314)

* feat(039): land Phase 0-2 — scaffolding, event fluents, named-style helpers (#039)

Implements the foundational layers of the property & event API scrub
(spec 039). Phases 0-2 (Phase 3+ to follow in subsequent commits).

Phase 0: Scaffolding
- Added empty partial classes ElementExtensions.Events,
  ElementExtensions.NamedStyles, Factories.NamedStyles.
- Generated event-fluent inventory CSV (68 rows) under
  tests/Reactor.SelfTests/Fixtures/event-fluent-inventory.csv via
  tools/api-scrub/Build-EventFluentInventory.ps1.

Phase 1: Universal event fluents
- Hand-written extensions covering every Action/Action<T> callback on
  every element record across §1–§9, §12 (~63 fluents). Names drop the
  leading "On" to avoid the C# property-vs-extension delegate-invocation
  clash; property names unchanged.
- 63 null-clear unit tests confirm passing null clears handler.

Phase 2: Named-style helpers + Card + type-ramp factories
- .AccentButton(), .SubtleButton() on ButtonElement and its subtypes.
- .TextLink() on Hyperlink/Button.
- InputScope fluents on TextField (Numeric/Email/Url/Phone/Search) +
  generic .InputScope() escape hatch.
- InfoBar severity fluents (Informational/Success/Warning/Error).
- Card(child) factory: corner radius 8, padding 16, theme-aware
  background + stroke via ThemeRef plumbing.
- Type-ramp factories Title/Subtitle/Body/BodyStrong/BodyLarge in
  Factories.NamedStyles.cs (no matching fluents — §17.6 two-ways trap).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.1 — CalendarView SelectedDates + SelectedDatesChanged

Models the missing multi-select event on CalendarView (spec 039 §3 +
Q4). Adds:

- CalendarViewElement.SelectedDates: declarative initial selection
  as IReadOnlyList<DateTimeOffset>?.
- CalendarViewElement.OnSelectedDatesChanged: user-event callback
  receiving a snapshot of the full selection (not added/removed delta —
  easier to bind into component state without diffing).
- Fluents .SelectedDates(...) / .SelectedDatesChanged(handler).

Reconciler wiring:

- Initial selection applied at mount BEFORE subscribing, so the
  declarative seed doesn't fire the user event.
- Subscription is unconditional; the handler reads the latest element
  via the element tag so a later record-with that attaches a handler
  picks up without re-wiring.
- Updates diff current vs desired selection and apply add/remove via
  ChangeEchoSuppressor.BeginSuppress so subsequent declarative writes
  don't echo back as user events.

Tests: null-clear unit test added. Reconciler-level "no-event-on-mount /
event-fires-once-per-user-change" deferred to Phase 11.7 (AppTests
harness — requires a WinUI runtime).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.2 — Frame navigation events

Adds the three commonly-needed Frame events to FrameElement (spec 039
§3.2). Modelled as Reactor-shaped substitutes — Action<Type> /
Action<Type,Exception> — matching the rest of the codebase, which
doesn't surface raw WinUI EventArgs in user-facing callbacks. Users
who need NavigationMode, NavigationParameter, or cancellation can wire
the raw event via .Set(...).

- OnNavigated: Action<Type>? — receives the new SourcePageType.
- OnNavigating: Action<Type>? — receives the target SourcePageType
  (cancellation not surfaced; spec accepts this trade for ergonomics).
- OnNavigationFailed: Action<Type, Exception>? — target + failure.

Fluents .Navigated / .Navigating / .NavigationFailed land per Phase 1
conventions. Reconciler subscribes unconditionally; the trampoline reads
the latest element via the element tag so a later record-with picks up
without re-wiring.

Sample (spec §3.2 last bullet, §8.3) deferred — requires XAML
Page-derived types, better authored alongside the rest of the Phase 8
sample sweep.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.3 — ScrollView.ViewChanged

Adds OnViewChanged to ScrollViewElement (spec 039 §3.3). Callback is
Action<ScrollViewerViewChangedEventArgs>? — args carry IsIntermediate
for callers who want to debounce until the scroll settles.

ScrollViewer is pooled, so subscription uses the established
PoolableWireFlags.ScrollViewerViewChanged once-per-instance gate; the
trampoline reads the live element via GetElementTag so a later
record-with that attaches the handler doesn't require re-subscription.

Fluent .ViewChanged(handler) + null-clear test. Reconciler-level
"scroll triggers callback" deferred to AppTests harness (Phase 11.7).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.4 — Popup.Opened

Adds OnOpened to PopupElement (spec 039 §3.4). PopupElement already
exposed OnClosed; this rounds out the lifecycle. Trampoline mirrors
the existing OnClosed wiring — both resolve the live element via the
wrapper StackPanel's element tag so updates pick up fresh closures.

Fluent .Opened(handler) + null-clear test.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.5 — WebView2 message + init events

Adds two commonly-needed WebView2 events (spec 039 §3.5):

- OnWebMessageReceived(Action<string>?) — fired on the UI thread when
  the hosted page posts a message via window.chrome.webview.postMessage.
  Handler falls back from TryGetWebMessageAsString() to WebMessageAsJson
  so callers always receive a string payload even when the page sends
  a structured message.
- OnCoreWebView2Initialized(Action?) — fires once on the UI thread when
  the underlying CoreWebView2 is available, the earliest point at which
  features like AddScriptToExecuteOnDocumentCreatedAsync become usable.

Both subscribed unconditionally in MountWebView2 — the trampolines read
the live element via the element tag so later record-with that attaches
a handler picks up without re-subscription. Threading contract
documented in XML doc comments. Fluents and null-clear tests land.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 3.6 — MediaPlayerElement events

Adds MediaOpened, MediaEnded, and MediaFailed callbacks to
MediaPlayerElementElement (spec 039 §3.6). MediaPlayer raises these on
a worker thread, so a new DispatchToElement<TElement> helper marshals
through the element's DispatcherQueue and resolves the live element via
GetElementTag — handler is a no-op if the element has unmounted between
the event firing and the dispatched continuation.

- OnMediaOpened: Action?
- OnMediaEnded: Action?
- OnMediaFailed: Action<string>? — receives args.ErrorMessage ??
  args.Error.ToString() to keep the callback signature simple while
  preserving the most-useful failure detail.

Fluents .MediaOpened / .MediaEnded / .MediaFailed + null-clear tests.
Threading contract documented in XML doc comments. Integration test
that asserts events fire on real media playback deferred to Phase 11.7
(AppTests harness).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.1 — Slider init fluents

Adds five frequently-set init properties on SliderElement (spec 039 §3.8)
and the matching fluent extension methods:

- .Orientation(Orientation) — horizontal vs vertical layout
- .TickFrequency(double) — interval between tick marks
- .TickPlacement(TickPlacement) — where ticks render on the track
- .SnapsTo(SliderSnapsTo) — snap to ticks vs step values during drag
- .ThumbToolTip(bool = true) — floating value tooltip during drag

The reconciler wires all five through Mount (initial control creation)
and Update (delta-based property writes guarded by equality checks so a
no-op render doesn't bounce the control state).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.2 — NumberBox init fluents

Adds four init properties on NumberBoxElement (spec 039 §3.3) and the
matching fluents:

- .NumberFormatter(INumberFormatter2) — currency / percent / etc.
- .AcceptsExpression(bool = true) — arithmetic expressions like 2*3+1
- .ValidationMode(NumberBoxValidationMode) — overwrite-vs-disabled
- .Description(string) — help text rendered under the box

The reconciler writes NumberFormatter only when the reference actually
changed, so a same-formatter re-render won't reformat the text and
clobber an in-progress edit.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.3 — ColorPicker init fluents

Adds six fluents over the existing ColorPickerElement init properties
(spec 039 §3.11) — one per visibility toggle:

- .AlphaEnabled(bool = true)
- .MoreButtonVisible(bool = true)
- .ColorSpectrumVisible(bool = true)
- .ColorSliderVisible(bool)
- .ColorChannelTextInputVisible(bool)
- .HexInputVisible(bool)

UpdateColorPicker now reconciles all five visibility flags (previously
only IsAlphaEnabled propagated through update), so flipping a toggle
mid-session takes effect on the next render.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.4 — TabView init fluents

Adds seven init properties on TabViewElement (spec 039 §7.4) and the
matching fluents:

- .TabWidthMode(TabViewWidthMode) — Equal / SizeToContent / Compact
- .CloseButtonOverlayMode(TabViewCloseButtonOverlayMode) — Auto / OnPointerOver / Always
- .CanDragTabs(bool = true) — detach to a new window
- .CanReorderTabs(bool = true) — drag within the strip
- .AllowDropTabs(bool = true) — accept tabs from another TabView
- .TabStripHeader(Element) — leading-edge content
- .TabStripFooter(Element) — trailing-edge content

Strip header/footer children are reconciled via the existing
ReconcileChild helper so update-in-place works (no full remount when
their content changes).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.5 — NavigationView init fluents

Adds six init properties on NavigationViewElement (spec 039 §7.2) and
the matching fluents:

- .AutoSuggestBox(AutoSuggestBoxElement) — pane-top search box
- .PaneFooter(Element) — pane-bottom slot below menu items
- .PaneCustomContent(Element) — slot between AutoSuggestBox and items
- .OpenPaneLength(double) — pane width when expanded
- .CompactModeThresholdWidth(double) — window width to collapse the pane
- .ExpandedModeThresholdWidth(double) — window width to auto-expand

Threshold/length init properties default to NaN so the WinUI defaults
take effect when unset (Mount/Update only writes when a real value is
provided). Pane children reconcile in place via ReconcileChild.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.6 — TitleBar init fluents

Adds fluents over existing TitleBarElement init properties (spec 039
§7.3):

- .BackButtonVisible(bool) / .BackButtonEnabled(bool)
- .PaneToggleButtonVisible(bool)
- .Content(Element) / .RightHeader(Element)
- .Icon(IconData) and convenience .Icon(string imageUri) — the string
  overload wraps the URI in an ImageIconData, matching the spec §7.3
  shorthand. No new init properties needed; reconciler already wires
  every target.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.7 — TextField init fluents

Adds five init properties on TextFieldElement (spec 039 §3.1) and the
matching fluents:

- .MaxLength(int) — character limit (0 = unlimited)
- .IsSpellCheckEnabled(bool = true) — toggle built-in spell-check
- .CharacterCasing(CharacterCasing) — Normal / Upper / Lower input
- .TextAlignment(TextAlignment) — horizontal text alignment
- .Description(string) — help text rendered below the box

InputScope is intentionally out of scope here — Phase 2.3 owns it.

The reconciler writes each property only when the WinUI TextBox value
diverges from the element, so a no-op render doesn't cause flicker.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 4.8 — HyperlinkButton .NavigateUri fluent + doc fix

Adds the .NavigateUri(Uri) fluent on HyperlinkButtonElement (spec 039
§14 #5). The init property already existed and the reconciler already
piped it through Mount and Update, so this is a pure extension method —
no record or reconciler changes.

Also updates the XML doc on HyperlinkButton(Command) — it used to send
callers to .Set() with a hand-written NavigateUri assignment. The
promise is now real: HyperlinkButton(cmd).NavigateUri(uri) compiles
and routes through the existing reconciler path. The Button(Command)
doc gets a parallel example to keep the discoverability story tight.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.1 — Text family init properties

Adds high-traffic init properties and matching fluents on the three
text records (spec 039 §1.1 / §1.3 / §1.4):

- TextBlockElement: .LineHeight(double), .MaxLines(int),
  .CharacterSpacing(int), .TextDecorations(TextDecorations)
- RichTextBlockElement: .MaxLines(int), .LineHeight(double),
  .TextAlignment(TextAlignment), .TextTrimming(TextTrimming),
  .CharacterSpacing(int)
- RichEditBoxElement: .IsSpellCheckEnabled(bool = true),
  .MaxLength(int), .TextWrapping(TextWrapping = Wrap),
  .AcceptsReturn(bool = true), .SelectionHighlightColor(SolidColorBrush)

The TextBlock bitmask diff (EXP-2) gained four new bits so the fast
path keeps avoiding interop reads for unchanged properties.
RichTextBlock and RichEditBox update paths reconcile all five props.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.2 — ToggleButton three-state + CheckedState fluents

Brings ToggleButtonElement to parity with CheckBoxElement / WinUI's
ToggleButton three-state cycle (true → false → null → true). Spec
039 §2.4 — matches the existing CheckBox/ThreeStateCheckBox precedent
(single record, IsThreeState flag), not the alternative split-record
shape.

Adds to ToggleButtonElement:
- IsThreeState (bool)
- CheckedState (bool?)  — active when IsThreeState=true
- OnCheckedStateChanged (Action<bool?>?)

New fluents:
- .IsThreeState(bool = true)
- .CheckedState(bool?) — auto-sets IsThreeState=true
- .CheckedStateChanged(Action<bool?>?) — null clears

New factory:
- ThreeStateToggleButton(label, checkedState = null, onCheckedStateChanged = null)

The reconciler now writes IsThreeState explicitly and clears it when
flipped back to two-state, so toggling .IsThreeState() between renders
works without remounting. The Click trampoline dispatches both
OnIsCheckedChanged and OnCheckedStateChanged; HasCallbacks was widened
to include the new callback.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.3 — Input control init props + fluents

Spec 039 §3.2 / §3.4 / §3.7 / §3.10 / §3.11. New init properties on
five input records, with matching value fluents plus event fluents
for the two new ComboBox callbacks.

PasswordBoxElement:
- MaxLength, Header, PasswordRevealMode, PasswordChar

AutoSuggestBoxElement:
- Header, QueryIcon (IconData), IsSuggestionListOpen

ComboBoxElement:
- MaxDropDownHeight, Description
- OnDropDownOpened, OnDropDownClosed (with .DropDownOpened /
  .DropDownClosed fluents per the leading-On rule)

RatingControlElement:
- PlaceholderValue (double), InitialSetValue (int — matches WinUI's
  RatingControl.InitialSetValue signature), .Caption() promoted from
  init-property to a fluent

ColorPickerElement:
- ColorSpectrumShape, Min/MaxHue, Min/MaxSaturation, Min/MaxValue
- .HueRange / .SaturationRange / .ValueRange paired-bound helpers

Reconciler wires every new property; ComboBox's two new events join
the HasCallbacks OR-chain. QueryIcon uses the existing ResolveIcon
helper (AutoSuggestBox.QueryIcon takes an IconElement, not IconSource).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.4 — Date/time picker init props + fluents

Spec 039 §4.1. New init properties on the three date/time records,
all with matching fluents.

CalendarDatePickerElement:
- DateFormat (string), IsTodayHighlighted (bool = true),
  IsCalendarOpen (bool), IsGroupLabelVisible (bool = true)

DatePickerElement:
- DayFormat / MonthFormat / YearFormat (string), Orientation
  (default Horizontal)

CalendarViewElement:
- MinDate / MaxDate (DateTimeOffset?), FirstDayOfWeek
  (Windows.Globalization.DayOfWeek?), NumberOfWeeksInView (int = 6),
  DisplayMode (CalendarViewDisplayMode = Month)

The reconciler reconciles every new property in the corresponding
Update* method (CalendarDatePicker, DatePicker, CalendarView).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.5 — Progress/layout/navigation init props + fluents

Spec 039 §5 / §6. New init properties on InfoBar, Expander, SplitView,
plus VariableSizedWrapGrid attached-prop fluents.

InfoBarElement:
- IconSource (IconData? — overrides severity icon), Content (Element? —
  rich body below the message). Both reconcile via ReconcileChild so the
  body element updates in place across re-renders.

ExpanderElement:
- HeaderTemplate (Element? — wins over the string Header), ContentTransitions
  (TransitionCollection? — custom expand/collapse motion).

SplitViewElement:
- PaneBackground (Brush?) with a `.PaneBackground(ThemeRef)` overload that
  routes through the existing ThemeBindings pipeline for light/dark-adaptive
  pane backgrounds.
- LightDismissOverlayMode (default Auto).

VariableSizedWrapGrid attached-prop fluents:
- new WrapGridAttached record + `.WrapGridColumnSpan(int)` /
  `.WrapGridRowSpan(int)` extensions. MountWrapGrid applies
  VariableSizedWrapGrid.SetRowSpan/SetColumnSpan at mount time, and
  UpdateWrapGrid re-applies on every render in lockstep with
  ReconcileChildren's null/EmptyElement filtering.

MountInfoBar/UpdateInfoBar now accept `requestRerender` so the child
Element mounts/reconciles correctly. UpdateExpander reconciles
HeaderTemplate via ReconcileChild with a string-header fallback when the
element header is cleared.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.6 — Collections + dialogs init props + fluents

Spec 039 §8 / §9. New init properties on ListView, GridView,
ContentDialog, Flyout, TeachingTip.

ListViewElement / GridViewElement:
- ItemContainerStyle (Style?), IncrementalLoadingTrigger (default Edge).
  Both wire at mount and reconcile on update.

ContentDialogElement:
- IsPrimaryButtonEnabled (bool = true), IsSecondaryButtonEnabled (bool = true),
  OnOpened with `.Opened()` event fluent. (WinUI 3 ContentDialog has no
  `Opening` event, so the spec's `OnOpening` is dropped — deferred upstream.)

FlyoutElement:
- ShowMode (FlyoutShowMode = Auto), AreOpenCloseAnimationsEnabled (bool = true),
  OverlayInputPassThroughElement (Element? — mounted as a DependencyObject).
  Both the existing-flyout reuse path and the fresh-flyout creation path in
  UpdateFlyoutElement propagate the new props.

TeachingTipElement:
- IconSource (IconData?), HeroContent (Element?), PlacementMargin (Thickness),
  PreferredPlacement (TeachingTipPlacementMode = Auto). HeroContent rebuilds
  on swap (simple over hot — teaching-tip hero isn't a render hot path).

GroupStyle on ListView/GridView is deferred per the spec — needs a
Reactor-shaped wrapper for the templated header/footer pair and tracked
separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.7 — Media + shapes init props + fluents

Spec 039 §10 / §11 / §12. New init props on six media/shape records.

ImageElement:
- OnImageOpened (Action?), OnImageFailed (Action<string>?), NineGrid
  (Thickness?). Both events route through the new EnsureImageWiring
  helper + PoolableWireFlags so a pooled Image won't double-subscribe
  across mount/unmount cycles.

WebView2Element:
- Source was already the record's positional parameter and is reconciled
  by UpdateWebView2. No change needed — verified at audit.

PathElement:
- StrokeStartLineCap / StrokeEndLineCap / StrokeDashCap (PenLineCap),
  StrokeLineJoin (PenLineJoin), StrokeMiterLimit (double = 10),
  StrokeDashOffset (double), FillRule (FillRule = EvenOdd).
- FillRule lives on the underlying PathGeometry (not Shapes.Path) so
  the reconciler propagates via `p.Data as PathGeometry`.

PipsPagerElement:
- WrapMode, MaxVisiblePips (default 5), PreviousButtonVisibility,
  NextButtonVisibility (both default Collapsed).

RefreshContainerElement:
- PullDirection (default TopToBottom); HasCallbacks now reflects
  OnRefreshRequested.

ParallaxViewElement:
- Source (UIElement?), VerticalSourceStartOffset, VerticalSourceEndOffset.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 5.8 — Universal multi-select SelectionChanged

Spec 039 §8 / §14 #4 universal gap. Adds snapshot-style
OnSelectionChanged to every collection element so Multiple / Extended
selection modes are reachable without dropping to .Set(...) +
SelectedItems iteration.

- ListViewElement / GridViewElement / ListBoxElement
  → Action<IReadOnlyList<int>>? OnSelectionChanged

- TemplatedListViewElement<T> / TemplatedGridViewElement<T> / ItemsViewElement<T>
  → Action<IReadOnlyList<T>>? OnSelectionChanged
  (typed peers materialize items from the SelectedItems indices via a new
   virtual InvokeMultiSelectionChanged on TemplatedListElementBase)

- TreeViewElement — deferred. WinUI's TreeView selection model is
  hierarchical and needs separate design (SelectionMode.Multiple over a
  tree differs in subtle ways from flat-list multi-select).

Snapshot semantics (not delta-style) match CalendarView's
OnSelectedDatesChanged from Phase 3.1 — the callback receives the FULL
current selection on every change, so component state can be a plain
IReadOnlyList without diffing.

Mount-time wiring is now unconditional for ListView/GridView/ListBox
SelectionChanged (handlers resolve via GetElementTag), so the previous
"lazy-wire on null→non-null" code in UpdateListView/UpdateGridView/
UpdateListBox is removed to avoid double-subscription. Tag refresh on
update keeps newly-attached handlers reachable.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 6.1 — rename RichText → RichTextBlock + obsolete alias

The record was already named `RichTextBlockElement`; this aligns the
factory name with the record and with WinUI's
`Microsoft.UI.Xaml.Controls.RichTextBlock`. Both `RichText(string)` and
`RichText(RichTextParagraph[])` overloads are preserved as `[Obsolete]`
forwarding aliases for one release per spec §16.4 (B). Ten sample / doc
/ test call sites migrated to the new name.

New `### Breaking changes (deferred)` section in `CHANGELOG.md` under
`## [Unreleased]` to catalog naming-alignment renames whose
`[Obsolete]` aliases come out in the next minor.

(spec 039 §1.3 / §14 #8)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 6.2 — document divergent Reactor wrappers

Add `<summary>` + `<remarks>` XML doc comments to every factory whose
name diverges from WinUI (no first-party WinUI control of the same
name): `Heading`, `SubHeading`, `Caption`, `VStack`, `HStack` (and the
`(spacing, ...)` overloads), `Flex` / `FlexRow` / `FlexColumn`,
`ListView<T>` / `GridView<T>` / `FlipView<T>` (typed/templated peers
sharing names with untyped factories), and `LazyVStack<T>` /
`LazyHStack<T>`. Each remark explains the SwiftUI / cross-platform
naming influence or the underlying WinUI primitive being wrapped.

(spec 039 §0.3)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 6.3 — document StackElement.Spacing default-8 deviation

Add `<summary>` + `<remarks>` to `StackElement.Spacing` calling out the
deliberate 8-DIP default vs WinUI `StackPanel.Spacing` default of 0.
Doc-only — value unchanged per spec 039 §0.4 / §16. Rationale: Reactor's
`VStack(a, b, c)` call shape almost always wants whitespace between
siblings; the WinUI-zero default produced visually wrong output for the
zero-arg case.

(spec 039 §0.4 / §16)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 6.4 — TextField / MaskedTextField naming rationale

Per spec 039 §16.5 the `TextField` / `MaskedTextField` rename is
explicitly out of scope (option C — keep as-is). Add an XML
`<summary>` + `<remarks>` to each factory pointing readers at the
spec sections that capture the impact analysis and decision. The
`TextField` doc anchors §3.1 / §16; `MaskedTextField` anchors §13 /
§16.3 and notes that the two renames would bundle together if ever
revisited.

(spec 039 §3.1 / §13 / §16)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 6.5 — ScrollViewer obsolete alias + doc comment

Decision: keep `ScrollView`, add `[Obsolete]` `ScrollViewer(Element)`
forwarding alias. Reactor's `ScrollViewElement` reconciles to WinUI's
legacy `Microsoft.UI.Xaml.Controls.ScrollViewer`, but WinUI 3 also
ships the newer `Microsoft.UI.Xaml.Controls.ScrollView` — the shorter,
modern name. Reactor's `ScrollView` is already consistent with that
preferred WinUI name, so the alias direction lets agents reaching for
the WPF / WinUI-legacy `ScrollViewer` spelling discover the modern one.

CHANGELOG entry under `### Breaking changes (deferred)` already in place
from Phase 6.1.

(spec 039 §6 / §16)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 6.6 — ProgressBar obsolete alias + Progress doc comment

Decision: keep `Progress` / `ProgressIndeterminate`, add `[Obsolete]`
`ProgressBar(double)` / `ProgressBar()` forwarding aliases. Reactor's
`ProgressElement` reconciles to WinUI's `ProgressBar`; Reactor names
factories by intent (`Progress`) rather than rendering shape
(`ProgressBar` includes the visual primitive in the name). Aliases let
WinUI muscle-memory callers discover the Reactor spelling without
breaking code.

Also adds `<summary>` + `<remarks>` to the `Progress` and
`ProgressIndeterminate` factories themselves; the rationale doc lives
on the primary (non-obsolete) factory.

CHANGELOG entry under `### Breaking changes (deferred)` already in place
from Phase 6.1.

(spec 039 §5 / §16)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 7.1 — draft spec 040 specialized control scrub

Schedules the follow-up specialized-control audit deferred from spec 039
§13. Draft scaffold only — five controls each get the three audit checks
(event parity, property coverage, naming alignment) as unanswered
checkbox outlines; the audit itself lands in a future change.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 7.2 — specialized control event fluents

Re-runs the Phase 0.3 inventory script over src/Reactor/Controls/** and
broadens the delegate-type regex to capture one level of nested generics
(so DataGridElement<T>.OnSelectionChanged — Action<IReadOnlySet<RowKey>>?
— is now picked up). Adds the missing .SelectionChanged(...) fluent on
DataGridElement<T> plus its null-clear test; the other four specialized
controls (AutoSuggest / MaskedTextField / PropertyGrid / VirtualList)
were already covered by Phase 1's hand-written sweep.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 8.1 — ReactorGallery Button/TextField/InfoBar fluent showcases

Demonstrates the new Phase 1–5 fluents in the gallery:

- ButtonPage: .Click + .AccentButton / .SubtleButton / .TextLink
  (also satisfies the Phase 2.2 .TextLink demo deferred from §17.2).
- TextFieldPage: .NumericInput / .EmailInput / .UrlInput alongside
  .Description(...) per spec §17.3 / §5.
- InfoBarPage: all four severity fluents (.Informational / .Success /
  .Warning / .Error) per spec §17.4 — replaces the previous
  'Severity = InfoBarSeverity.X' record-with pattern.

GalleryControls.cs fully-qualifies WinUI's
Microsoft.UI.Xaml.Controls.ScrollViewer attached-property class because
the Phase 6.5 Factories.ScrollViewer() obsolete alias now shadows it
through the file's 'using static Factories' import. Pre-existing
baseline issue surfaced by the gallery build, fixed here so Phase 8
verifications run.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 8.1 — Card / type-ramp / CalendarView showcases

Three more gallery pages exercising the new Phase 5 / §17 surface:

- Layout/CardPage (new) — Card(child) preset BorderElement with an
  icon + heading + body composition so the theme-aware brushes are
  visible. Demonstrates that Card returns a BorderElement and chains
  with Padding/CornerRadius overrides (§17.5).
- Text/TypeRampPage (new) — Title / Subtitle / Body / BodyStrong /
  BodyLarge factories rendered standalone and inside a Card "article"
  composition (§17.6).
- DateAndTime/CalendarViewPage — adds a Multiple-selection demo wiring
  the new .SelectedDatesChanged(...) fluent into local state (§3.1).
  The fluent drops the leading "On"; the underlying property remains
  OnSelectedDatesChanged.

Both new pages registered in ControlRegistry + PageRouter so they're
discoverable from the gallery shell.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 8.3 — Frame navigation micro-sample

Adds the Frame.Navigated / .Navigating / .NavigationFailed sample
deferred from Phase 3.2. FrameElement bridges into WinUI by calling
the underlying Frame.Navigate(Type), which requires real Page-derived
classes — so the sample ships three trivial code-only Page subclasses
(Home, Details, Broken) alongside the demo component.

The demo wires all three fluents into a 20-entry rolling log via
UseReducer (functional setter — handlers fire after render so the
plain UseState setter would close over stale state). A "Force failure"
button navigates to the Broken page whose ctor throws, so
NavigationFailed fires with the exception captured in the log.

Re-keying the FrameElement on a tick state forces Reactor to remount
the Frame so identical-target re-navigations still raise
Navigating + Navigated (the underlying WinUI Frame coalesces
identical Navigate calls otherwise).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(039): Phase 8.2 — sample apps fluent sweep (no-op verification)

Grepped each in-scope app for the .Set(c => c.OnX = ...) /
property-init OnX = pattern that the Phase 1–7 fluent surface
supersedes:

  samples/apps/chat
  samples/apps/demo-script-tool
  samples/apps/regedit
  samples/apps/wordpuzzle
  samples/apps/validation-showcase
  samples/apps/a11y-showcase

Zero hits across all six. The Set(...) escape-hatches that exist are
theme-resource templating (Set("ButtonBackground", brush)) or
style-only WinUI knobs (Padding, TextWrapping, AcceptsReturn, etc.),
none of which currently have a fluent. The OnClosed / OnItemInvoked
property-init patterns in regedit already live inside with { ... }
record-construction (not inside Set), where the fluent swap doesn't
buy anything.

Documented as no-op on the task list. No app code changes; this
commit is the task-tracker flip + 8.1 / 8.3 deferred-item
cross-references (Phase 2.2 TextLink sample, Phase 3.2 Frame sample).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 9.1 — guide updates

Add minimum-viable coverage of the spec-039 surface to the existing user
guides:

- forms.md: new "Configuring TextField" section covers
  .NumericInput / .EmailInput / .UrlInput / .PhoneInput / .SearchInput
  alongside .MaxLength / .IsSpellCheckEnabled / .CharacterCasing /
  .TextAlignment / .Description.
- styling.md: new "Named-Style Fluents" section covers .AccentButton /
  .SubtleButton / .TextLink and the four InfoBar severity helpers.
- layout.md: new Card and Type-Ramp sections with worked examples.
- navigation.md: new Frame events section (.Navigated / .Navigating /
  .NavigationFailed) plus NavigationView.SelectedTagChanged fluent.
- collections.md: new Multi-Select section covering the universal
  .SelectionChanged fluent on ListView / GridView / ListBox and the
  typed peers, including the IReadOnlyList<int> vs IReadOnlyList<T>
  signature split and the TreeView deferral note.

getting-started.md already used the post-Phase-1 fluent shapes throughout;
no edits needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 9.2 — xaml-developers cross-reference

Add an "Events: XAML Attributes Become Fluents" section to the
XAML-developers guide so people coming from XAML find the bridge
quickly. Covers the canonical mappings (Click, TextChanged,
SelectionChanged, SelectedIndexChanged, IsCheckedChanged) and the
naming convention — the fluent drops the leading On (because C#
binds delegate-property invocation in preference to extension
methods, per spec 039 §0.1), while the underlying property keeps
On so existing record-construction syntax still compiles.

docs/reference/ has no auto-generated API surface — the only
machine-derived API doc is skills/reactor.api.txt + the mirror at
plugins/reactor/skills/reactor-dsl/references/reactor.api.txt,
both regenerated on every Reactor build. No manual action needed
there.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 9.3 — spec 039 Status: Implemented

Flip the spec's status header from "In Implementation" to
"Implemented", with backlinks to the task list, the implementing
branch, and the per-phase commit history (single line, not enumerated).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 9.4 — CHANGELOG entries

Add a spec-039 block under [Unreleased] / ### Added covering the
four required subheadings:

- New fluent extensions (single bullet referring to the inventory).
- Named-style helpers (.AccentButton / .SubtleButton / .TextLink,
  InfoBar severity helpers, Card factory, type-ramp factories).
- New events exposed (CalendarView, Frame, ScrollView, Popup,
  WebView2, MediaPlayerElement, ContentDialog, Image, ComboBox,
  DataGrid, universal collection multi-select).
- New init properties (single bullet referring to spec 039 §14 #4 —
  Phase 4 / Phase 5 inventory).

Naming aliases (RichText → RichTextBlock, ScrollViewer, ProgressBar)
remain in the existing "Breaking changes (deferred)" block where
Phase 6.1 / 6.5 / 6.6 originally landed them — they're already
described there, no duplication needed.

Also flips the Phase 9 task-file checkboxes to [x] and the tracker
"Docs updated (Phase 9)" line.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 10.1 — reactor-dsl SKILL.md fluent-naming clarification

Adds a "Fluent naming convention (callbacks)" section explaining that
record `OnX` callback properties have matching `.X(...)` fluent
extensions (the leading `On` drops). Calls out the C# instance-property
vs extension-method clash that drove the split, and the null-clear
semantic.

reactor.api.txt is auto-regenerated on every Reactor build; current
copy is up-to-date.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 10.2 — reactor-recipes fluent sweep + new recipes

Updates the four target recipes and adds two new ones in both
`plugins/reactor/skills/reactor-recipes/references/` (current layout)
and `skills/recipes/` (legacy layout — still consumed by Reactor.csproj
NuGet pack at `agentkit/skills/recipes/`).

themed-card.cs:
  - Uses the new Card(child) factory (Phase 2.5) instead of hand-rolling
    Border + Theme.CardBackground + .CornerRadius(8) + .Padding(16).
  - Switches headings to the type-ramp factories (Subtitle/Caption).

form-with-validation.cs:
  - Adds an Age field demonstrating .NumericInput() + .MaxLength(3).
  - Applies .EmailInput() to the existing email field.
  - Header note covers the .Changed(...) fluent and its REPLACE
    semantic (vs. the combined-lambda pattern in the body).

list-add-delete.cs:
  - Converts the manual VStack of rows to the templated
    ListView<T>(items, keySelector, viewBuilder) factory with
    .ItemClick(item => ...) wired to the toggle reducer action.

sidebar-nav.cs:
  - Header note and inline comment document the
    .SelectedTagChanged(...) fluent and note that .WithNavigation
    occupies the same callback slot (mutually exclusive).

New: named-styles.cs:
  - Side-by-side demo of .AccentButton() / .SubtleButton() /
    .TextLink() on Button + HyperlinkButton, plus the four InfoBar
    severity fluents (.Informational / .Success / .Warning / .Error).

New: calendar-multiselect.cs:
  - CalendarViewSelectionMode.Multiple (via `with`) + .SelectedDates
    + .SelectedDatesChanged for two-way binding.

index.md updated in both layouts to reference the new recipes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 10.{3,4,5,6,7} — additional skill fluent sweep

10.3 reactor-design: Typography table extended with the WinUI 3 ramp
factories (Title/Subtitle/Body/BodyStrong/BodyLarge) with a note
disambiguating them from the older Heading/SubHeading Reactor presets.
"Avoid Deep Nesting" example gains a Card(...) one-liner. Mirror update
applied to legacy skills/design.md.

10.4 reactor-getting-started: no-op — zero .Set(c => c.On*) or
with { On* = ... } patterns in SKILL.md.

10.5 reactor-forms: Available-input-types table extended for TextField
(+ .MaxLength(n), .NumericInput(), .EmailInput(), .Changed(handler))
and PasswordBox (+ .MaxLength(n), .PasswordChanged(handler)). New
"Named-input shapes" callout with a worked .EmailInput() chain.

10.6 reactor-commanding / reactor-navigation / reactor-input: no-op —
zero .Set(c => c.On*) or property-init callback patterns in any.

10.7 Top-level mirrors:
  - Root SKILL.md: cheatsheet adds Title/Subtitle/Body/BodyStrong/
    BodyLarge line and Card(child) line; recipe roll-call now includes
    canvas-positioning, named-styles, calendar-multiselect.
  - skills/dsl-reference.md: typography table gains the 5 WinUI ramp
    factories; layout-containers table gains a Card(child) row.
  - skills/forms.md: input-types table mirrors the reactor-forms update.
  - skills/input.md / skills/navigation.md / skills/commanding.md:
    no-op (same grep-clean result as 10.6).

Phase 10 tracker line flipped to [x].

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.1 — public-API surface guard test

Adds PublicApiSurfaceGuardTests under tests/Reactor.Tests/Elements/ that
walks every Element record reflectively and asserts each Action/Action<T>
callback property has a matching public extension method with a compatible
delegate-shape signature.

Two intentional property-name exceptions allowlisted with inline rationale:
VirtualListElement.Ref (ref-capture; clashes with generic .Ref<T> modifier)
and XamlHostElement.Updater (constructor-time interop hook). All other
callback properties resolve cleanly to their fluent counterpart.

Failures are collected and reported in a single readable assertion so a
future record gaining several callbacks at once surfaces every missing
fluent in one shot. Guards the spec 039 §14 #1 / §15 Q1 fluent convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.2 — naming-alignment guard test

Adds NamingAlignmentGuardTests under tests/Reactor.Tests/Elements/ that
loads the Reactor.xml doc-comment output and asserts each spec §0.3
divergent factory (VStack/HStack/Heading/SubHeading/Caption/Flex/FlexRow/
FlexColumn/LazyVStack/LazyHStack/ListView<T>) carries a non-empty <remarks>
explaining the WinUI deviation. Failures collected so a future rename
surfaces every regression in one shot.

ListView only requires the remark on the generic overload (TemplatedListViewElement<T>);
the untyped ListView matches WinUI's spelling and needs no rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.3 — null-clear contract audit + missing facts

Audited EventFluentNullClearTests against the CSV inventory of all
callback properties and added the 8 facts missing for fluents landed
in Phases 5/7:

  - ItemsView.ItemInvoked / SelectionChanged
  - TemplatedGridView.ItemClick / SelectedIndexChanged / SelectionChanged
  - TemplatedFlipView.SelectedIndexChanged
  - TemplatedListView.SelectionChanged
  - PropertyGrid.RootChanged

Total null-clear facts now 92 (was 84).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.4 — Card + AccentButton theme-ref smoke

Adds CardThemeResolutionSmokeTests asserting Card(child) wires the
CardBackgroundFillColorDefaultBrush + CardStrokeColorDefaultBrush keys
into ThemeBindings (so render-time resolution adapts to theme switches)
and cross-checks the keys against Theme.CardBackground / Theme.CardStroke.

For .AccentButton(): asserts the OnMount action exists and (when the
compiler closure layout cooperates) that the captured style-name string
is "AccentButtonStyle".

Full Light/Dark/HighContrast flip-and-verify test deferred — needs a
theme-flip primitive on Reactor.AppTests which is a separate workstream.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.6 — sample-page construction smoke

Adds GallerySampleConstructionSmokeTests with one [Fact] per Phase 8
gallery page (ButtonPage / TextFieldPage / InfoBarPage / TypeRampPage /
CardPage / CalendarViewPage / FrameNavigationPage) asserting the page's
factory + fluent chain constructs without exception and that bound
callbacks reach the expected element property.

The gallery pages are internal types in a WinExe so the full mount-test
under Light/Dark/NightSky needs the Reactor.AppTests harness — deferred
with a tracked checkbox. The fixture-level construction smoke catches
the same defect class (typos, missing factories, wrong receiver type)
without the harness cost.

Phase 11.5 noted as no-op in the task file — source-gen scaffolding was
struck per Phase 0.4 / Q1; the reflective surface guard from 11.1 covers
the equivalent drift detection.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(039): Phase 11.7 — spec-flagged bug regression checks

Adds SpecFlaggedBugRegressionTests with named regression checkpoints for
the three spec-039 §14 bugs:

  - §3.4 AutoSuggestBox.OnSuggestionChosen reachable via record
    constructor (factory path) and via .SuggestionChosen(...) fluent
  - §14 #5 HyperlinkButton.NavigateUri fluent exists and the
    HyperlinkButton(Command) + .NavigateUri(...) doc-promise holds
  - §17.5 Card(child) theme-binding wiring (cross-reference to the
    detailed smoke in CardThemeResolutionSmokeTests)

Flips the Phase 11 checkboxes and the bottom-tracker "Tests landed
(Phase 11)" entry. Two AppTests-harness-blocked deferrals tracked
inline:
  - 11.4 real theme-flip Light/Dark/HighContrast resolution test
  - 11.6 real Phase-8 page mount-and-fire test

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 3.7 — defer niche WinUI events to spec 040

Convert the bundled "defer if too big" line to explicit [deferred]
checkboxes per item with per-control rationale (MenuFlyout cancel-args,
CommandBar lack-of-consumer, SemanticZoom/AnnotatedScrollBar not modelled,
MapControl no SDK dep). Adds §6.1 carry-over section to spec 040 capturing
the ownership transfer. Flips the §14 #3 tracker checkbox now that 3.7
is no longer ambiguous.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* build(039): regenerate reactor.api.txt after rebase onto main

Picks up upstream Viewbox.Stretch / Viewbox.StretchDirection fluents
(#310) that were dropped by the rebase conflict resolution (chose
ours-with-regen-from-build strategy).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): move Phase 9 guide edits into the pipeline source

PR review flagged that Phase 9.{1,2} edited docs/guide/*.md directly, but
those are compiled outputs — the source-of-truth is
docs/_pipeline/templates/<topic>.md.dt + docs/_pipeline/apps/<topic>/App.cs
per the AI-author skill at docs/_pipeline/ai-author-skill.md.

This commit moves each previously-inlined addition into the corresponding
template + doc-app pair and regenerates the compiled guide via
`mur docs compile`:

- forms.md.dt + apps/forms/App.cs: new TextFieldConfigDemo snippet drives
  the "Configuring TextField" section (named-input fluents + MaxLength /
  IsSpellCheckEnabled / CharacterCasing / TextAlignment / Description).
- styling.md.dt + apps/styling/App.cs: NamedStylesExample snippet drives
  the "Named-Style Fluents" section (AccentButton / SubtleButton / TextLink
  + four InfoBar severity helpers).
- layout.md.dt + apps/layout/App.cs: CardDemo + TypeRampDemo snippets drive
  the Card and Type-Ramp sections.
- navigation.md.dt + apps/navigation/App.cs: FrameEventsDemo (with a
  trivial DocsFrameDemoPage Page subclass for Frame.Navigate to target)
  and SelectedTagChangedDemo snippets drive the Frame Events and
  NavigationView.SelectedTagChanged sections.
- collections.md.dt + apps/collections/App.cs: MultiSelectDemo snippet
  drives the "Multi-Select with SelectionChanged" section.
- xaml-developers.md.dt + apps/xaml-developers/App.cs: EventsFluentExample
  snippet drives the "Events: XAML Attributes Become Fluents" section.

Net effect on the compiled output (docs/guide/*.md) vs the prior
direct-edit commits: only three files have material content diffs and
all three are *strict improvements* over the prior fragments — the
original prose code blocks contained either (a) undeclared identifiers
(`MyXamlPage`, `handler`, `bodyElement`, `nav`) or (b) buggy logic
(`indices.Select(i => contacts[i].Id)` against a typed-peer selection
callback that delivers `IReadOnlyList<T>`, not `IReadOnlyList<int>`).
The compiled snippets now come from real, building components in the
doc apps.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(039): Phase 12.{1,2} — check off build + perf neutrality

Records the post-rebase ship-gate results: dotnet build -warnaserror clean
(NU1903 cleared by upstream #311's solution-warning sweep), startup_perf
TTFP 238.1 ms vs 230.2 ms calibrated baseline (~3%, within noise — WinUI3
baseline moved the opposite direction over the same window), stress_perf
reconcile times essentially identical (46.7 ms vs 46.3 ms at 50%,
56.8 ms vs 56.9 ms at 100%).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(039): reconciler — subscribe-before-source + uncontrolled CalendarView selection

Addresses PR #314 review feedback (Copilot inline comments on
Reconciler.Mount.cs:974/1044/3037 and Reconciler.Update.cs:3566).

Three subscribe-before-source ordering bugs — small or cached resources
can fire load/init events synchronously during the Source assignment, so
handlers attached after Source would miss the event:

- MountImage: SetElementTag + EnsureImageWiring move before image.Source
  so cached BitmapImage / SvgImageSource hits don't drop ImageOpened /
  ImageFailed.
- MountWebView2: SetElementTag + all event trampolines (NavigationStarting /
  NavigationCompleted / WebMessageReceived / CoreWebView2Initialized) move
  before webView.Source so a fast CoreWebView2 initialization can't fire
  before subscriptions land.
- MountMediaPlayerElement: SetElementTag + MediaOpened / MediaEnded /
  MediaFailed subscriptions move before player.Source so a cached URI or
  fast-failing source can't drop the initial event.

One uncontrolled-selection bug:

- UpdateCalendarView: SyncSelectedDates was called unconditionally with a
  potentially-null `n.SelectedDates`, and the diff treated null as "desired
  is empty" which cleared every user-picked date on the next render. Now
  only sync when the caller explicitly provided a SelectedDates list —
  null means "uncontrolled, leave the user's selection alone". SyncSelectedDates
  signature tightens to non-null `desired` accordingly.

All 227 element-extension tests (EventFluent / GallerySample / Phase4Init /
SpecFlagged filters) still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(039): PR #314 CR — remove ScrollViewer alias + sweep recipe/skill accuracy

Addresses the remaining Copilot inline review comments from PR #314 (after
the 4 reconciler bug fixes in b8f4d00):

API surface
- Remove the [Obsolete] Factories.ScrollViewer(Element) alias added in
  Phase 6.5. Reviewer flagged that the alias is *not* purely additive —
  under `using static Microsoft.UI.Reactor.Factories;` + `using
  Microsoft.UI.Xaml.Controls;`, the bare name `ScrollViewer` shadows
  Microsoft.UI.Xaml.Controls.ScrollViewer's attached-property type, so
  callers reaching for ScrollViewer.SetVerticalScrollMode(...) etc. have
  to fully-qualify (as samples/ReactorGallery/UserControls/GalleryControls.cs
  was doing). Discoverability win didn't justify the imposed disambiguation
  cost; alias removed. CHANGELOG + Phase 6.5 task-spec entry updated to
  record the reversal. GalleryControls.cs un-fully-qualifies its four
  ScrollViewer.Set*(...) calls.

Tests
- PublicApiSurfaceGuardTests.DelegateShapeMatches now recursively walks
  generic arguments instead of only comparing outer-generic def + arity.
  Prevents Action<IReadOnlySet<RowKey>> from matching Action<IReadOnlyList<int>>.
- ControlCatalogFixtures: catalog entry label `RichText` → `RichTextBlock`
  so the rename guard isn't undermined by the fixture.

Doc / recipe accuracy
- xaml-developers.md.dt: XAML→Reactor table corrected — TextField fluent is
  `.Changed(...)` not `.TextChanged(...)`; ComboBox XAML event is
  `SelectionChanged` (not `SelectedIndexChanged`) with a note that the
  Reactor fluent surfaces the index; CheckBox XAML uses
  `Checked`/`Unchecked` (not `IsCheckedChanged`) with a note that the
  Reactor fluent collapses the three XAML events. Recompiled.
- reactor-dsl SKILL.md: `.Click(_ => Save())` → `.Click(() => Save())`
  (Click takes parameterless Action).
- reactor-forms SKILL.md: §17.4 → §17.3 (named-input scopes live in
  §17.3; §17.4 is InfoBar severity). PasswordBox signature in the
  modifiers table matches the real factory: `(password, setPassword,
  placeholder)` + `.Header(text)` fluent (no fourth positional `header`).
- skills/recipes/named-styles.cs + plugin mirror: `.TextLink()` uses
  `TextBlockButtonStyle` (not `HyperlinkButtonStyle`).
- skills/recipes/list-add-delete.cs + plugin mirror: reverted the
  "no manual .WithKey needed" guidance and restored .WithKey(item.Id)
  on each row. The reconciler reconciles templated-list realized
  containers by index (ItemsSource = 0..N range, RefreshRealizedContainers
  matches by position), so KeySelector on the element record isn't
  consulted for diffing — on reorder/delete-from-middle, focus and
  per-row state stick to the wrong row without an explicit .WithKey.
- skills/recipes/canvas-positioning.cs mirrored from plugin copy; added
  to skills/recipes/index.md so the top-level SKILL.md cheat-sheet
  reference resolves.
- samples/ReactorGallery/.../CardPage.cs: "embedded file remains
  pure-ASCII" comment removed (the file contains a literal Fluent Icons
  glyph — comment was wrong, not the file).

Tooling
- tools/api-scrub/Build-EventFluentInventory.ps1 header comment now
  documents the `File` column added during Phase 7.2.

Spec follow-up
- docs/specs/040-...md: dead link to the not-yet-existing
  tasks/040-specialized-control-scrub-implementation.md replaced with
  prose noting the task list will be created once the audit lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 22, 2026
… §2.15, §2.17)

§2.15 — PreviousContainerTracker (spec 045 §5.3.9):
Internal ConditionalWeakTable<DockableContent, container-ref> tracking the
last container each pane was inside. Hide → re-show routes the pane back
to its remembered container instead of the default insertion point.
Reference-equality keying means distinct pane instances with the same
logical Key get independent history (correct — history attaches to the
instance, not the identity). Bookkeeping decays with the pane reference.

§2.17 — DockContexts + DockHooks (spec 045 §5.3.11):
Six Context<T> slots split by concern (Host, ActivePaneKey, Pane,
PaneState, LayoutSnapshot) so each hook subscribes to the smallest slice
that can answer the question:

  • ctx.UseDockHost()       → DockHostModel? (or null outside any host)
  • ctx.UseActivePaneKey()  → object?       (selector-style re-render)
  • ctx.UseIsActivePane()   → bool          (transitions only)
  • ctx.UsePane()           → DockPaneInfo  (throws outside pane subtree)
  • ctx.UseDockState()      → DockPaneState (per-pane transitions)
  • ctx.UseDockLayout()     → DockLayoutSnapshot? (devtools wide-net)

The hooks are extension methods on RenderContext — call-site reads
`ctx.UseDockHost()`, symmetric with UseColorScheme. The DockLayoutSnapshot
record carries the full read-only snapshot (root / sides / floating /
active) for devtools and the optional MCP introspection (§2.26).

Tests (22 new, 119 docking tests total):
- DockHooksTests: defaults outside any host; provided values resolve via
  ContextScope; UsePane throws outside a pane; UseIsActivePane key
  comparison; two-host process isolation (§5.3.11 last bullet —
  "components inside hostA resolve to hostA"); null-arg defensive checks.
- PreviousContainerTests: Set/Get/Clear cycle; distinct instances with
  shared logical Key have independent histories; Set twice overwrites;
  null-arg defensive checks; hide→show scenario from §5.3.9.

Wiring into the live renderer (so context slots actually receive values
from the model) happens with the native UI pipeline (§2.16 integration,
tracked under task #4).
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 22, 2026
Resolves the 22 findings from the docking feature-branch review +
two test failures that surfaced while running the full suite.

Behavior fixes (Native docking host):
- Tear-out / FloatOp: open the floating window BEFORE removing the
  pane from the docked tree. Layout mutation + OnContentFloated fire
  only when a real ReactorWindow was produced (review #1 — the
  previous broad catch around Open turned a failed transition into a
  success-shaped event).
- Drop-overlay global Esc handler now detaches on reconciler unmount
  in addition to WinUI Unloaded (review #2).
- Floating-window observer callbacks, BeforeInsertToolWindow strategy
  hook, drag-session SessionChanged broadcast, navigator commit
  callback, and theme/resource lookup catches all surface failures via
  Debug.WriteLine or narrow to the expected exception type instead of
  swallowing everything (reviews #3, #4, #5, #7, #8).
- Splitter OnPointerCaptureLost now calls RestorePairToGrow() before
  the final ResizeDelta to converge with the normal release path
  (review #6).

Persistence:
- DockLayoutSerializer.Load now routes pre-current-schema documents
  through DockLayoutMigrationRegistry: parse to JsonNode, detect
  schema (absent $schema = v1 per §5.4.4), TryUpgrade, then
  deserialize. Adds a Load(json, registry) overload and emits a
  PII-safe schema-newer ETW category for forward-tolerant inputs
  (reviews #9 + #10).
- PreviousContainerTracker.ClearAll now actually clears by swapping
  in a fresh ConditionalWeakTable under a lock (review #11).

Surface honesty:
- DockHostModel.Floating is populated by the host renderer from a
  per-manager floating-window tracker; doc comment makes the
  initial-bounds-only limitation explicit (review #12).
- UseDockPanePersisted uses a canonical persisted-key encoder
  (pane:<typeName>|<keyText>:<userKey> with %/colon/pipe escaping)
  so two panes whose Key.ToString() collide get independent slots
  (review #13).
- docking.dock detects ambiguous Key.ToString() matches and returns
  an explicit ambiguous-pane error (review #18).

Test isolation:
- New DockingGlobalsCollection ([Collection("DockingGlobals")] +
  DisableParallelization=true) covers DockingStringsTests,
  DockA11yTests, and DevtoolsDockingToolsTests — three classes that
  mutate process-global state (review #14). DockA11yTests now
  restores DockingStrings.Resolver in Dispose.
- The known-failing UseEffect cleanup assertion is emitted as TAP
  "# SKIP" via a new Harness.Skip helper, with a back-flip to a real
  Check the moment the §2.25 product gap closes (review #15).
- EffectCounterComponent moved off static counters; the fixture owns
  per-run counters and passes mount/cleanup callbacks via props
  (review #16).
- EventListener category assertions in LayoutSerializerTests use a
  bounded retry helper to tolerate occasional async dispatch
  (review #17).

Documentation:
- docs/_pipeline/apps/docking/{api,overview}.md updated for the P2
  reality (core Microsoft.UI.Reactor ship vehicle,
  DockingNativeInterop.Register, deleted vendored WinUI.Dock link)
  (reviews #19, #22).
- DockingStrings.cs + dock-showcase sample comments updated to
  reflect that no .resw resource ships today; DefaultEnglish + the
  resolver are the localization surface (review #20).
- Reactor.csproj stale "stays on disk for reference" comment about
  src/Reactor.Docking.Xaml/ replaced with current state (review #21).

Tests / fluents:
- Added 22 fluent extensions in ElementExtensions.Events.cs for
  DockManager event callbacks + TabViewElement.OnTabDragStarting /
  OnTabDragCompleted so PublicApiSurfaceGuardTests passes; the
  guard test itself is now scoped to public element records only
  (internal overlay/splitter elements aren't part of the public
  surface contract).
- Two stale Phase-1-wrapper fixture names removed from
  SelfTestFixtureRegistry.AllFixtures (they had no factory case and
  surfaced as MSTest "fixture not found" failures).
- NativeDocking_PerGroupDropTargetVisualDemo: observer-pause delays
  cut from 500ms/step to 50ms/step so the 20-step walk stays well
  inside the 15s fixture timeout under CI load; eliminates the
  cascading NRE in DragSessionConfirmMutatesLayout that was caused
  by the timed-out fixture leaving stale host state.
- Mutations_OffOwnerThread_Throw uses an explicit new Thread()
  instead of Task.Run, so the assert can never observe a thread-id
  match by chance.
- Load_MissingSchemaField_FallsBack renamed to
  Load_MissingSchemaField_TreatedAsV1AndMigrated and rewritten —
  empty {} now migrates as v1 (matches the integrated registry).

Validation:
- dotnet test tests/Reactor.Tests -p:Platform=x64
    → 8720 passed, 46 skipped, 0 failed
- dotnet test tests/Reactor.SelfTests -p:Platform=x64
    → 813 passed, 0 failed

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 22, 2026
… §2.15, §2.17)

§2.15 — PreviousContainerTracker (spec 045 §5.3.9):
Internal ConditionalWeakTable<DockableContent, container-ref> tracking the
last container each pane was inside. Hide → re-show routes the pane back
to its remembered container instead of the default insertion point.
Reference-equality keying means distinct pane instances with the same
logical Key get independent history (correct — history attaches to the
instance, not the identity). Bookkeeping decays with the pane reference.

§2.17 — DockContexts + DockHooks (spec 045 §5.3.11):
Six Context<T> slots split by concern (Host, ActivePaneKey, Pane,
PaneState, LayoutSnapshot) so each hook subscribes to the smallest slice
that can answer the question:

  • ctx.UseDockHost()       → DockHostModel? (or null outside any host)
  • ctx.UseActivePaneKey()  → object?       (selector-style re-render)
  • ctx.UseIsActivePane()   → bool          (transitions only)
  • ctx.UsePane()           → DockPaneInfo  (throws outside pane subtree)
  • ctx.UseDockState()      → DockPaneState (per-pane transitions)
  • ctx.UseDockLayout()     → DockLayoutSnapshot? (devtools wide-net)

The hooks are extension methods on RenderContext — call-site reads
`ctx.UseDockHost()`, symmetric with UseColorScheme. The DockLayoutSnapshot
record carries the full read-only snapshot (root / sides / floating /
active) for devtools and the optional MCP introspection (§2.26).

Tests (22 new, 119 docking tests total):
- DockHooksTests: defaults outside any host; provided values resolve via
  ContextScope; UsePane throws outside a pane; UseIsActivePane key
  comparison; two-host process isolation (§5.3.11 last bullet —
  "components inside hostA resolve to hostA"); null-arg defensive checks.
- PreviousContainerTests: Set/Get/Clear cycle; distinct instances with
  shared logical Key have independent histories; Set twice overwrites;
  null-arg defensive checks; hide→show scenario from §5.3.9.

Wiring into the live renderer (so context slots actually receive values
from the model) happens with the native UI pipeline (§2.16 integration,
tracked under task #4).
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 22, 2026
Resolves the 22 findings from the docking feature-branch review +
two test failures that surfaced while running the full suite.

Behavior fixes (Native docking host):
- Tear-out / FloatOp: open the floating window BEFORE removing the
  pane from the docked tree. Layout mutation + OnContentFloated fire
  only when a real ReactorWindow was produced (review #1 — the
  previous broad catch around Open turned a failed transition into a
  success-shaped event).
- Drop-overlay global Esc handler now detaches on reconciler unmount
  in addition to WinUI Unloaded (review #2).
- Floating-window observer callbacks, BeforeInsertToolWindow strategy
  hook, drag-session SessionChanged broadcast, navigator commit
  callback, and theme/resource lookup catches all surface failures via
  Debug.WriteLine or narrow to the expected exception type instead of
  swallowing everything (reviews #3, #4, #5, #7, #8).
- Splitter OnPointerCaptureLost now calls RestorePairToGrow() before
  the final ResizeDelta to converge with the normal release path
  (review #6).

Persistence:
- DockLayoutSerializer.Load now routes pre-current-schema documents
  through DockLayoutMigrationRegistry: parse to JsonNode, detect
  schema (absent $schema = v1 per §5.4.4), TryUpgrade, then
  deserialize. Adds a Load(json, registry) overload and emits a
  PII-safe schema-newer ETW category for forward-tolerant inputs
  (reviews #9 + #10).
- PreviousContainerTracker.ClearAll now actually clears by swapping
  in a fresh ConditionalWeakTable under a lock (review #11).

Surface honesty:
- DockHostModel.Floating is populated by the host renderer from a
  per-manager floating-window tracker; doc comment makes the
  initial-bounds-only limitation explicit (review #12).
- UseDockPanePersisted uses a canonical persisted-key encoder
  (pane:<typeName>|<keyText>:<userKey> with %/colon/pipe escaping)
  so two panes whose Key.ToString() collide get independent slots
  (review #13).
- docking.dock detects ambiguous Key.ToString() matches and returns
  an explicit ambiguous-pane error (review #18).

Test isolation:
- New DockingGlobalsCollection ([Collection("DockingGlobals")] +
  DisableParallelization=true) covers DockingStringsTests,
  DockA11yTests, and DevtoolsDockingToolsTests — three classes that
  mutate process-global state (review #14). DockA11yTests now
  restores DockingStrings.Resolver in Dispose.
- The known-failing UseEffect cleanup assertion is emitted as TAP
  "# SKIP" via a new Harness.Skip helper, with a back-flip to a real
  Check the moment the §2.25 product gap closes (review #15).
- EffectCounterComponent moved off static counters; the fixture owns
  per-run counters and passes mount/cleanup callbacks via props
  (review #16).
- EventListener category assertions in LayoutSerializerTests use a
  bounded retry helper to tolerate occasional async dispatch
  (review #17).

Documentation:
- docs/_pipeline/apps/docking/{api,overview}.md updated for the P2
  reality (core Microsoft.UI.Reactor ship vehicle,
  DockingNativeInterop.Register, deleted vendored WinUI.Dock link)
  (reviews #19, #22).
- DockingStrings.cs + dock-showcase sample comments updated to
  reflect that no .resw resource ships today; DefaultEnglish + the
  resolver are the localization surface (review #20).
- Reactor.csproj stale "stays on disk for reference" comment about
  src/Reactor.Docking.Xaml/ replaced with current state (review #21).

Tests / fluents:
- Added 22 fluent extensions in ElementExtensions.Events.cs for
  DockManager event callbacks + TabViewElement.OnTabDragStarting /
  OnTabDragCompleted so PublicApiSurfaceGuardTests passes; the
  guard test itself is now scoped to public element records only
  (internal overlay/splitter elements aren't part of the public
  surface contract).
- Two stale Phase-1-wrapper fixture names removed from
  SelfTestFixtureRegistry.AllFixtures (they had no factory case and
  surfaced as MSTest "fixture not found" failures).
- NativeDocking_PerGroupDropTargetVisualDemo: observer-pause delays
  cut from 500ms/step to 50ms/step so the 20-step walk stays well
  inside the 15s fixture timeout under CI load; eliminates the
  cascading NRE in DragSessionConfirmMutatesLayout that was caused
  by the timed-out fixture leaving stale host state.
- Mutations_OffOwnerThread_Throw uses an explicit new Thread()
  instead of Task.Run, so the assert can never observe a thread-id
  match by chance.
- Load_MissingSchemaField_FallsBack renamed to
  Load_MissingSchemaField_TreatedAsV1AndMigrated and rewritten —
  empty {} now migrates as v1 (matches the integrated registry).

Validation:
- dotnet test tests/Reactor.Tests -p:Platform=x64
    → 8720 passed, 46 skipped, 0 failed
- dotnet test tests/Reactor.SelfTests -p:Platform=x64
    → 813 passed, 0 failed

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 23, 2026
… §2.15, §2.17)

§2.15 — PreviousContainerTracker (spec 045 §5.3.9):
Internal ConditionalWeakTable<DockableContent, container-ref> tracking the
last container each pane was inside. Hide → re-show routes the pane back
to its remembered container instead of the default insertion point.
Reference-equality keying means distinct pane instances with the same
logical Key get independent history (correct — history attaches to the
instance, not the identity). Bookkeeping decays with the pane reference.

§2.17 — DockContexts + DockHooks (spec 045 §5.3.11):
Six Context<T> slots split by concern (Host, ActivePaneKey, Pane,
PaneState, LayoutSnapshot) so each hook subscribes to the smallest slice
that can answer the question:

  • ctx.UseDockHost()       → DockHostModel? (or null outside any host)
  • ctx.UseActivePaneKey()  → object?       (selector-style re-render)
  • ctx.UseIsActivePane()   → bool          (transitions only)
  • ctx.UsePane()           → DockPaneInfo  (throws outside pane subtree)
  • ctx.UseDockState()      → DockPaneState (per-pane transitions)
  • ctx.UseDockLayout()     → DockLayoutSnapshot? (devtools wide-net)

The hooks are extension methods on RenderContext — call-site reads
`ctx.UseDockHost()`, symmetric with UseColorScheme. The DockLayoutSnapshot
record carries the full read-only snapshot (root / sides / floating /
active) for devtools and the optional MCP introspection (§2.26).

Tests (22 new, 119 docking tests total):
- DockHooksTests: defaults outside any host; provided values resolve via
  ContextScope; UsePane throws outside a pane; UseIsActivePane key
  comparison; two-host process isolation (§5.3.11 last bullet —
  "components inside hostA resolve to hostA"); null-arg defensive checks.
- PreviousContainerTests: Set/Get/Clear cycle; distinct instances with
  shared logical Key have independent histories; Set twice overwrites;
  null-arg defensive checks; hide→show scenario from §5.3.9.

Wiring into the live renderer (so context slots actually receive values
from the model) happens with the native UI pipeline (§2.16 integration,
tracked under task #4).
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 23, 2026
Resolves the 22 findings from the docking feature-branch review +
two test failures that surfaced while running the full suite.

Behavior fixes (Native docking host):
- Tear-out / FloatOp: open the floating window BEFORE removing the
  pane from the docked tree. Layout mutation + OnContentFloated fire
  only when a real ReactorWindow was produced (review #1 — the
  previous broad catch around Open turned a failed transition into a
  success-shaped event).
- Drop-overlay global Esc handler now detaches on reconciler unmount
  in addition to WinUI Unloaded (review #2).
- Floating-window observer callbacks, BeforeInsertToolWindow strategy
  hook, drag-session SessionChanged broadcast, navigator commit
  callback, and theme/resource lookup catches all surface failures via
  Debug.WriteLine or narrow to the expected exception type instead of
  swallowing everything (reviews #3, #4, #5, #7, #8).
- Splitter OnPointerCaptureLost now calls RestorePairToGrow() before
  the final ResizeDelta to converge with the normal release path
  (review #6).

Persistence:
- DockLayoutSerializer.Load now routes pre-current-schema documents
  through DockLayoutMigrationRegistry: parse to JsonNode, detect
  schema (absent $schema = v1 per §5.4.4), TryUpgrade, then
  deserialize. Adds a Load(json, registry) overload and emits a
  PII-safe schema-newer ETW category for forward-tolerant inputs
  (reviews #9 + #10).
- PreviousContainerTracker.ClearAll now actually clears by swapping
  in a fresh ConditionalWeakTable under a lock (review #11).

Surface honesty:
- DockHostModel.Floating is populated by the host renderer from a
  per-manager floating-window tracker; doc comment makes the
  initial-bounds-only limitation explicit (review #12).
- UseDockPanePersisted uses a canonical persisted-key encoder
  (pane:<typeName>|<keyText>:<userKey> with %/colon/pipe escaping)
  so two panes whose Key.ToString() collide get independent slots
  (review #13).
- docking.dock detects ambiguous Key.ToString() matches and returns
  an explicit ambiguous-pane error (review #18).

Test isolation:
- New DockingGlobalsCollection ([Collection("DockingGlobals")] +
  DisableParallelization=true) covers DockingStringsTests,
  DockA11yTests, and DevtoolsDockingToolsTests — three classes that
  mutate process-global state (review #14). DockA11yTests now
  restores DockingStrings.Resolver in Dispose.
- The known-failing UseEffect cleanup assertion is emitted as TAP
  "# SKIP" via a new Harness.Skip helper, with a back-flip to a real
  Check the moment the §2.25 product gap closes (review #15).
- EffectCounterComponent moved off static counters; the fixture owns
  per-run counters and passes mount/cleanup callbacks via props
  (review #16).
- EventListener category assertions in LayoutSerializerTests use a
  bounded retry helper to tolerate occasional async dispatch
  (review #17).

Documentation:
- docs/_pipeline/apps/docking/{api,overview}.md updated for the P2
  reality (core Microsoft.UI.Reactor ship vehicle,
  DockingNativeInterop.Register, deleted vendored WinUI.Dock link)
  (reviews #19, #22).
- DockingStrings.cs + dock-showcase sample comments updated to
  reflect that no .resw resource ships today; DefaultEnglish + the
  resolver are the localization surface (review #20).
- Reactor.csproj stale "stays on disk for reference" comment about
  src/Reactor.Docking.Xaml/ replaced with current state (review #21).

Tests / fluents:
- Added 22 fluent extensions in ElementExtensions.Events.cs for
  DockManager event callbacks + TabViewElement.OnTabDragStarting /
  OnTabDragCompleted so PublicApiSurfaceGuardTests passes; the
  guard test itself is now scoped to public element records only
  (internal overlay/splitter elements aren't part of the public
  surface contract).
- Two stale Phase-1-wrapper fixture names removed from
  SelfTestFixtureRegistry.AllFixtures (they had no factory case and
  surfaced as MSTest "fixture not found" failures).
- NativeDocking_PerGroupDropTargetVisualDemo: observer-pause delays
  cut from 500ms/step to 50ms/step so the 20-step walk stays well
  inside the 15s fixture timeout under CI load; eliminates the
  cascading NRE in DragSessionConfirmMutatesLayout that was caused
  by the timed-out fixture leaving stale host state.
- Mutations_OffOwnerThread_Throw uses an explicit new Thread()
  instead of Task.Run, so the assert can never observe a thread-id
  match by chance.
- Load_MissingSchemaField_FallsBack renamed to
  Load_MissingSchemaField_TreatedAsV1AndMigrated and rewritten —
  empty {} now migrates as v1 (matches the integrated registry).

Validation:
- dotnet test tests/Reactor.Tests -p:Platform=x64
    → 8720 passed, 46 skipped, 0 failed
- dotnet test tests/Reactor.SelfTests -p:Platform=x64
    → 813 passed, 0 failed

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 23, 2026
* docs(045): tracking checklist + CHANGELOG bucket for docking workstream

Lands the implementation tracking doc (045-docking-windows-implementation.md)
referenced from the design and reserves a "Spec 045 — Docking" entry under
Unreleased so each phase appends to it incrementally.

Phase 0 (cross-cutting setup) per the tracking doc §0.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): vendor WinUI.Dock @ 2f5247f1 (P1.1)

Pulls in WinUI.Dock (https://github.com/qian-o/WinUI.Dock, MIT) at
commit 2f5247f10d0abfde0fcb181e3037391d4a27952e under third_party/.
This is the foundation for Phase 1 of spec 045: the Reactor wrapper
assembly will reconcile a Reactor element tree onto this control library
so we can ship docking in the next cycle while the Phase 2 native rewrite
proceeds in parallel.

Four light edits per spec 045 §4.2 — documented in VENDORED.md:
  1. Uno code paths stripped. csproj single-targets
     net10.0-windows10.0.22621.0 (matches Reactor); WindowsAppSDK version
     sourced from $(WindowsAppSDKVersion) so it stays in lockstep.
  2. .editorconfig formatting (whitespace only).
  3. Added Properties/AssemblyInfo.cs with [InternalsVisibleTo] for the
     Reactor.Docking.Xaml wrapper + its test project.
  4. Cross-window DnD bug — no source edit; wrapper restricts drag-out to
     a single DockManager (spec §4.6).

XAMLTools.MSBuild dropped — the pre-merged Themes/Generic.xaml is checked
in directly and the per-control root *.xaml inputs are excluded from XAML
page compilation via <Page Remove>.

Build verified: `dotnet build third_party/WinUI.Dock/WinUI.Dock.csproj`
produces WinUI.Dock.dll with 0 warnings, 0 errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): Reactor.Docking.Xaml project + Phase 1 public API (P1.2/P1.3)

Adds the wrapper assembly src/Reactor.Docking.Xaml/ wired into Reactor.slnx
and declares the public API surface committed at Phase 1 exit per
spec 045 §4.3:

  Namespace Microsoft.UI.Reactor.Docking:
    DockManager : Element              — host element
    DockNode (abstract)                — algebra root
    DockSplit : DockNode               — N-way oriented split with min/max
    DockTabGroup : DockNode            — tab strip with TabPosition / Compact
    DockableContent : DockNode         — leaf pane with Key, CanClose, CanPin
    TabPosition { Top, Bottom }
    DockTarget { Center, Split{L,T,R,B}, Dock{L,T,R,B} }
    DockTabGroupContext                — adapter callback arg
    IDockAdapter                       — content rehydrate + floating chrome
    IDockBehavior                      — dock / float observation

Every public member carries an XML <remarks> linking back to the
relevant spec § number. CS1591 is suppressed at the project level so
we can still cleanly build before every internal helper has docs.

InternalsVisibleTo Reactor.Docking.Xaml.Tests, Reactor.Tests, and
Reactor.AppTests.Host so smoke fixtures + unit tests can reach into
the reconciler internals.

Wrapper implementation lands in the next commit (P1.4).

Build verified: dotnet build src/Reactor.Docking.Xaml — 0/0.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): wrapper implementation for DockManager element (P1.4)

Lands the leaf-wrapper plumbing per spec 045 §4.4. Reconciles a Reactor
DockManager element to a single vendored WinUI.Dock.DockManager control:

  * MountDockManager — creates the upstream control, merges the
    WinUIDockResources dictionary so the control template + theme brushes
    resolve, attaches a HostState bag, wires the Adapter/Behavior bridges
    if supplied, and walks the DockNode tree to build LayoutPanel /
    DocumentGroup / Document instances.

  * UpdateDockManager — re-wires bridges on identity change, applies the
    new layout (preserving panes by DockableContent.Key — content
    subtrees survive container rebuilds), syncs the four side
    collections, and updates ActiveDocument.

  * UnmountDockManager — reconciles every pane's content to null so
    useEffect cleanup runs, calls SaveLayout() when a PersistenceId is
    set (auto-restore wiring is a §1.4 follow-up), and clears state.

Internal bridges translate the upstream IDockAdapter/IDockBehavior
interfaces onto the Reactor-side records:

  * AdapterBridge.OnCreated(Document)         → OnContentCreated
  * AdapterBridge.OnCreated(DocumentGroup,..) → OnGroupCreated
  * AdapterBridge.GetFloatingWindowTitleBar   → identical, with the
    Reactor element reconciled into a UIElement before return.
  * BehaviorBridge maps both OnDocked overloads onto Reactor's single
    OnDocked surface; the upstream DockTarget enum maps 1-to-1.

Pane identity is via DockableContent.Key (per spec 042 keyed
reconciliation). Panes with no Key get a synthetic per-render key so
they are mounted fresh each time — there is no implicit Title-as-key
fallback (spec §1.4).

Reactor.csproj grows InternalsVisibleTo("Microsoft.UI.Reactor.Docking.Xaml")
so the first-party wrapper can call SetElementTag / DetachReactorState.

Build verified: dotnet build src/Reactor.Docking.Xaml — 0/0.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(045): unit + smoke fixtures for docking wrapper (P1.7)

Reactor.Tests/Docking/ — pure C# unit tests over the spec 045 §4.3 public
API surface. 27 tests, run in <250 ms:
  * DockApiShapeTests        — record defaults, equality, "with"-mutation,
                               algebra sealing, enum exhaustiveness, key
                               typing flexibility.
  * BehaviorBridgeMappingTests — pins the WinUI.Dock.DockTarget ↔ Reactor
                               DockTarget mapping with [Theory] + a count
                               guard that trips loudly when the upstream
                               enum grows on re-snapshot.

Reactor.AppTests.Host SelfTest/Fixtures/DockingSmokeFixture.cs (spec 045
§1.7 — "minimal smoke fixture called out in §10.1 item 10"):
  * Docking_TwoPaneMountUpdateUnmount — mount a 2-pane DockSplit, assert
    Panel.Orientation, swap pane content, flip Orientation, unmount.
    Catches mount/update/unmount regressions in the wrapper end-to-end.
  * Docking_KeyedPanePreservation — verifies DockableContent.Key
    reconciliation: reorder two panes, assert the SAME vendored Document
    instance survives (so the Reactor content subtree mounted inside its
    ContentControl host is preserved across the rebuild).

Registered both fixtures in SelfTestFixtureRegistry.AllFixtures + Create.

Side rename: existing 7 fixture files used `using WinUI = Microsoft.UI
.Xaml.Controls;` which conflicted with the now-referenced WinUI.Dock root
namespace (CS0576). Aliases renamed to `WinXC` (WinUI Controls) — purely
mechanical, no behavior change. The alias is private to each file.

Build verified: AppTests.Host + Tests, 0 errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(045): Phase 1 docking overview + API reference (P1.8)

Drops authoring source into docs/_pipeline/apps/docking/ per the
tracking doc §1.8:

  * overview.md — what docking is, the four-phase plan summary, the
    Phase 1 capability list (documents in tab groups, recursive splits,
    side pins, floating tear-out, programmatic dock, persistence,
    compact/bottom tabs) AND the known limitations that motivate
    Phase 2 (single-role DockableContent, no per-pane state, baseline
    a11y, informational-only IDockBehavior).
  * api.md — every public type with concrete code examples. End-to-end
    IDE-layout example, key conventions (no Title-as-key fallback —
    spec §1.4 explicit), adapter and behavior surface.

Both files lead with a banner reminding contributors that
docs/guide/docking.md is generated output (per memory
feedback_docs_pipeline.md). The .dt template under docs/_pipeline/
templates/ that compiles to docs/guide/docking.md is a P1 exit
follow-up — these source files capture the authoring intent so the
template can pull from them on the next pipeline run.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): dock showcase sample app — six scenes for human review (P1.6)

samples/apps/dock-showcase/ — the human-tested deliverable for spec 045
§4.5. Six scenes pinned to the Phase 1 review script (§4.7 items 1-8):

  A — IDE layout: Solution Explorer (left tool) + center editor tabs +
      Properties (right tool) + Output (bottom). Persists under
      PersistenceId "dock-showcase:ide".
  B — Floating tear-out: 3-tab DocumentGroup + a custom title bar
      supplied via IDockAdapter.GetFloatingWindowTitleBar.
  C — Side pin: a CanPin: true ToolWindow pinned to RightSide.
  D — Compact + bottom tabs: TabPosition.Bottom + CompactTabs=true,
      side-by-side with a TabPosition.Top reference for visual diff.
  E — Persistence: PersistenceId-scoped auto-save on unmount.
  F — Programmatic dock: state-driven .Select() mapping demonstrates
      that Reactor's functional composition replaces upstream's
      DocumentsSource binding API (spec §3.2 lesson #3).

Configures the host's reconciler at launch via
  ReactorApp.Run<DockShowcaseRoot>(configure: host =>
    DockingXamlInterop.Register(host.Reconciler));

Wired into Reactor.slnx under /samples/apps/dock-showcase/.

Build verified: dotnet build samples/apps/dock-showcase — 0 warnings,
0 errors. Functional + visual review against Example.WinUI is the
Phase 1 §4.7 human gate (this commit unblocks that gate).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(045): finalize Phase 1 tracking + CHANGELOG (P1 exit)

Marks Phase 1 tasks complete in the tracking doc:
  * §0.1 — branch, CHANGELOG, PR cadence
  * §1.1 — vendoring (commit, light edits, sunset note)
  * §1.2 — wrapper assembly + slnx wiring
  * §1.3 — public API surface (every type + XML doc cross-ref)
  * §1.4 — wrapper implementation (mount / update / unmount /
           keyed-content preservation / adapter+behavior bridges)
  * §1.6 — showcase sample (all six scenes)
  * §1.7 — testing (smoke fixtures + 27 unit tests)
  * §1.8 — overview + api authoring sources

Items explicitly deferred and called out inline:
  - TypeForwardedTo redirects (cosmetic; not P1-critical)
  - WindowPersistedScope auto-route on PersistenceId (§1.4 follow-up;
    scope wiring needs the host scope service)
  - Light/Dark/NightSky × 100/200% showcase matrix (P2 selftest scope)
  - File-menu Save/Load in Scene E (bound to scope wiring above)
  - ReactorGallery integration (standalone showcase is canonical)

CHANGELOG updated with the substantive Phase 1 entry naming the
committed API and the vendored library status.

Tree compiles 0/0 across Reactor, Reactor.Docking.Xaml, WinUI.Dock,
AppTests.Host, and DockShowcase. Reactor.Tests passes 8326/8326
(0 regressions from the WinUI→WinXC alias rename in 7 fixture files).

Phase 1 is now ready for the §4.7 human review gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(045): register WinUI.Dock metadata provider so showcase loads under ReactorApp.Run

Symptoms: launching the dock-showcase under ReactorApp.Run<TRoot> crashes
immediately with 0xC000027B (STATUS_APPLICATION_INTERNAL_EXCEPTION) inside
Microsoft.UI.Xaml.dll. The selftest harness running the same wrapper code
did not crash — masking the bug.

Root cause: when the vendored WinUI.Dock control template applies, the
XAML loader looks up types like dock:DockTargetButton, dock:Preview from
the active Application's IXamlMetadataProvider chain. Reactor's chain
covers Reactor's own types + the host project's compiler-generated
provider + the registered control-assembly providers — but apps using
ReactorApp.Run<TRoot> only get the host-assembly auto-discovery path for
DIRECT XAML files in the host project, not for transitive control-library
references. Without the WinUI.Dock metadata provider registered, the
template-apply pass kills the process.

(The selftest harness coincidentally worked because Reactor.AppTests.Host
has its own XAML metadata aggregation path that pulls in the vendored
library types via the entry-assembly scan — but that's harness-specific
luck, not a contract.)

Fix: DockingXamlInterop.Register now calls
ReactorApp.RegisterControlAssembly(typeof(WinUIDock.DockManager).Assembly)
before installing the reconciler type registration. This adds the vendored
library's auto-generated XamlMetaDataProvider to the chain consulted by
ReactorApplication.GetXamlType for every subsequent lookup.

Verified:
  * dock-showcase launches and renders the six scenes (window appears).
  * Selftests: 13/13 assertions pass across both fixtures (exit 0).

Side: removed `#if DEBUG: devtools: true` from showcase to keep the
sample focused on docking interaction. Re-enable per session if needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(045): close out P0 cross-cutting + P1 AOT verification

Wraps up the remaining unchecked Phase 0 items and the §1.5 AOT bullet
that didn't gate the P1 functional landing but were left open:

- §0.2: confirmed no PublicApiAnalyzers adoption — matches spec 036.
- §0.3: reserved the Docking.* resource prefix via the new
  src/Reactor.Docking.Xaml/Resources/Reactor.Docking.resw. File header
  documents the convention; entries cover the P2-consumed surfaces
  (drop targets, floating-window default title, side-pin tooltip).
- §0.4: N/A — no central spec index exists.
- §0.5: ThirdPartyNoticeText.txt verified — WinUI.Dock block at L75.
- §1.5: AOT verification — Reactor.Docking.Xaml builds 0/0 in Release;
  AppTests.Host with the wrapper referenced introduces no new IL trim
  warnings (only 4 pre-existing CS warnings in unrelated fixtures).

Phase 1 is now structurally complete; the §1.9 human-review gate is the
remaining blocker before merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(045): showcase Scene A mirrors upstream + fill window height

Addresses the two issues from the §1.9 side-by-side review:

1. **DockManager fills available height across scenes.** The outer
   wrapper used `VStack(...) + .Flex(grow:1)` on the DockManager, but
   `.Flex(grow:1)` is only honored inside a Reactor FlexPanel — inside
   a StackPanel-based VStack it is a no-op, so the dock area collapsed
   to its measured intrinsic size. Switched Scenes A/B/C/E/F to a Grid
   with `[Auto, …, Star]` rows so the DockManager occupies all
   remaining vertical space. Scene D keeps explicit `.Height(200)` per
   its side-by-side compact/full tab comparison.

2. **Scene A now mirrors WinUI.Dock Example.WinUI/MainView.xaml.**
   Restructured to a vertical split → two horizontal halves: top is
   editor tabs (MainView.xaml + MainViewModel.cs) plus a right-side
   compact bottom-tab group (Solution Explorer + Git Changes, Width:
   240); bottom row is Error List + Output/Terminal, both with
   TabPosition.Bottom (Output/Terminal also CompactTabs), pinned to
   Height: 200. The previous shape was missing every bottom-tab
   DocumentGroup the upstream sample ships with by default — adding
   them makes the side-by-side review apples-to-apples.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(045): close P1 human review gate + risk verification items

P1 §1.9 human review steps 1-8 signed off by user on 2026-05-20 against
showcase sample (commit 871e1e3e). P1 §1.5 risk-verification items
closed (commit pin recorded, drag-out scoped to single manager,
ContentControl slot verified by warnings-as-errors build).

P1 exit complete. Phase 2 (Reactor-native rewrite) opens next.

* feat(045): move docking public API into Reactor core + Phase 2 surface

Foundation refactor for Phase 2 (spec 045 §5):

* Move the P1 committed API surface (DockManager, DockNode, DockSplit,
  DockTabGroup, DockableContent, TabPosition, DockTarget, IDockAdapter,
  IDockBehavior, DockTabGroupContext) from src/Reactor.Docking.Xaml into
  src/Reactor/Docking/. Same namespace (Microsoft.UI.Reactor.Docking) so
  apps' source references are unchanged. Per tracking §0: "the native
  rewrite extends src/Reactor/ proper (no separate assembly at P2 exit)."

* Add Phase 2 additive API surface (no P1 breaking changes per §1.3):
  - Document, ToolWindow sealed records — §2.8 / §5.3.1 (separate roles,
    distinct default permissions, both inherit DockableContent).
  - Document<TState> generic — §2.9 / §5.3.2.
  - CanFloat / CanMove on DockableContent base — §2.14 / §5.3.8.
  - IDockLayoutStrategy interface — §2.13 / §5.3.6.
  - DockHostModel internal source-of-truth, with UI-thread-affined
    mutators (Dock/Float/Hide/Show/Close/Activate/PinToSide) and
    Descendants()/AllContent() enumeration — §2.16 / §5.3.10.
  - DockSide enum, FloatingDockWindow record, PendingMutation algebra.
  - 15 cancellable lifecycle event-arg classes for the OnX Action props
    on DockManager — §2.12 / §5.3.5.
  - DockManager.LayoutStrategy prop and all 15 OnX event props — wired
    additively; IDockBehavior stays for one-release source compat.
  - DockPaneInfo struct + DockPaneState enum — §2.17 / §5.3.11.
  - IDockLayoutMigration interface — §2.11 / §5.3.4.

* DockableContent refactored from a sealed positional record into an
  open record with init-only properties + custom positional constructor.
  Preserves the P1 closed-shape `new DockableContent(title, ...)` source
  surface while letting Document / ToolWindow inherit and add their own
  permission defaults via object-initializer syntax.

Build: warnings-as-errors across the solution; full test suite green
(27 docking tests pass).

Spec 045 §5 / tracking §2.8, §2.9, §2.11, §2.12, §2.13, §2.14, §2.16
(API surface only — full wiring lands in subsequent commits).

* test(045): unit coverage for P2 API surface — types, model, events, strategy, migration

Adds 43 new unit tests across the Phase 2 additive API:

* DocumentToolWindowTests — Document defaults (CanClose=true, CanPin=false),
  ToolWindow defaults (X-hides, side-pinnable, auto-hide), Document<TState>
  typed-state round-trip, CanFloat/CanMove permission flags on the
  DockableContent base, with-expression preservation across the hierarchy.

* LifecycleEventTests — every *ing event arg inherits DockCancelEventArgs;
  every *ed arg does NOT; Cancel defaults to false; required-init args
  carry their payloads; DockManager exposes all 15 OnX props default-null.

* DockHostModelTests — read surface (Descendants() walks depth-first,
  AllContent() unions docked/side/floating); every mutation queues the
  matching PendingMutation record; null-content rejection; off-owner-
  thread mutations throw InvalidOperationException (spec 045 §8.10
  UI-dispatcher-affined contract).

* LayoutStrategyTests — default-interface-method no-ops for
  IDockLayoutStrategy; example error-pane-routing strategy short-circuits
  via PinToSide; DockManager.LayoutStrategy prop carries the assignment.

* LayoutMigrationTests — IDockLayoutMigration FromVersion/ToVersion shape;
  in-place + replacing JSON transformations.

All 70 docking tests pass (was 27). Spec 045 / tracking §2.8, §2.9,
§2.11, §2.12, §2.13, §2.14, §2.16.

* feat(045): layout JSON v2 reader/writer + migration ladder (P2 §2.7, §2.11)

Phase 2 docking persistence (spec 045 §5.4 / §8.9 / §8.10 / §8.11):

src/Reactor/Docking/Persistence/

* DockLayoutJson.cs — schema v2 DTOs:
  - DockLayoutDoc carries $schema marker, root tree, four side strips,
    floating-window state, active-pane key.
  - DockLayoutNode is the tagged-union node ("split" / "tabGroup" / "pane")
    with kind discriminator + per-kind payload + universal dimension hints.
  - DockLayoutPane carries title, key, role discriminator ("document" /
    "toolWindow" / "dockableContent"), opaque state envelope, per-pane
    permission overrides (only non-default fields are emitted), previous-
    container hint.
  - DockLayoutFloatingWindow carries id, screen-coord position + size, panes.
  - DockLayoutJsonContext = source-gen JsonSerializerContext (AOT-clean
    parsing per §8.9: no reflection at runtime).

* DockLayoutSerializer.Save/Load — public reader/writer:
  - Save emits invariant-culture JSON (System.Text.Json default — verified
    by save-de-DE/load-en-US selftest per §8.8).
  - Load returns a non-null DockLayoutLoadResult; safe-fallback on
    corruption (never throws on the load path per §8.10).
  - Security limits: 1 MB max size, depth 32 (JsonReaderOptions.MaxDepth
    + JsonDocumentOptions.MaxDepth) — exceeded inputs fall back.
  - Schema absence (default 0) routes to fallback so apps can detect "no
    persisted layout yet" and prefer the declarative Layout prop.
  - Role-default-aware permission emission: a Document with CanClose=true
    omits the field; a ToolWindow with CanHide=false emits it. Output
    file size stays close to "structure + identity only" per spec §8.9.

* DockLayoutMigrationRegistry — ordered migration ladder:
  - Built-in v1→v2 migration synthesizes keys from titles per §5.4.4.
  - DetectSchema treats absent $schema as v1 (P1's vendored format).
  - TryUpgrade walks fromVersion → toVersion edges greedily; reports
    clean failure on broken chains; forward-tolerant for newer-than-known
    schemas per §8.11.
  - Safety counter prevents accidental cycles.

Bug fix in Document/ToolWindow: the `new bool CanClose { get; init; } = …`
declarations were hiding the base property without changing the value
read through a DockableContent reference. The serializer reads via the
base type, so Document instances appeared to have CanClose=false. Fixed
by removing the `new` declarations and setting the base init properties
through the parameterless ctor body — both reference types now see the
intended role default.

tests/Reactor.Tests/Docking/LayoutSerializerTests.cs (27 new tests):
- Round-trip: Document, ToolWindow, DockSplit, DockTabGroup, sides,
  floating windows, active-key, persistence-state envelope.
- Permission emission: defaults omitted, overrides emitted.
- Security limits: oversize + deep-nest + corrupt + empty + missing-
  schema + unknown-node-kind all fall back without throwing.
- Invariant culture round-trip under de-DE save / en-US load.
- Migration registry: detect-schema; v1→v2 synthesizes keys; ladder
  chains custom v2→v3 onto built-in; missing chain + forward-tolerance
  + same-version short-circuit.
- 200-pane load latency regression guard (250ms threshold absorbs CI
  jitter; perf bench enforces the §8.1 50ms budget).

All 97 docking tests pass.

* feat(045): PreviousContainer tracker + DockContext property hooks (P2 §2.15, §2.17)

§2.15 — PreviousContainerTracker (spec 045 §5.3.9):
Internal ConditionalWeakTable<DockableContent, container-ref> tracking the
last container each pane was inside. Hide → re-show routes the pane back
to its remembered container instead of the default insertion point.
Reference-equality keying means distinct pane instances with the same
logical Key get independent history (correct — history attaches to the
instance, not the identity). Bookkeeping decays with the pane reference.

§2.17 — DockContexts + DockHooks (spec 045 §5.3.11):
Six Context<T> slots split by concern (Host, ActivePaneKey, Pane,
PaneState, LayoutSnapshot) so each hook subscribes to the smallest slice
that can answer the question:

  • ctx.UseDockHost()       → DockHostModel? (or null outside any host)
  • ctx.UseActivePaneKey()  → object?       (selector-style re-render)
  • ctx.UseIsActivePane()   → bool          (transitions only)
  • ctx.UsePane()           → DockPaneInfo  (throws outside pane subtree)
  • ctx.UseDockState()      → DockPaneState (per-pane transitions)
  • ctx.UseDockLayout()     → DockLayoutSnapshot? (devtools wide-net)

The hooks are extension methods on RenderContext — call-site reads
`ctx.UseDockHost()`, symmetric with UseColorScheme. The DockLayoutSnapshot
record carries the full read-only snapshot (root / sides / floating /
active) for devtools and the optional MCP introspection (§2.26).

Tests (22 new, 119 docking tests total):
- DockHooksTests: defaults outside any host; provided values resolve via
  ContextScope; UsePane throws outside a pane; UseIsActivePane key
  comparison; two-host process isolation (§5.3.11 last bullet —
  "components inside hostA resolve to hostA"); null-arg defensive checks.
- PreviousContainerTests: Set/Get/Clear cycle; distinct instances with
  shared logical Key have independent histories; Set twice overwrites;
  null-arg defensive checks; hide→show scenario from §5.3.9.

Wiring into the live renderer (so context slots actually receive values
from the model) happens with the native UI pipeline (§2.16 integration,
tracked under task #4).

* docs(045): P2 tracking checkpoint + CHANGELOG + sequence selftests

* docs/specs/tasks/045-docking-windows-implementation.md — Phase 2
  progress checkpoint inserted at the top of P2; §2.7, §2.8, §2.9,
  §2.11–§2.17 individual checkboxes updated to reflect the API surface
  + headless-test landings. Items requiring the native UI pipeline
  (§2.1–§2.6) are explicitly annotated as gated on that work.

* CHANGELOG.md — "Spec 045 Phase 2 — Docking (foundation)" + "Layout
  JSON v2 persistence" entries describing the public-API extensions
  (Document/ToolWindow/Document<TState>; CanFloat/CanMove on the base;
  IDockLayoutStrategy; the 15 cancellable lifecycle event-arg classes
  + matching Action<TArgs> props on DockManager; IDockLayoutMigration
  registry; DockHostModel + queue; DockContexts + DockHooks;
  PreviousContainerTracker), the serializer (Save/Load with security
  limits, invariant culture, role-default-aware permission emission,
  source-gen JsonSerializerContext for AOT cleanliness), and the
  forward-tolerance behavior of the migration ladder.

* tests/Reactor.Tests/Docking/DockHostModelSequenceTests.cs — the
  §2.27 layout-model fixture matrix: Dock/Float/Close ordering;
  Hide/Show round-trip; Activate after Dock; commingled multi-pane
  mutation sequence; read surface independence from mutation queue;
  the §5.3.6 error-pane strategy routing example end-to-end; and the
  §5.3.9 hide→show container-identity preservation combining the
  model with the PreviousContainerTracker.

Test count: 126 docking unit tests pass. Full solution build is clean
(0 docking-attributed warnings, warnings-as-errors).

Phase 2 foundation layer is at a natural checkpoint. Native UI
rewrite (§2.1–§2.6) and the §2.20+ NFR matrix that depends on it
remain. §2.29 human review gate pending.

* feat(045): split + size constraint solver (P2 §2.1)

DockSplitterControl: WinUI partial Grid with 8 DIP visual / 16 DIP hit,
pointer drag, focus, arrow-key resize, per-direction cursor; emits a
signed delta + isFinal flag on each gesture.

DockSplitSolver: pure ratio-clamping math. ApplyDelta projects pointer
deltas into the constrained interval [max(leadingMin, pair-trailingMax),
min(leadingMax, pair-trailingMin)] for the moved pair, leaves untouched
panes alone, normalizes back to sum=1.0. Normalize/EqualShare cover the
persisted-JSON and bootstrap paths.

DockSplitRenderer.Render: composes a DockSplit + per-child Element +
ratios into a FlexElement with splitter handles interleaved between
adjacent panes. Flex-grow drives the ratio rendering on FlexPanel.

DockSplitterElement: internal Reactor element with reconciler
registration.

23 new tests (solver math + renderer shape). Total docking tests:
126 → 149 passing.

Spec 045 §2.1 — exits open-checklist for DPI hookup (lands with §2.16
end-to-end wiring).

* feat(045): tab-group renderer + native reconciler hand-off (P2 §2.2, §2.16)

DockTabGroupRenderer.Render: maps DockTabGroup → TabViewElement.
Documents → TabViewItemData with title+content+IsClosable. SelectedIndex
clamps to [0, count); tab-close callback receives the underlying
DockableContent (caller threads to OnDocumentClosing).

DockHostNativeComponent: Component<DockHostNativeProps> that walks
DockManager.Layout and emits the FlexElement / TabViewElement tree.
DockSplit ratios live in a ConditionalWeakTable keyed by node reference;
splitter deltas resolve through DockSplitSolver.ApplyDelta and trigger
re-render via UseState. Bootstrap ratios honor explicit Width/Height
hints from the model; otherwise EqualShare.

DockSideStripRenderer: minimal LeftSide/TopSide/RightSide/BottomSide
anchor strips wrapped around center. Full popup expansion lands in §2.5.

DockingNativeInterop.Register: opt-in P2 registration. Mounts a Border
whose Child is reconciled from a ComponentElement<DockHostNativeProps>;
update reconciles with new props; unmount cleans up the child subtree.

Showcase: REACTOR_DOCK_XAML=1 flips back to the P1 wrapper for A/B
review; default is now native.

6 new tab-group tests. Total docking tests: 149 → 155 passing.

* fix(045): splitter element handler storage + native smoke fixtures

Wiring the ResizeDelta handler through a DependencyProperty failed on
mount: WinRT marshalling raises TargetInvocationException trying to
synthesize an IID for the closed generic delegate
EventHandler<DockSplitterDeltaEventArgs> when SetValue creates a CCW.
Switch to a per-control ConditionalWeakTable — never crosses the COM
boundary.

Add two §1.7-style smoke fixtures driving the native renderer through
the host-app harness:
  NativeDocking_TwoPaneMountUpdateUnmount — DockSplit + leaf content;
    asserts FlexPanel mounts, content text renders, content updates
    survive, unmount cleans up.
  NativeDocking_TabGroupRendersToTabView — DockTabGroup; asserts
    TabView mounts with N tabs and the active body rendered.

All four smoke fixtures green:
  Docking_TwoPaneMountUpdateUnmount       (XAML path, P1)  ✓
  Docking_KeyedPanePreservation           (XAML path, P1)  ✓
  NativeDocking_TwoPaneMountUpdateUnmount (native, P2)     ✓
  NativeDocking_TabGroupRendersToTabView  (native, P2)     ✓

* docs(045): P2 native UI checkpoint — renderer testable end-to-end

* feat(045): pixel-accurate splitter + live model + DockContext mount (P2 §2.16, §2.17)

DockSplitterControl.GetHostExtent: walks to the parent FlexPanel and
reads ActualWidth/ActualHeight along the split axis. Threaded through
DockSplitterDeltaEventArgs.HostExtentDip → DockSplitterElement.OnDelta
→ DockSplitRenderer.Render → DockHostNativeComponent. The renderer now
passes the real host extent as totalDip to DockSplitSolver.ApplyDelta
instead of a synthetic 1000-unit; pointer-pixel deltas resolve into
ratio space against the actual layout, with a < 1 DIP guard for the
unlaid-out frame.

DockHostNativeComponent: cache a stable DockHostModel via UseRef so its
identity is preserved across renders (UseDockHost consumers don't churn
on layout-prop changes). Each render mirrors Layout/sides/ActiveDocument
from the controlled element into the model. Side slots filter to
ToolWindow (the typed model surface per §5.3.10); bare DockableContent
in side slots is silently dropped (§2.8 deprecates that shape).

DockContext registration on mount (§2.17): the rendered subtree is
wrapped with .Provide(DockContexts.Host, model), ActivePaneKey, and
LayoutSnapshot. Per-pane Content is further wrapped with
.Provide(DockContexts.Pane, info) + .Provide(DockContexts.PaneState,
Docked) so UsePane / UseDockState resolve correctly inside pane bodies.

New smoke fixture NativeDocking_DockContextHooksResolveOnRealMount
mounts function components inside two tabs and asserts:
  • UseDockHost returns a non-null DockHostModel
  • UsePane returns identity matching the enclosing leaf (Title + Key)
  • UseIsActivePane flips when DockManager.ActiveDocument changes

Total native fixture assertions: 16 (was 10). Unit tests still 155
green.

* feat(045): renderer visual fidelity — pane padding, compact/bottom tabs

DockTabGroupRenderer: maps DockTabGroup.CompactTabs onto
TabViewWidthMode (Compact vs Equal) and TabPosition.Bottom onto a
ScaleY=-1 RenderTransform with per-tab counter-scale on selection
(translation of WinUI.Dock's DocumentGroup.xaml flip trick). The
counter-scale subscribes to SelectionChanged so dynamically-added
tabs pick up the transform on first show.

DockHostNativeComponent.WrapLeafWithPaneContext: 16-DIP content
padding around each pane body (Document.xaml default in upstream;
matches the P1 visual rhythm).

Fix the §2.17 hook fixture: build the docking tree inside the mount
lambda each call so leaf content elements are fresh-each-render.
Same-reference FuncElements hit the reconciler's structural-equality
short-circuit before HasConsumedContextChanged runs, so context
propagation to a leaf consumer requires fresh element refs. (This is
the Reactor convention — the showcase already builds content inline
inside Render, but the fixture was caching a Func outside Mount.)

* feat(045): side popup expansion (P2 §2.5)

DockSideStripRenderer: side-pin buttons toggle a popup overlay. State
lives in DockHostNativeComponent (UseState<object?>); each render
threads the expanded key + setter through to the strip composer. When
expanded, the renderer overlays a PopupElement over the outer layout
via a Grid; when collapsed, the popup unmounts entirely. Matches
upstream WinUI.Dock's flyout-per-expansion pattern.

Two WinUI Popup gotchas encountered + fixed:
  • Popup ignores IsOpen=true while detached from the visual tree.
    Solution: PopupElement.IsOpen starts false; a Setter wires a
    Loaded handler that flips IsOpen=true once XamlRoot is available.
    (Same pattern upstream's SidePopup.Show() uses.)
  • Popup with IsLightDismissEnabled=true synchronously fires Closed
    on open when no focus owner exists (headless harness path),
    bouncing the expanded state back. Light-dismiss is disabled for
    P2; the popup dismisses via repeat-click on the side button.
    Focus arbitration + true light-dismiss land with §2.4.

Pane context envelope (DockContexts.Pane, PaneState.AutoHiddenExpanded)
flows into the popup body so UsePane / UseDockState resolve inside an
auto-hidden popup too.

NativeDocking_SidePopupExpandsAndCollapses fixture asserts:
  • Strip button renders with the pane title.
  • No open popup initially (VTH.GetOpenPopupsForXamlRoot probe).
  • Click expands → 1 open popup.
  • Repeat-click collapses → 0 open popups.

Total native fixture assertions: 16 → 20. Full docking smoke: 32 ok,
0 failed.

* feat(045): floating windows as real Reactor windows (P2 §2.6)

DockFloatingWindow.Open(pane): opens a top-level Reactor Window via
ReactorApp.OpenWindow with the pane Content as the window root. The
content is wrapped with the same DockContext envelope used by docked
panes but with PaneState=Floating so UseDockState resolves correctly
inside the floating window.

DockFloatingTracker: process-global set of open floating windows. The
docking pipeline subscribes via Open(); the window's Closed event
unregisters. Snapshot() / Count surface for fixture assertions and for
the manager's on-unmount cleanup pass.

Smoke fixture NativeDocking_FloatingWindowOpensAsRealWindow asserts:
  • Open returns a non-null ReactorWindow.
  • The tracker count increments by exactly 1.
  • The tracker snapshot contains the returned window.
  • Closing the window drops it back to the baseline.

Important harness note: the fixture pins ShutdownPolicy=Explicit for
the duration of the test. The AppTests.Host harness opens its primary
WinUI Window outside ReactorApp's registry, so a fixture-spawned
floating window otherwise becomes ReactorApp.PrimaryWindow and trips
ShutdownPolicy.OnPrimaryWindowClosed when the test closes it (closing
the actual harness window mid-pump → COMException). Documented in
fixture comments.

Total native fixture assertions: 20 → 24. Full docking smoke: 36 ok,
0 failed.

Deferred items (with cross-refs in the spec):
  • Custom title-bar slot (IDockAdapter.GetFloatingWindowTitleBar)
  • Multi-display restore clamp (lands when JSON-saved bounds read)
  • Explicit Border-host pre-warm for HWND cold-create perf

* fix(045): disable broken TabPosition.Bottom ScaleY flip — render top-tabs for now

Showcase Scene A rendered three of four bottom-tab groups upside-down
(text flipped, tab strip on top, close-button on wrong end). My
counter-scale via TabView.SelectionChanged + ContainerFromIndex never
matched the actual containers (TabView adds TabViewItem instances
directly to TabItems; ContainerFromIndex is for virtualization).
Upstream WinUI.Dock counter-scales BOTH the Header (Tab grid inside
DockTabItem.xaml) and the Content (Border inside DockTabItem.xaml),
which only works because DockTabItem is itself a TabViewItem subclass
with named template parts.

Until a Reactor-native DockTabItem subclass replaces the shared
TabViewElement, bottom-position groups render as top-position. Tabs
read upright with close buttons on the right; visual position no
longer matches upstream's bottom strip. Tracked as a follow-up in the
§2.2 checklist.

* fix(045): splitter wiring — path-keyed ratios + incremental delta + state separation

Three bugs in the §2.1 splitter pipeline surfaced when the showcase
finally hit a real drag:

1. UseState<ConditionalWeakTable> never re-rendered. The setter ran
   EqualityComparer<T>.Default which sees the same reference and skips
   the re-render entirely. Switch to UseRef for the store +
   UseReducer<int> as the re-render trigger.

2. The cumulative-from-origin pointer delta compounded against the
   already-shifted ratios — by the tenth PointerMoved the leading
   pane was driven past its 60 DIP minimum clamp and stuck there.
   Reset _captureOrigin = p at the end of each PointerMoved so the
   delta is incremental per frame.

3. ConditionalWeakTable<DockSplit, double[]> keyed by node reference
   orphaned every entry on every re-render — apps reconstruct
   `Layout = new DockSplit(…)` inside Render(), so the reference
   changes each frame and ratios snapped back to bootstrap every
   commit. Switch to Dictionary<string, double[]> keyed by tree-
   position path ("0", "0/0", "0/1", …). Stable across re-renders.

New programmatic-drag fixture
NativeDocking_SplitterProgrammaticResizeAcrossRenders mounts an
IDE-style nested layout (1 row splitter + 2 column splitters), fires
ResizeDelta directly via RaiseResizeDeltaForTest, and asserts:
  • initial ratios are equal-share;
  • a single drag shifts the leading child;
  • a second drag on the same splitter cumulates (no snap-back);
  • dragging one column splitter does NOT affect the other;
  • dragging a column splitter does NOT affect the row splitter;
  • after a full re-mount (fresh DockSplit instances), ratios survive.

All 11 assertions green. Pipeline is correct end-to-end. Real-pointer
drag in the showcase still fails — that bug is in the pointer-capture
path, not the ratio/render path.

* wip(045): visual demo fixture + diagnostics for splitter detach investigation

The visual demo fixture (SplitterProgrammaticVisualDemo) drives the
splitters with paced ~400 ms delays so the resize is observable. All
assertions pass — the render→reconcile→FlexPanel pipeline works.

However, the Loaded/Unloaded log proves every drag-step DETACHES and
re-ATTACHES all three DockSplitterControls. This is why pointer
capture is lost during a real drag: WinUI fires PointerCaptureLost on
the un-parented control, and the user sees 'moved once then stuck'.

Diagnostics added to MountFlex/UpdateFlex confirm UpdateFlex is
running (not MountFlex). The detach happens DURING UpdateFlex even
though my registered DockSplitterElement update returns null (which
should signal 'patched in place, no replacement').

Still investigating where the detach is sourced.

* feat(045): splitter pointer-drag direct-mutation path (P2 §2.1 stable)

Splitter drag in the native renderer was breaking through several
layers of subtle pointer / layout / re-render interaction. The fix
takes a WPF GridSplitter-style direct-mutation approach during drag,
bypassing Reactor's reconciler entirely until the drag commits.

What changed in DockSplitterControl:

1. Snapshot the pair at PointerPressed
   SnapshotPairAtCapture() reads leading + trailing ActualWidth/Height
   along the split axis and stores the pair total + current grow split.
   Mutations during the drag use this fixed snapshot, so layout-commit
   lag between events doesn't make the splitter read stale measurements
   and produce sub-pixel cursor drift ('shimmy').

2. Direct Width/Height writes during drag
   ApplyAbsoluteGrowFromCapture() sets leading.Width / trailing.Width
   (or Height for Rows direction) to the snapshotted pair sizes shifted
   by the cumulative pointer delta. Grow attached is forced to zero so
   Yoga uses Width as basis without an extra-space contribution. The
   earlier ratio-via-Grow approach moved the splitter only ~10% of the
   cursor delta when a sibling pane had an intrinsic basis (TabView
   content, or an app-supplied Width:240 hint) — Yoga's grow + basis
   interaction made the math non-linear.

3. Perpendicular-axis pin on capture
   The splitter's parent FlexPanel gets its perpendicular dimension
   pinned (panel.Height for Columns, panel.Width for Rows). Without
   this, mutating pane sizes on the drag axis reflowed inner TabView
   content, shifted topInner's measured Height, and made the outer
   Vertical FlexPanel redistribute — visibly shrinking the OTHER row
   during a column drag.

4. Single ResizeDelta on isFinal
   Per-event ResizeDelta firing accumulated cumulative-from-origin
   deltas in the host's ratio model and produced 10x+ overshoot at
   commit. Drag-end now fires one event with the final cursor delta
   so the model catches up to the visual once.

5. Keyboard arrow keys
   Arrow keys use the same SnapshotPairAtCapture + ApplyAbsoluteGrow
   path for a single discrete step, plus Focus(FocusState.Keyboard)
   reassertion after the host's re-render lands.

6. handledEventsToo=true for KeyDown
   WinUI's keyboard-nav engine claims arrow keys before the regular
   KeyDown handler runs, moving focus away. AddHandler with
   handledEventsToo lets us receive the event even after the nav
   engine has marked it Handled, so we can override focus movement.

DockManager surface:

- SplitRatios escape hatch (Dictionary<string, double[]>) lets apps
  share the ratio store with the renderer for slider-driven layouts
  and tests. Used by the new Scene G in the dock-showcase to confirm
  the render pipeline works end-to-end via a path that bypasses
  pointer events entirely.

dock-showcase Scene G — Slider Resize:
- Three sliders drive the outer row / top columns / bottom columns
  ratios directly via SplitRatios.
- Splitter handle is more visible (50% opaque gray vs original 20%)
  so the drag affordance is discoverable.
- Slider StepFrequency=0.01 for smooth continuous values.

All docking smoke fixtures green: 36 ok / 0 failed.
All docking unit tests green: 155 ok / 0 failed.

* feat(045): drop-target overlay primitive (P2 §2.3)

Reactor-native replacement for WinUI.Dock's DockTargetButton +
Preview.xaml.cs. 9 targets (5 split + 4 edge) at minimum 44×44 DIP
per WCAG 2.5.5, hover preview rect, focus + arrow-key nav, reduced-
motion gate. Gated by DockManager.ShowDropTargets; the §2.4 drag
pipeline flips the flag mid-gesture once that lands.

20 new unit tests in Reactor.Tests/Docking/Native/ cover preview-
rectangle geometry, the spatial arrow-key focus graph, and per-
target AT names. NativeDocking_DropTargetOverlayShowsAndDismisses
smoke fixture exercises mount → confirm → unmount end-to-end.

AT names are inline English pending §2.21 Loc generator.
Overlay z-priority slot (spec 036 §11 enum) deferred — §11 is shell
integration, not overlay priority; the enum doesn't exist yet.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): showcase Scene H — drop-target overlay demo

Exercises the §2.3 overlay end-to-end without the §2.4 drag pipeline.
"Show drop targets" flips DockManager.ShowDropTargets; hovering each
target updates a "Hovered:" label and paints the preview rect;
clicking confirms and the scene appends a new pane at the chosen
target so the layout visibly changes. Esc dismisses.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): drag pipeline + tab tear-out + dock-by-drop (P2 §2.4)

End-to-end tab-drag → drop-target overlay → layout mutation on
the Reactor-native renderer. Replaces upstream WinUI.Dock's static
GUID→object payload table with object-ref DockDragSession state
(spec §8.9 / §4.6). WinUI TabView drag events are surfaced on
TabViewElement (OnTabDragStarting / OnTabDragCompleted); the host
component flips the §2.3 overlay during drag, applies a
DockLayoutMutator transform on confirm, opens a floating window
on drop-outside, and routes Esc through a window-level key listener
since WinUI's DropResult can't distinguish Esc-cancel from drop-
outside on its own.

Fixes landed in iteration:
- AllowDrop + DragOver/Drop on the overlay (PointerMoved doesn't
  fire on external elements during a tab drag).
- Populate TabDragStarting args.Data with a sentinel so external
  AllowDrop targets accept the drop (the object-ref session is
  the real payload; sentinel only unblocks WinUI's acceptance).
- Handle TabDragCompleted when args.Tab has been yanked from
  TabItems (idx == -1) — fall back to the active session's source
  so dragActive state always clears.
- Defensive: when dragActive is true but the session is gone,
  schedule a state clear via DispatcherQueue so the overlay can't
  get stuck "locked on".
- Wrap dropped pane in a single-doc DockTabGroup so it lands with
  a tab strip rather than as a bare leaf.

23 new unit tests + NativeDocking_DragSessionConfirmMutatesLayout
smoke fixture. Keyboard-initiated move (Ctrl+Shift+M) and the
standalone .OnPan recognizer remain on the §2.10 / follow-up list.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(045): drag/drop matrix fixture + splitter resize fix

17-scenario fixture under NativeDockingDragDropMatrixFixture.cs
exercises every DockTarget + sequential drag accumulation + nested-
split shape preservation + cancel-leaves-tree-unchanged + last-pane-
out invariants + post-splitter-drag window resize + idempotent drags
+ row-then-column ratio preservation. Each fixture begins a
DockDragSession + calls overlay.ConfirmTargetForTest and asserts
the resulting visual-tree shape.

Splitter resize: RestorePairToGrow now converts inline Width/Height
back into FlexPanel.Grow values and clears the inline sizes + the
perpendicular pin on release. The pre-fix behavior froze panes at
absolute DIPs so window resize left gaps. Matrix M15 surfaces the
regression (panel shrunk 784→584, leading pane stayed at 463 before
the fix; after fix shrinks proportionally to 326). Also wires the
fix into the keyboard-nudge path so arrow-key resize behaves the
same as pointer drag.

SimulatePointerDragForTest is now a faithful end-to-end pointer
simulation (snapshot + apply + release + fire ResizeDelta) so the
matrix exercises the host's ratio-store sync + re-render pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): JSON viewer + jump-back fix + IDE-layout matrix

Showcase Scene A grows a "Layout JSON" inspector panel on the right
that re-serializes the live layout via DockLayoutSerializer.Save on
every drag/drop and shows the split-ratios dict on every splitter
release. New DockManager event hooks back the live introspection:
- OnLiveLayoutChanged(DockNode?) fires after drag/drop layout
  mutations so apps can mirror the host's effective layout (for JSON
  view, undo, telemetry).
- OnSplitterDragCompleted() fires after the host's ratio store
  updates so externally-owned SplitRatios dicts surface ratio shifts.

Splitter "jump back" fix: GetHostExtent now returns the EXTENT YOGA
DISTRIBUTES (parent extent minus all sibling splitter widths) so the
solver and the renderer agree on the DIP budget. Pre-fix the solver
saw N+16 DIP and Yoga distributed N, leaving ~handle*ratio DIP of
visible snap on release.

New matrix scenarios (Docking suite now 136 ok / 0 not ok):
- M18 SplitterReleaseNoVisibleJump: pair fills panel - splitter (±2
  DIP tolerance), witnesses the jump-back fix.
- M19 IdeLayoutResizeAndContainerResize_NoControlChurn: IDE-style
  Vertical{Horizontal,Horizontal} tree, drives column splitter →
  asserts top columns shift + outer untouched; row splitter →
  asserts outer shifts + COLUMN RATIOS PRESERVED (the
  row-resets-columns regression); container resize → asserts all
  ratios unchanged + panes redistribute. Crucially asserts SAME
  INSTANCE identity for every splitter, FlexPanel, and TabView at
  each step — no control churn.
- M20 SceneRerenderPreservesDockHostControls: exercises the scene-
  level Component re-render path (the one that triggers
  DockingNativeInterop.update, not just the host's internal tick)
  and asserts controls stay alive across repeated re-renders.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): docking operation log + replay scrubber + splitter root-cause fix

Two related landings driven by a stubborn splitter snap-back regression
in the showcase that the test matrix couldn't reproduce.

## Operation log (long-lived diagnostic; spec §2 keeps through P1–P4)
- DockOperationLog (1K ring buffer, Debug.WriteLine on append, cursor-
  based replay API). Op kinds: Mount, DragStart/Hover/Confirm/Cancel/
  TearOut, SplitterResize, SplitterTrace (intermediate splitter PRESS/
  MOVE/RELEASE/SOLVE), LayoutChange, Note.
- Opt-in via DockManager.OperationLog. Host wires every drag/drop +
  splitter event handler to record post-state snapshots.
- DockSplitterElement.DiagnosticSink threads pointer-event trace
  strings up through the host's LogOp helper so cursor tracking +
  inline-write math is fully visible.
- Showcase Scene A: Reset/Rewind/Play/Reset-log/Copy-log buttons next
  to the existing JSON viewer. Copy-log puts the full ring on the
  clipboard for pasting into bug reports.

## Splitter pin-both-axes fix
The trace from the user surfaced the snap-back root cause:
- pre-drag panes were unequal (leading=492.8, trailing=223.2, pair=716)
- during drag, panel measured itself to fit children's inline widths
  (panel.ActualWidth=732, splitter tracks cursor perfectly)
- on release, RestorePairToGrow cleared inline widths, panel re-
  measured to parent's allocation (panel.ActualWidth=585.6)
- the solver then received hostExtent=569.6, computed ratios in that
  shrunk space, and Yoga rendered leading=91 — the visible jump.

Fix in SnapshotPairAtCapture:
- pin panel.Width AND panel.Height (was only perpendicular axis), so
  the panel can't grow with the children's inline widths during the
  drag — the panel stays at its parent-allocated size throughout.
- _pairDipAtCapture now sourced from GetHostExtent (panel
  distributable space) instead of leading.ActualWidth + trailing
  .ActualWidth (children measurement, which can overflow).
- _leadingDipAtCapture now computed from grow ratio in panel space.

RestorePairToGrow clears BOTH axes (was perpendicular only) to match.

Drops the giant try/catch around CopyLogToClipboard per review — if
clipboard SetContent fails we want to see the stack.

198/198 unit tests pass; 136/136 Docking self-host checks pass.
Brain dump documenting the full saga at C:\temp\spec-045-docking-
braindump.md for future agents picking this up.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): splitter cursor tracking — basis:0 + pure-grow drag + MeasureFunc clamp

Three layered fixes that together make the Phase 2 docking splitter
track the cursor 1:1 in real WinUI pointer input (Scene A IDE layout
in samples/apps/dock-showcase), matching P1's WinUI.Dock behavior.

DockSplitterControl: ApplyAbsoluteGrowFromCapture now writes
FlexPanel.Grow directly during drag instead of inline Width/Height.
Single source of truth eliminates the mode-switch (inline-Width
during MOVE → Grow on RELEASE) that produced the snap-back on drag
release. SnapshotPair no longer pins panel.Width/Height; the panel's
parent allocation is stable throughout the drag. RestorePairToGrow
reduced to defensive ClearValue cleanup.

DockSplitRenderer: each pane is now composed with Flex(grow, shrink:1,
basis: 0) — equivalent to CSS `flex: <ratio> 1 0%` and to WinUI Grid's
`GridUnitType.Star(N)`. Without explicit basis 0, panes default to
basis auto = intrinsic content size; for content-heavy panes (TabView
with body) the content fills the panel and grow distributes nothing.

FlexPanel.cs: MeasureFunction now clamps the returned main-axis size
to the requested size when wMode == YogaMeasureMode.Exactly. CSS
Flexbox spec §9.7-§9.8: when flex layout has resolved an item's used
size, MeasureFunc must confirm that size and not report something
larger. Pre-change, WinUI controls that ignore Measure constraints
(notably TabView with content wider than its slot) propagated their
intrinsic content size back to Yoga, overriding flex allocation. The
clamp is the CSS-compliant fix and brings FlexPanel into the
`min-width: 0` mode of the spec (the `min-width: auto` mode is
tracked separately as #364).

Tests: all 198 Docking unit tests, all 326 Flex unit tests, all 136
Docking selftests, all Flex selftests pass.

Refs #364 (FlexPanel CSS compliance follow-up)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): keyboard chords §2.10 — PageUp/Down + F4/W + Ctrl+Shift+M

Wire three chord families on the Reactor-native dock host via a new
DockChordBridge (ConditionalWeakTable keyed by DockManager element)
so mount-time KeyboardAccelerators on the host Border can pick up
live chord delegates from the component each render — no extra layout
layer. First attempt wrapped via CommandHostElement; that Grid wrapper
shifted M19's outer-FlexPanel ActualWidth and was abandoned.

- Ctrl+PageUp / Ctrl+PageDown — cycle the active group's tab, wraps
  at both ends. Fires OnActiveContentChanged. Targets the group
  containing `activePaneKey ?? Manager.ActiveDocument.Key`.
- Ctrl+F4 / Ctrl+W — close active document via cancellable
  OnDocumentClosing → OnDocumentClosed → OnLiveLayoutChanged.
- Ctrl+Shift+M — toggle the §2.3 drop-target overlay into keyboard
  mode; active pane is the implicit source. Arrow + Enter / Esc
  inherited from §2.3's focusable overlay; chord repeat dismisses.

Host component now tracks a path-keyed selectedIndexStore (mirrors
the §2.1 ratio store) plus an activePaneKey UseState so chord cycling
sticks across re-renders. activeKey resolution is `appActiveKey ??
activePaneKey` — controlled-input shape preserved (apps that pin
ActiveDocument still win for UseIsActivePane), matching the
DockHooks_IsActivePane_FlipsOnActiveChange regression test.
RenderTabGroup applies selectedIndexStore overrides but does NOT
wire onSelectedIndexChanged (a non-null callback fires spuriously on
TabView mount and broke SidePopup_OpensOnClick).

Deferred: Ctrl+Tab pane navigator overlay, Alt+F7 hidden-pane picker,
UIA LiveSetting=Polite announcements, spec-027 configurable binding.

Tests: 16 new unit tests for the pure helpers (FindGroupContainingKey,
FindFirstGroup, CycleIndex, BuildChords) + DockChordBridge round-trip.
214/214 Docking unit tests pass; all Docking selftests pass.
Human-validated 2026-05-21 against Scene A.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): strategy dispatch §2.13 + permission gating §2.14

§2.13 — DockHostModel.Dock now dispatches into IDockLayoutStrategy
when the host component mirrors DockManager.LayoutStrategy onto the
model each render. BeforeInsertDocument/BeforeInsertToolWindow runs
first, subtype-routed via pattern match; returning true short-circuits
the default DockOp. Returning false queues the default mutation and
then fires AfterInsertDocument/AfterInsertToolWindow so apps can layer
adjustments on top. Bare DockableContent (P1 source-compat shape)
bypasses the typed hooks. Six new unit tests cover the
no-strategy/short-circuit/pass-through/subtype-routing/bare-bypass
matrix.

§2.14 — Permission gating in the drag pipeline:
- HandleTabDragStarting refuses drag start when CanMove=false (logs
  a Note op; no DockDragSession.Begin).
- HandleTabDragCompleted refuses tear-out when CanFloat=false (session
  ends; layout untouched).
- Drop-target OnConfirm re-checks CanMove on the source pane so the
  Ctrl+Shift+M keyboard mode can't drop a pinned pane that turned
  read-only between mode-enter and confirm.
- EnterKeyboardDropMode skips opening the overlay for a pinned active
  pane (better UX than a guaranteed-refused drop on Enter).
- Tab close X-button now routes through CloseTabViaButton which
  re-checks CanClose and goes through the cancellable
  OnDocumentClosing event (matches the Ctrl+F4 chord path).

220/220 Docking unit tests pass. All NativeDocking selftests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): default tab styling for Document/ToolWindow (§2.8)

DockTabGroupRenderer.Render now auto-resolves tab styling based on
the group's content type: an all-ToolWindow group at record-default
TabPosition/CompactTabs flips to bottom-position + compact tabs
(matches Office / VS tool-pane convention). All-Document and mixed
groups stay at the top-position + full-width default — a tool window
dragged into an editor strip doesn't collapse the whole strip to
compact. The TabPosition.Bottom visual still renders as top-strip
per the §2.2 limitation (no WinUI TabView bottom mode), but the
resolved value flows through so future bottom-strip support picks
it up.

5 new unit tests cover the resolution matrix: all-tool → compact,
all-doc → equal, mixed → equal, explicit-defaults-on-tool → compact,
explicit-compact-on-tool → compact (stable). 225/225 Docking unit
tests pass. All NativeDocking selftests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): PreviousContainer routing §2.15

Close/tear-out paths now record the pane's container into
PreviousContainerTracker before removal, so a later show-from-history
can fold the pane back into its original group.

Wiring:
- DockLayoutMutator.FindContainer(root, pane) — new pure walk that
  returns the immediate DockTabGroup containing a pane (or the leaf
  itself if it IS the root). Null when not present.
- DockLayoutMutator.ShowFromHistory(root, pane, fallback) — folds
  a pane back into its remembered group when that group is still
  in the tree; falls back to InsertPaneAtTarget otherwise.
- DockHostNativeComponent: CloseTabViaButton, CloseActivePane, and
  the tear-out branch of HandleTabDragCompleted all call
  PreviousContainerTracker.Set(pane, FindContainer(...)) just
  before RemovePane.

The drain side (DockManager.Show programmatic API, drag-back
snap-to-history hint) is still on §2.16 model integration.

7 new unit tests cover FindContainer + ShowFromHistory paths
(no-history fallback, group-still-in-tree fold, group-torn-down
fallback, nested-split lookups). 232/232 Docking unit tests pass.
All NativeDocking selftests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): composition fixture §2.18 + IDockBehavior obsolete §2.12

§2.18 — New NativeDocking selftest fixture
CompositionDrivenDocumentsRespectKeyedReconciliation: mounts a
layout whose documents list lives in app state, runs add / remove
cycles, and asserts the documents.Select(...) pattern works through
keyed reconciliation (TabView instance preserved across the
structural changes). Codifies the §5.3.7 contract that functional
composition replaces DocumentsSource / LayoutItemTemplate /
ContentResolver. 7 ok assertions.

§2.12 — Mark IDockBehavior + DockManager.Behavior as [Obsolete]
with migration pointers to the per-event Action props
(OnContentDocked / OnContentFloating / OnContentFloated). The P1
wrapper (Reactor.Docking.Xaml) suppresses CS0618 at file scope so
the bridge keeps working during the transition. Slated for removal
one release after Phase 2 ships.

Bonus: fix CS1573 (stale XML doc) on DockSplitRenderer.Render's
splitterDiagnosticSink parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(045): chord + permission-gate smoke fixtures

Two new NativeDocking selftests:

NativeDocking_KeyboardChordsRegisteredOnMount — locks down the §2.10
chord bridge contract: after mount, DockChordBridge.Get(manager)
returns non-null handlers for all four chords (NextTab, PrevTab,
CloseActive, EnterDropMode) and invoking them doesn't throw. The
state-mutation side-effect path (selectedIndexStore → re-render →
TabView SelectedIndex update) isn't asserted here because the
fixture's sub-host doesn't flush internal-state re-renders through
Harness.Render's primary-host wait. That path is locked down by
DockHostKeyboardTests unit tests + visual showcase verification.

NativeDocking_PermissionGate_PinnedPaneSurfaceCheck — locks down
the §2.14 contract surface: CanMove=false / CanClose=false
properties survive the record `with` shape, and DockDragSession.Begin
succeeds for a movable pane (the post-gate production path). The
gate predicate itself (`if (!pane.CanMove) return;` inside
HandleTabDragStarting) is verified by inspection + the property
unit tests in DockApiShapeTests / DocumentToolWindowTests.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): model-mutation drain §2.16 — programmatic Dock/Close/Activate/PinToSide affect live tree

DockHostNativeComponent.Render now drains DockHostModel.Pending on each
render pass: each queued op translates to a layout / side / active-key
update and fires the matching lifecycle event. Lights up
IDockLayoutStrategy.AfterInsert* adjustments (§2.13), DockHostModel.Show
using the §2.15 PreviousContainer history, and programmatic
Dock/Float/Hide/PinToSide affecting the rendered tree. The model gains
an OnMutationQueued callback that the host wires to bumpTick so mutator
calls wake a re-render; a new DockHostModelBridge (mirroring
DockChordBridge) lets tests + devtools grab the live model from a
DockManager reference.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): corrupt-JSON ReactorEventSource emission §2.7

DockLayoutSerializer.Load classifies every fallback path into one of
seven PII-safe categories (empty / oversize / json-parse /
unsupported-schema / null-document / schema-missing / validation) and
fires ReactorEventSource.DockingLayoutLoadFallback (event id 16,
Warning, Errors keyword). The event payload carries only the category;
the full DockLayoutLoadResult.FailureReason still surfaces to
in-process callers under app ACL — same trade-off as RenderError.

Closes the last open §2.7 checklist item.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* test(045): reliability + security selftests §2.24 §2.25; LayoutOverride wrapper fix

Four new host-mounted reliability fixtures under
NativeDockingReliabilityFixture:
  • CorruptLayoutFallback_HostMounted — corrupt JSON loads non-throw,
    Microsoft-UI-Reactor fallback event fires, host mounts the default.
  • OffThreadMutation_ThrowsAndDoesNotQueue — bridge-resolved model
    rejects Task.Run mutators; Pending stays empty.
  • UseEffectCleanup_RunsOnPaneClose — programmatic close drains and
    the pane's body disappears from the visual tree. Surfaced a real
    Reactor gap: ComponentElement embedded under DockableContent.Content
    doesn't run UseEffect cleanup on unmount. Known-failing assertion
    documented in the fixture docstring.
  • DragSessionPayload_ObjectRefsOnly — DockDragSession holds object
    references, refuses a second concurrent drag, clears on End.

While writing the cleanup fixture I caught a subtle bug in the drag/
close/drain paths: setLayoutOverride(null) was reverting to the
controlled-input prop, resurrecting closed panes. Wrapped the state in
a LayoutOverride(DockNode?) record so the renderer distinguishes "no
override" from "override is intentionally empty". All five
setLayoutOverride call sites (drain, tear-out, tab close, drag confirm,
chord close) updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(045): §2.25 reliability close-out — clamp, host-floating, leak baseline

Five §2.25 items land: off-screen restore via DockFloatingClamp,
orphan/owner support via WindowSpec.Owner forwarding, crash-mid-drag
selftest proving drag state never reaches persisted JSON,
floating-window-outliving-host via per-host tracker + unmount
cleanup, and a 100-pane open/close allocation-baseline selftest.

DockFloatingClamp is the pure multi-display restore algorithm:
saved bounds with < 200x100 DIP overlap agai…
@codemonkeychris
Chris Anderson (codemonkeychris) deleted the users/GitHubPolicyService/74508f07-9c8a-47df-ae92-a376553d6b4d branch May 28, 2026 19:11
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 30, 2026
…nt bucketing)

CR item #1 (GridView/ListBox deferred-echo) — revert SelectedIndex to the
causal counter (ShouldSuppress/WriteSuppressed; drop the §8 value-diff arm),
restoring main's mechanism. Empirically probed on this box: post-realization
SelectionChanged is synchronous (deferral is mount-only), the counter and the
value-diff arm behave identically in every production-reachable path, and the
guarded -1 no-op leaves the echo counter at 0 (no strand) so a later genuine
deselect still fires. The counter gate suppresses the whole trampoline fire,
so it also governs the multi-select snapshot OnSelectionChanged (CR #3) and the
guarded-no-op self-clear concern is moot (CR #4). ComboBox/toggles/pickers keep
the value-diff arm (synchronous by construction). Descriptor + fixture
narration updated to match.

CR item #2 (empty ElementExtras bucket) — normalize the 14 bucketed init shims
via ElementExtras.IsEmpty + Element.NormalizeExtras so writing a bucketed field
to null never materializes/keeps a non-null empty bucket. An empty bucket is
not Equals to null, which otherwise broke record equality between an extras-free
element and one with a field cleared to null. New ElementExtrasBucketTests.

CR item #6 — make Element.Extensions setter internal to remove the
initializer-ordering footgun from the public surface (no in-repo external
writes; bucketed shim properties stay public).

Nits — ComboBox stale ShouldSuppress doc; PerformanceBudgets §4.9 dead-code
TODO; Reconciler ContinueDefaultTraversal cref namespace fix (clears the CS1574
warning); TabView pinnable-tab "not byte-identical" callout; ContentDialog
OnClosed tag-routing follow-up note; §4.4 ElementExtras construction-cost note.

Verified: core builds clean (ARM64 + x64), Reactor.Tests 9132 passed / 62 skip,
selftest ValueDiff/Echo/ComboBox/GridView/ListBox/SelectionEvent/EventStateSplit
fixtures all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 30, 2026
…nt bucketing)

CR item #1 (GridView/ListBox deferred-echo) — revert SelectedIndex to the
causal counter (ShouldSuppress/WriteSuppressed; drop the §8 value-diff arm),
restoring main's mechanism. Empirically probed on this box: post-realization
SelectionChanged is synchronous (deferral is mount-only), the counter and the
value-diff arm behave identically in every production-reachable path, and the
guarded -1 no-op leaves the echo counter at 0 (no strand) so a later genuine
deselect still fires. The counter gate suppresses the whole trampoline fire,
so it also governs the multi-select snapshot OnSelectionChanged (CR #3) and the
guarded-no-op self-clear concern is moot (CR #4). ComboBox/toggles/pickers keep
the value-diff arm (synchronous by construction). Descriptor + fixture
narration updated to match.

CR item #2 (empty ElementExtras bucket) — normalize the 14 bucketed init shims
via ElementExtras.IsEmpty + Element.NormalizeExtras so writing a bucketed field
to null never materializes/keeps a non-null empty bucket. An empty bucket is
not Equals to null, which otherwise broke record equality between an extras-free
element and one with a field cleared to null. New ElementExtrasBucketTests.

CR item #6 — make Element.Extensions setter internal to remove the
initializer-ordering footgun from the public surface (no in-repo external
writes; bucketed shim properties stay public).

Nits — ComboBox stale ShouldSuppress doc; PerformanceBudgets §4.9 dead-code
TODO; Reconciler ContinueDefaultTraversal cref namespace fix (clears the CS1574
warning); TabView pinnable-tab "not byte-identical" callout; ContentDialog
OnClosed tag-routing follow-up note; §4.4 ElementExtras construction-cost note.

Verified: core builds clean (ARM64 + x64), Reactor.Tests 9132 passed / 62 skip,
selftest ValueDiff/Echo/ComboBox/GridView/ListBox/SelectionEvent/EventStateSplit
fixtures all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request May 30, 2026
…#455)

* spec(047): Phase 4 (4.0.5) - XamlHost/XamlPage own V1 registration

Closes the XAML-interop slice of the §4.0 reachable-but-deferred carve:
- Register XamlPageDescriptor/XamlHostDescriptor handlers in
  RegisterV1BuiltInHandlers so V1 auto-registration owns the two
  reverse-embedding element types.
- Add internal Reconciler.IsElementTypeRegistered and make
  XamlInterop.Register idempotent (skips already-owned types) so the
  public API no longer trips EnsureRegistrableElementType under V1 ON.
- Update XamlInteropTests double-throw test to idempotency; add V1-ON
  registration + clashless-Register regression tests.

Verified: xunit XamlInterop/V1OnRegistration/TypeRegistry (91) green;
Hosting_XamlInteropRegister selftest green V1 ON == V1 OFF.

Co-authored-by: Copilot <[email protected]>

* Spec 047 Phase 4 (4.0.2): port NavigationHost unmount to V1 handler

Extract Reconciler.CleanupNavigationHostNode and own navigation teardown
from NavigationHostHandler.Unmount on the V1 path. The flag-independent
UnmountRecursive intercept becomes a !UseV1Protocol fallback so cleanup
stays byte-identical V1 ON =/= V1 OFF until the V1-OFF escape path is
deleted in 4.6.

NavHost selftests 16/16 green under both flags; NavigationHostTests +
UseNavigationTests 30/30 pass.

Co-authored-by: Copilot <[email protected]>

* Spec 047 CR Finding 1: fix stranded echo-suppression token in controlled descriptor entries

ControlledPropEntry.Update and HandCodedControlledPropEntry.Update wrote
under echo-suppression whenever the element prop changed (oldEl != newEl),
even when the control already held the new value. WriteSuppressed always
increments the suppress counter, consumed only by a real change event; a
suppressed no-op write strands the token and silently swallows the user's
next real interaction (the cross-state echo class spec 047 section 8 exists
to prevent). Suppress only on real control drift (current != newValue).

Add real-input echo-stranding regression fixtures across both entry types
(RadioButton + ToggleSplitButton via ControlledPropEntry; TextBox +
NumberBox via HandCodedControlledPropEntry). Verified red→green: all four
SecondEventNotSwallowed assertions fail with the bug reintroduced and pass
with the fix. Full Desc_ descriptor suite: 0 failures.

Co-authored-by: Copilot <[email protected]>

* Spec 047 CR Finding 2: gate V1-ON selftests in CI

Add a 'Selftests (V1 ON)' CI job that runs the full selftest suite with
REACTOR_USE_V1_PROTOCOL=true so V1-ON =/= V1-OFF parity is enforced by an
automated gate rather than asserted by a one-off manual run. Runs the
AppTests.Host directly (Program.cs maps the env var to the AppContext
switch before any Reconciler is built), since Reactor.Tests/xunit does not
map the flag. Mirrors the existing aot-selftests run-the-host pattern and
uploads TAP output as an artifact.

Also harden TabRenderer_TitleBarChrome/FlatChrome_BodyRendered with a second
Harness.Render() pump: TabView lazy-realizes selected-pane body content on
dispatcher messages scheduled by layout, which a single pump can race on
contended runners (consistent with the documented Harness.Render mitigation).

Co-authored-by: Copilot <[email protected]>

* spec(047): Phase 4 (4.1) - flip UseV1Protocol ON by default

Flip the Reconciler ctor default so V1 dispatch is the production path when
neither the explicit ctor flag nor the AppContext switch is set. The flag now
exists only as an escape hatch to force V1 OFF during the legacy-deletion
window (gated to 4.5/4.6).

Fix 4 tests that assumed the OFF default:
- XamlInteropTests x2: assert via IsElementTypeRegistered (flag-independent)
  since XamlHost/Page are owned by the V1 registry under ON.
- TypeRegistryTests.Override_Builtin_Type: pin to useV1Protocol:false
  (legacy built-in override is V1-OFF-only per 13 Q17).
- RichEditBoxElementTests: tolerate TargetInvocationException-wrapped
  COMException from V1 new T() construction.

Verified: xunit ON = 9136 passed/0 failed; full selftest ON = 0 failures.

Co-authored-by: Copilot <[email protected]>

* spec(047): Phase 4 (4.0.4) - lock GridView lazy realization with a scale selftest

The GridViewHandler already routes through the engine's virtualizing
MountGridView body (ItemsSource = Range + shared ItemTemplate +
ContainerContentChanging), mirroring ListViewHandler. Add RareControl_GridViewLazy
to lock that CCC lifecycle: 500 items in a 200px viewport realize only ~96
containers (< total/2), the tail item stays unrealized, the first item realizes.
Identical 96/500 under V1 ON and V1 OFF - A|B parity green. Guards against a
regression to the descriptor's non-virtualizing ItemsHost<> path.

Co-authored-by: Copilot <[email protected]>

* spec(047): Phase 4 (4.4 spec-hygiene) - cite measured 11.6 byte targets

Replace the stale 100/320/500 B byte-gate estimates with the measured 11.6
targets (Target = min(Direct + 100, ReactorToday x 0.4) -> 407 / 1520 / 19200)
in spec 14 cleanup, 15.1 goal 1, the 15.6 hard-gate sentence, and the 15.7
Phase 4 row. Fix the 15.6 'Phase 5 cleanup' reference to 'Phase 4' (this spec
has no Phase 5).

Co-authored-by: Copilot <[email protected]>

* spec(047): Phase 4 (4.7) - retire obsolete REACTOR1001/REACTOR1003 analyzers

The final descriptor API is fully strongly-typed: events wire via typed
subscribe lambdas (no changeEvent string names) and Controlled<TValue,TArgs>
unifies set/readBack so the compiler already rejects a read-back type mismatch.
A repo sweep found zero string-form event references in production descriptors,
so REACTOR1001 (string event ref) and REACTOR1003 (read-back type) had no
source pattern left to match.

Remove both no-op analyzers + their test fixtures, the two reserved diagnostic
descriptors, and the REACTOR1001/1003 rows from AnalyzerReleases.Unshipped.md
and the guide table. REACTOR1002 (CustomEventDelegateTypeAnalyzer) remains as
the active Q10 compile-time check. Analyzer tests green (4 pass).

Co-authored-by: Copilot <[email protected]>

* spec(047): Phase 4 - add live progress log + 4.0.1/4.0.3 handoff context

Document completed work (4.0.6 parity, 4.1 flip, 4.0.4 GridView lock,
4.4 spec-hygiene, 4.7 analyzer retirement) and the critical context for the
next session: the prelude delegate handlers call legacy MountXxx bodies, so
genuine 4.0.1 (modal-lifecycle decorator strategy) + 4.0.3 (TabView engine
features) ports must land before 4.5 can delete the legacy switch. Includes
verified build/test commands and the concurrent-selftest-build race warning.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.5 + §4.0.1/§4.0.3: delete legacy dispatch switch & finalize overlay/TabView ports

Phase 4 close-out work, landing the genuine V1 ports together with the
legacy dispatch-switch deletion they unblock.

§4.0.1 overlay port: overlays are now owned by the new V1 OverlayLifecycle
static module; the engine no longer delegates into legacy bodies.
§4.0.3 TabView port: full TabViewDescriptor replaces the delegate
TabViewHandler (deleted), with drag pipeline, pinnable headers and
imperative-bridged strip slots.
§4.5: both Mount/Update dispatch to V1 registry -> _typeRegistry ->
composition-primitive-only switch (Component/Func/Memo/ErrorBoundary/
CommandHost/FormField/ValidationVisualizer/ValidationRule). Dead-body
sweep removed the orphaned legacy Mount*/Update* bodies including the 14
overlay delegators and Mount/UpdateTabView. Overlay leaf helpers
(Create/Update MenuFlyout/AppBar items) promoted to internal for
OverlayLifecycle; BuildTabHeader/TryUpdatePinHeaderInPlace stay internal
for TabViewDescriptor.

Tests: removed the obsolete descriptor-vs-handler parity harness
(Spec047V1ProtocolDescriptorFixtures + Desc_ registry entries; Echo_
real-input regression fixtures preserved); dropped the dead
UpdateCommandBarFlyout/UpdateFlyoutElement reflection probes.

Validation: build 0 err; xunit V1 ON 9136 pass/0 fail; full selftest 0 fail.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.6 — remove A|B / UseV1Protocol dead code

V1 is the unconditional production path (§4.5 deleted the legacy dispatch
switch), so the entire A|B testing apparatus is dead. This removes it.

Reconciler:
- Collapse the four ctors into a single `Reconciler(ILogger? logger = null)`;
  drop the `useV1Protocol` / `registerBuiltinHandlers` params, the
  `public bool UseV1Protocol` property, and the AppContext-switch read.
- Drop the flag guard from both dispatch sites (Mount.cs:66, Update.cs:117),
  both unmount arms, and the NavigationHost pre-dispatch block.

Tests / harness:
- Remove the REACTOR_USE_V1_PROTOCOL env-var mapping (AppTests.Host/Program.cs)
  and the redundant `selftests-v1` CI job.
- De-switch the Spec047V1Protocol / Spec047ExternalProof selftest fixtures.
- Delete V1FeatureFlagTests, TypeRegistryTests.Override_Builtin, and the
  redundant TextBox echo-stranding fixture; migrate the echo-stranding fixtures
  and Ports/*PortTests to `new Reconciler()` against the built-in descriptors;
  reshape V1OnRegistrationTests to the always-on registration contract.

Perf / tooling:
- Delete the A|B perf duplicates (StressPerf.ReactorV2, BlankReactorV2,
  PerfBench DescriptorVariantFactory) and tools/spec047-phase1-checkpoint;
  rename the ReactorV2 column to Reactor in the aggregator/slnx/scripts.

Validation: core build = 0 err; xunit = 9128 pass / 0 fail; Echo + V1_* +
Spec047ExternalProof_* selftests = 0 fail. Perf-project consolidation
measurement is deferred to the ARM64 baseline machine (§4.9).

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.7 — graduate + lock the public V1 author surface

Phase 2 decided the V1 protocol is the production model and §4.5 deleted the
legacy path, so the author surface is now stable/supported. Graduate it out of
[Experimental] and confirm the external-assembly proof against the locked surface.

- Remove all 157 [Experimental("REACTOR_V1_PREVIEW")] attributes across 110
  src/Reactor files (public author surface — IElementHandler, MountContext/
  UpdateContext, ReactorBinding(<T>), ControlDescriptor + builders,
  Register{Type,Handler}, pool policy, WriteSuppressed, AddRawRoutedHandler —
  and the internal handlers/descriptors that carried it).
- Drop the now-dead REACTOR_V1_PREVIEW NoWarn from all six csprojs
  (Reactor, Reactor.Tests, Reactor.AppTests.Host, PerfBench.ControlModel, and
  both external_proof projects). The external_proof control now consumes the
  public surface with NO experimental opt-in — the strongest form of the proof.

KD-4 (external typed-event surface) was already shipped: the external
MarqueeControl wires a typed CLR event via the public MountContext.BindFor ->
ReactorBinding<TElement>.OnCustomEvent<TArgs> path with only a plain
ProjectReference (no InternalsVisibleTo). ReactorBinding<TElement>'s ctor stays
internal but is reached through public BindFor, so it is not a gap.

Validation: core build = 0 err; Reactor.External.TestControl builds clean (0 err,
no IL trim/AOT warnings, PublishTrimmed+IsAotCompatible on, no opt-in); xunit =
9128 pass / 0 fail; all six Spec047ExternalProof_Marquee_* selftests green;
PerfBench.ControlModel + AppTests.Host build clean without the NoWarn.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.2 (part A): delete orphaned legacy value-control handler bodies

§4.5 deleted the legacy reconciler dispatch switch arms but left the value-
control MountXxx/UpdateXxx handler method bodies behind as unreachable dead
code (controls now dispatch through the V1 descriptor system). Remove them:

  Mount.cs:  MountToggleSplitButton, MountPasswordBox, MountNumberBox,
             MountAutoSuggestBox, MountRadioButton, MountRadioButtons,
             MountComboBox, MountSlider, MountRatingControl, MountColorPicker,
             MountCalendarDatePicker, MountDatePicker, MountTimePicker, plus
             the now-dead helpers EnsureToggleSwitchWiring and (Reconciler's
             own) EnsureTextBoxWiring.
  Update.cs: UpdateToggleSplitButton, UpdateTextBox, UpdatePasswordBox,
             UpdateNumberBox, UpdateAutoSuggestBox, UpdateRadioButton,
             UpdateToggleSwitch, UpdateRatingControl, UpdateColorPicker,
             UpdateCalendarDatePicker, UpdateDatePicker, UpdateTimePicker,
             UpdateRadioButtons, UpdateComboBox, UpdateCalendarView.

Preserved live islands interleaved among these: MountCheckBox/UpdateCheckBox
(Path-B via CheckBoxHandler), the NumberBox immediate-mode chain
(NumberBoxImmediateTextChanged/...LoadedEnsureImmediateTextBox/
EnsureNumberBoxImmediateTextBoxWiring/HandleNumberBoxImmediateTextChanged plus
the CanSynchronize/AreNumberBoxValuesEquivalent helpers, all live via
NumberBoxDescriptor.Immediate), and SyncSelectedDates (reflection-probed).

This finishes the §4.5 dead-code sweep and cuts ChangeEchoSuppressor references
from ~55 to 16 (the remaining live descriptor paths are migrated in §4.2 part B).
No behavior change (deleted code was unreachable).

Validation: core build 0 err; xunit 9128 pass / 0 fail / 62 skip; selftests
PrivMount/Echo/NumberBox/CheckBox all 0 failures.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.2: refresh echo-suppressor audit + defer part B with handoff

The Phase-0 begin-suppress-audit.csv is stale (cites §4.5/§4.2A-deleted legacy
line numbers). Add a refreshed, accurate live call-site inventory for the
ChangeEchoSuppressor elimination surface and record the go/no-go decision.

- New: docs/specs/047/audits/echo-suppressor-phase4-live-sites.md — the ~30 live
  echo sites (post-§4.2A), classified (general-controlled / coercion /
  float-precision / collection-batch / setter-scope / public-API), with the
  rationale for why full elimination (part B) is a dedicated, spec-author-involved
  effort rather than an autopilot pass: the counter is a causal token, value-compare
  is causally weaker (coincidental real-value events get swallowed), ApplySetters'
  EchoSuppressScopeDepth has no value to compare, and public WriteSuppressed carries
  no value/readback for external authors. New regression fixtures required first.

- Task doc: progress log records §4.2 part A done (commit 8a67e34) and a "Deferred"
  block for §4.2B / §4.3 / §4.4 / §4.8 / §4.10 / §4.9 with reasons; §4.2 section gets
  a status note pointing at the refreshed inventory. Also corrects the §4.5 log's
  "0 orphaned private members remain" over-claim (§4.2A removed ~28 it missed).

Co-authored-by: Copilot <[email protected]>

* spec-047 §8: value-diff echo suppression PoC on the ControlledPropEntry path

Per product decision, prove out the spec §8 "diff/value-compare" echo
suppression on the descriptor controlled fast path, keeping the causal counter
as the retained fallback everywhere else (so reverting this one path is trivial
if the diff approach causes issues in practice).

ControlledPropEntry (src/Reactor/Core/V1Protocol/Descriptor/PropEntry.cs) — the
generic two-way `.Controlled(...)` entry used by ~10 controls (RadioButton,
ToggleSplitButton, ToggleSwitch, RatingControl, ColorPicker, the date/time
pickers, etc.) — now suppresses its own programmatic-write echo by VALUE:

- Update arms a per-control ExpectedEcho on the DescriptorControlledPayload
  (value + comparer) instead of bumping ChangeEchoSuppressor's counter, then
  writes. Arming is gated on a non-null callback AND an existing payload (no
  subscription => no echo to suppress), via the new non-allocating
  Reconciler.TryGetControlEventPayload<T>.
- The change-event trampoline drops the single event whose readback equals the
  armed value (one-shot), then clears the arm. A mismatch means a real user
  change superseded the pending write -> clear and fire the callback.
- ChangeEchoSuppressor.ShouldSuppress is still honored first (external
  WriteSuppressed tokens + the ApplySetters setter scope, which carry no value);
  a matching pending arm is drained on that branch too so it cannot strand and
  swallow a later real interaction (rubber-duck + code-review blocking finding).
- Mount clears any stale arm left on a pooled payload (KD-3: payload survives
  rent/return).

The counter (ChangeEchoSuppressor / EchoSuppressCount / EchoSuppressScopeDepth /
public ReactorBinding.WriteSuppressed) is unchanged and remains the live
mechanism for the hand-coded / coercing / collection entries, the
Slider/TextBox/ToggleSwitch handlers, CheckBox, NumberBox-immediate, the
CalendarView shim, the setter scope, and external authors. The PoC's
synchronous-change-event assumption (and the migrate-back path) is documented
in-code on DescriptorControlledPayload.

New selftest fixtures (Spec047ValueDiffEchoFixtures) lock the value-diff DRIFT
path the existing Echo_*_RealInput stranding fixtures don't cover: a real
programmatic update lands on the control, does NOT echo into the callback, and a
subsequent real interaction still fires.

Validation (x64): core build 0 err; xunit 9128 pass / 0 fail; selftests
--filter Echo (no-echo + stranding), ValueDiff (new drift), SettersScope
(setter scope), Spec047ExternalProof (public WriteSuppressed counter) all 0
failures.

Co-authored-by: Copilot <[email protected]>

* spec-047 §8: migrate TextBox echo suppression to value-diff (PoC)

Extends the §8 value-diff echo-suppression proof-of-concept from the
ControlledPropEntry fast path to the live TextBox path (TextBoxHandler,
the registered handler — the descriptor is an unregistered proof-point).

The legacy counter (ChangeEchoSuppressor.WriteSuppressed / ShouldSuppress)
is replaced for TextBoxHandler's controlled `Text` writes by arming an
ExpectedEchoText on the per-control TextBoxEventPayload: the TextChanged
trampoline drops the single event whose readback matches (then clears the
one-shot arm). The arm is left pending after the write — like the counter,
which leaves its suppression elevated for a possibly-deferred TextChanged.
Stale arms are cleared on the next Mount (pool reuse).

The counter is retained for the paths it still owns: external public
ReactorBinding.WriteSuppressed and the ApplySetters setter-scope. The
trampoline checks ShouldSuppress first (and drains a matching arm on that
branch so a counter-suppressed echo can't strand the arm), then value-diff.

Arming is gated on a TextChanged trampoline being wired now OR about to be
wired this Update (newEl.OnChanged != null) — EnsureTextBoxWiring runs at
the end of Update, so a null->non-null OnChanged transition combined with a
value change still arms (creating the payload if needed) and the trampoline
goes live before any deferred echo. This preserves the legacy counter's
subscription-timing-independent suppression and avoids stranding a
SelectionChanged-only TextBox.

Accepted PoC tradeoff: value-diff only drops on an exact readback match, so
a write WinUI coerces (e.g. single-line stripping \r\n) surfaces as a real
change rather than being dropped. Documented in-code with a migrate-back
path to the counter.

Selftest fixtures added (Spec047ValueDiffEchoFixtures):
ValueDiff_TextBox_Drift, _SnapBack, _Transition.

Validated (x64): core build clean; xunit 9128/0; selftests Echo +
ValueDiff + SettersScope 0 failures (incl. EchoSuppress_TextBox_*);
DataGrid E2E (click cell -> type -> commit) + EventHandler TextBox keydown
E2E passed.

Co-authored-by: Copilot <[email protected]>

* spec-047 §8: migrate safe echo-suppression paths to value-diff (hybrid)

Migrate the synchronous, exact-comparable, single-controlled-value round-trips
off the causal ChangeEchoSuppressor counter onto a value-diff arm, while
RETAINING the counter as the documented fallback for paths value-comparison
cannot model. End state is an intentional hybrid (no ReactorState byte win —
adds one ref field — chosen for correctness/self-healing on migrated paths).

Shared infra:
- ReactorState.PendingEchoMatch (one-shot Func<object?,bool>?), reset at the
  same 3 sites as the counter (ClearCurrentEventHandlers, DetachReactorState,
  pool-return).
- ChangeEchoSuppressor.ArmExpectedEcho / ClearExpectedEcho / ShouldSuppressEcho.
  Counter/scope wins first (external WriteSuppressed + ApplySetters carry no
  expected value); else the one-shot value predicate is consumed.
- HandCodedControlledPropEntry opt-in `valueDiffEcho` + ControlDescriptor
  builder param: Update arms the expected echo then writes bare; the per-
  descriptor trampoline calls ShouldSuppressEcho(ctrl, readback).

Migrated (valueDiffEcho / ShouldSuppressEcho): ComboBox, FlipView, GridView,
ListBox, Pivot, PipsPager, RadioButtons, SelectorBar, TabView,
TemplatedFlipView descriptors + ToggleSwitchHandler. (TextBoxHandler /
ControlledPropEntry were already value-diff via their own payload arm.)

Retained on the counter (rationale in spec 8.3): Slider/NumberBox doubles,
NumberBox coercion, CalendarView collection, AutoSuggest/Password/RichEdit
strings, Expander, CheckBox path-B, ApplySetters scope, public WriteSuppressed.

Key insight: WinUI selection (SelectionChanged) and Toggled fire SYNCHRONOUSLY
inside the property write (unlike deferred TextBox.TextChanged), so no
arm-ahead-of-wiring is needed; a null->non-null transition simply produces no
echo before the trampoline subscribes.

Code-review-driven strand fixes:
- ShouldSuppressEcho clears PendingEchoMatch UNCONDITIONALLY in the counter
  branch (safe: only synchronous controls use this arm; deferred TextBox uses a
  separate HasExpectedEcho payload arm), preventing a stranded arm from
  swallowing a later coincidental real event.
- HandCodedControlledPropEntry.Update clears the arm after a guarded/coerced
  no-op write (post-write readback != nv) so the never-fired echo cannot strand.

Docs: spec §8.3 (new) documents the hybrid + retained-counter rationale and
supersedes the wholesale-deletion plan; task-doc progress log records part B'.

Tests: new ValueDiff_ComboBox_Drift, ValueDiff_ToggleSwitch_Drift, and
ValueDiff_GridView_GuardedNoOpStrand selftest fixtures. Validated x64: core
build 0 err; xunit 9128/0; ValueDiff + Echo + migrated-control selftests 0 fail;
DataGrid E2E pass.

Co-authored-by: Copilot <[email protected]>

* docs(spec-047 §4.2): record value-diff hybrid (part B') in phase-4 task doc

Update the §4.2 section of the phase-4 task doc to reflect the value-diff echo
migration that landed in c5c1399:
- New "Part B'" status block + checked-off checklist for the shared value-diff
  arm, the migrated descriptors/handler, the strand-safety fixes, and the new
  regression fixtures.
- Mark the original "delete + tolerance metadata + ColorPicker shim" plan
  (now "Part B") as DEFERRED and SUPERSEDED by spec §8.3, with the
  counter-retained hybrid rationale; its full-elimination boxes stay unchecked.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.3: split EventHandlerState — routed family → ModifierEventHandlerState

Carve the monolithic per-element EventHandlerState into the §9.2 shape:
the WinUI true-routed-input family (pointer/key/tap/focus/sizechanged/
accesskey — 21 Current* + 20 trampolines) is renamed in place to
ModifierEventHandlerState (lazy on ReactorState.Modifiers); control-intrinsic
events move fully onto the already-shipped per-control ControlEventStateBox
payloads.

- Delete dead legacy Image/ScrollViewer/ScrollView Mount/Update/Ensure bodies
  (the registered descriptors own their event wiring) + their 5 EHS trampoline
  fields. Delete 3 orphaned EHS fields (ToggleSwitchToggled/TextBoxTextChanged/
  TextBoxSelectionChanged — referenced only in the struct def).
- Migrate the 2 live control-intrinsic paths off the shared struct onto
  ControlEventStateBox payloads: Button.Click → ButtonEventPayload.ClickTrampoline
  and NumberBox immediate-mode wiring flag → NumberBoxEventPayload.ImmediateInnerWired.
  Both resolve the same native-DO-keyed ReactorState, so the issue #114/#86
  shared-trampoline dedup invariant is preserved; trampolines keep reading the
  live element via GetElementTag (CurrentClick untouched — it is preserved across
  pool return and must not stash a per-owner delegate).
- Rename EventHandlerState→ModifierEventHandlerState, ReactorState.Events→Modifiers,
  GetOrCreateEventState→GetOrCreateModifierState across all callers; refresh the
  5 <see cref> doc references.
- Correct the stale ControlEventStateBox/payload comments that claimed pool reset
  clears ControlEventState on return — it is PRESERVED across rent/return (#114),
  dropped only on full detach.

Validation (x64): core build 0 err; xunit 9128 pass / 0 fail; Button / NumberBox /
Image / Scroll / Pool / EventHandler selftests 0 fail. M10/M11 byte measurement
deferred to the ARM64 baseline machine (§4.9); the §9.2 pool-lifecycle hazard
fixtures land next.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.3: add §9.2 event-state-split pool-lifecycle hazard fixtures

Lock the post-split contract with AppTests.Host self-test fixtures
(Spec047EventStateSplitFixtures.cs, registered in SelfTestFixtureRegistry):

- NoDuplicateSubscriptionAcrossPoolReuse — issue #114 guard: rent→fire→return→
  re-rent→fire, the preserved ControlEventState trampoline fires the LIVE element
  exactly once (never double-subscribes).
- HandlerTypeMismatchResetsBox — the ControlEventStateBox HandlerType discriminator
  deterministically replaces the box on type mismatch (no InvalidCastException);
  doubles as the hot-reload type-identity proxy.
- DualReturnIdempotent — returning the same control twice is idempotent; re-rent
  still fires exactly once.
- ModifierStateLazyForIntrinsicOnly — §9.4 alloc-shape proxy for the ARM64-blocked
  M10/M11 byte measurement: an intrinsic-only control leaves ReactorState.Modifiers
  null while ControlEventState is allocated; a routed-modifier control allocates
  Modifiers.
- AddRawRoutedHandler_HandledEventsToo — the §9.5/Q11 escape hatch is intact on
  Mount/UpdateContext and independent of the split. The live "Handled child →
  parent still fires" leg is a documented TAP SKIP (WinUI 3 cannot synthesize a
  KeyRoutedEventArgs / RaiseEvent an input event headlessly) — covered by the
  Appium E2E KeyDownTest.

Validation (x64): host build 0 err; EventStateSplit / Pool / EventHandler
selftests 0 failures.

Co-authored-by: Copilot <[email protected]>

* docs(spec-047 §4.3): check off EventHandlerState-split task boxes + progress log

Mark all §4.3 task-doc checkboxes done (the monolith is gone; control-intrinsic
events fully on ControlEventStateBox payloads; routed family renamed to
ModifierEventHandlerState; §9.2 hazard fixtures landed). M10/M11 byte/frequency
measurement noted ARM64-deferred to §4.9; alloc-shape asserted via selftest in
this x64 env. Add the §4.3 progress-log entry.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.4: bucket the Element base into ElementExtras + land §11.6 byte-gate constants

Mirror the proven spec-034 ElementModifiers shim-bucket pattern: move the 14
cross-cutting nullable Element base fields (Attached, ImplicitTransitions,
ThemeTransitions, ThemeBindings, LayoutAnimation, AnimationConfig,
ElementTransition, InteractionStates, StaggerConfig, KeyframeAnimations,
ScrollAnimation, ConnectedAnimationKey, ResourceOverrides, ContextValues) into a
single nullable value-equality sub-record `ElementExtras`, exposed via one
`Element.Extensions` slot. Each field name survives as a public get/init shim
(get => Extensions?.X; init => copy-on-write into Extensions), so in the lean
case (Extensions == null) the base carries only Key/Modifiers/Extensions — the
§11.7 byte win — while all ~180 existing readers and `with`-expression writers
(including the read-then-write composites in ElementExtensions.cs) compile and
behave unchanged. Named ElementExtras to avoid the existing ElementExtensions
static class.

- Add `Extensions is null && b.Extensions is null` fast-path in ShallowEquals so
  the common no-Extras element skips the three structural (Attached/ThemeBindings/
  ContextValues) compares in the hot reconcile diff path; update the
  CanSkipUpdate/ShallowEquals invariant doc. Record value-equality is preserved
  (the 14 move into the value-equality ElementExtras; the reconciler diffs via the
  structural helpers, not Element.Equals).
- Land the §11.6 hard byte-gate TARGET constants (PerformanceBudgets.cs):
  M1 ≤407 / M2 ≤1520 / M3 ≤19200 (measured baselines 1018/~3800/~48000 ×0.4).
  The gate MEASUREMENT/enforcement is ARM64-baseline-blocked → deferred to §4.9.

Validation (x64): core build 0 err; xunit 9128 pass / 0 fail (incl.
ElementModifiersBucketTests); Animation/Transition/Theme/Context/Attached/Stagger/
Keyframe/Scroll/ConnectedAnimation/Resource selftests 0 fail. Only Element.cs +
the new PerformanceBudgets.cs changed.

Co-authored-by: Copilot <[email protected]>

* docs(spec-047 §4.4): check off bucketed-Element-base task boxes + progress log

Mark the bucketing + reader/writer-migration boxes done (ElementExtras shim
bucket; zero call-site edits; PerformanceBudgets §11.6 target constants landed).
The byte-gate enforcement/measurement boxes stay open — ARM64-baseline-blocked,
deferred to §4.9. Add the §4.4 progress-log entry.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.8: document the final author-facing surface (stable, post-split)

Promote the V1 control-authoring guide out of "preview/provisional" and bring it
in line with the post-Phase-4 reality (hand-maintained pages — extensibility-
preview.md has no .md.dt template; filename kept to preserve inbound spec links).

docs/guide/extensibility-preview.md:
- Drop the [Experimental]/REACTOR_V1_PREVIEW/breaking-change banner; mark the
  surface stable. Replace "Enabling the V1 path / off by default" with a
  "Dispatch order" section (V1 registry → _typeRegistry → composition-primitive
  switch; no flag, no legacy MountXxx fallthrough).
- Correct the pool-reset enumeration: ControlEventState is PRESERVED across
  rent/return (#114), not cleared — trampolines stay subscribed and read the live
  tag; dropped only on full detach / replaced on HandlerType mismatch. The shared
  modifier state is ModifierEventHandlerState (ReactorState.Modifiers, lazy),
  cleared via ClearCurrentHandlers.
- Correct the per-control event-state section: EventHandlerState was split into
  ModifierEventHandlerState + per-control ControlEventStateBox (§9.2) — done, not
  "Phase 3/4".
- Rewrite WriteSuppressed to the §8.3 hybrid (value-diff for synchronous
  single-value controls + retained suppress-counter fallback; signature stable).
- Replace the children-strategy table with the final 10-strategy set; drop the
  Phase-status column. Drop the "descriptor authoring = Phase 2 gate" item and the
  NoWarn REACTOR_V1_PREVIEW checklist step (plain ProjectReference, no IVT/opt-in).
- Add a "Choosing an authoring shape (decision tree)" section (spec §6.1.1):
  descriptor prop/engine shapes vs hand-coded IElementHandler, the children-strategy
  picker, echo + pool-policy notes.

AGENTS.md:
- Rewrite "Adding a new WinUI control" to the V1 descriptor path (Element record →
  ControlDescriptor/IElementHandler → RegisterV1BuiltInHandlers → selftest).
- Rewrite "Echo suppression for value controls" to the §8.3 hybrid (ChangeEchoSuppressor
  retained as the counter fallback; authors use WriteSuppressed/.Controlled/valueDiffEcho).
- Update the per-element-state line to ModifierEventHandlerState + ControlEventStateBox.

Docs-only; mur not available in this env so no generated pages were recompiled.

Co-authored-by: Copilot <[email protected]>

* docs(spec-047 §4.8): check off final-documentation task boxes + progress log

Mark all §4.8 boxes done (extensibility guide promoted to stable; §6.1.1 decision
tree added; AGENTS.md updated to the V1 descriptor model + §8.3 echo hybrid +
ModifierEventHandlerState/ControlEventStateBox). The generated-pages box is N/A
in this env (mur unavailable; the edited page is hand-maintained). Note: the
task's "ChangeEchoSuppressor is deleted" premise was corrected to the settled
hybrid (retained). Add the §4.8 progress-log entry.

Co-authored-by: Copilot <[email protected]>

* docs(spec-047 §4.9): record perf-ratification handoff (ARM64-baseline-blocked)

§4.9 is entirely a measurement/ratification gate on LAPTOP-4MEP83VI and is not
executable in the x64 dev environment. Annotate the section with a clear handoff:
all code the gates measure is already landed (§11.6 target constants §4.4,
single-Reactor perf-project consolidation §4.6, EHS split §4.3, bucketed Element
base §4.4, AOT-clean external proof + CI AOT job §4.7); the KD-3 M1 binder-check
fold is deliberately NOT applied (measurement-gated, and prior related micro-opts
were net-negative). Boxes stay unchecked until the baseline capture lands; added
the baseline-operator runbook + progress-log entry.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.10: Phase 4 close-out — status, dead-code sweep, validation

Final close-out of the Phase 4 V1-migration cleanup.

- Status: marked the main tracker header + spec §14 "Phase 4 — cleanup" as
  code-complete — migration closed; V1 is the unconditional production path.
  Reconciled the exit-gate/cleanup wording against the settled outcomes: the
  "delete ChangeEchoSuppressor" item is superseded by the §8.3 value-diff/counter
  HYBRID (suppressor intentionally retained; WriteSuppressed signature unchanged),
  and the §11.6 byte-gate + ARM64 ratification are carved out as the only
  outstanding baseline-machine (LAPTOP-4MEP83VI) items.
- Dead-code sweep: grep-clean across src + tests — no live UseV1Protocol /
  REACTOR_USE_V1_PROTOCOL / ReactorV2 / registerBuiltinHandlers / EventHandlerState
  (monolith); only historical comments remain. ChangeEchoSuppressor is retained by
  design (hybrid), so it is removed from the sweep list.
- Tidied a stale PoolPolicyTests TODO: the real FrameworkElement rent/return reset
  contract is now covered by the §4.3 self-test fixtures; corrected its
  "ControlEventState cleared" wording to "preserved across rent/return (#114)".

Validation (x64): full solution build (Reactor.slnx -p:Platform=x64) 0 err; full
xunit 9128 pass / 0 fail; full selftest 0 fail modulo the known docking-family
flakiness (DockHooks_* / SidePopup_*) that fails intermittently under full-suite
headless load and passes deterministically when filtered (confirmed: both filters
0 failures; full-run count varied 7→6 across runs) — pre-existing, not a regression.

Outstanding (handed off, baseline-machine-only): §4.9 ARM64 stable-AC perf
ratification + §4.4 §11.6 hard byte-gate measurement/enforcement.

Co-authored-by: Copilot <[email protected]>

* spec-047 §4.10: address PR #455 CR feedback (echo-suppression + Element bucketing)

CR item #1 (GridView/ListBox deferred-echo) — revert SelectedIndex to the
causal counter (ShouldSuppress/WriteSuppressed; drop the §8 value-diff arm),
restoring main's mechanism. Empirically probed on this box: post-realization
SelectionChanged is synchronous (deferral is mount-only), the counter and the
value-diff arm behave identically in every production-reachable path, and the
guarded -1 no-op leaves the echo counter at 0 (no strand) so a later genuine
deselect still fires. The counter gate suppresses the whole trampoline fire,
so it also governs the multi-select snapshot OnSelectionChanged (CR #3) and the
guarded-no-op self-clear concern is moot (CR #4). ComboBox/toggles/pickers keep
the value-diff arm (synchronous by construction). Descriptor + fixture
narration updated to match.

CR item #2 (empty ElementExtras bucket) — normalize the 14 bucketed init shims
via ElementExtras.IsEmpty + Element.NormalizeExtras so writing a bucketed field
to null never materializes/keeps a non-null empty bucket. An empty bucket is
not Equals to null, which otherwise broke record equality between an extras-free
element and one with a field cleared to null. New ElementExtrasBucketTests.

CR item #6 — make Element.Extensions setter internal to remove the
initializer-ordering footgun from the public surface (no in-repo external
writes; bucketed shim properties stay public).

Nits — ComboBox stale ShouldSuppress doc; PerformanceBudgets §4.9 dead-code
TODO; Reconciler ContinueDefaultTraversal cref namespace fix (clears the CS1574
warning); TabView pinnable-tab "not byte-identical" callout; ContentDialog
OnClosed tag-routing follow-up note; §4.4 ElementExtras construction-cost note.

Verified: core builds clean (ARM64 + x64), Reactor.Tests 9132 passed / 62 skip,
selftest ValueDiff/Echo/ComboBox/GridView/ListBox/SelectionEvent/EventStateSplit
fixtures all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request Jun 2, 2026
Code-review findings (C:\temp\reactor-advanced-win2d-review.md):

  #1 HIGH — initially paused Win2DAnimatedCanvas can never resume
    Win2DAnimatedCanvasHandler.Mount wrote ctrl.Paused = el.IsPaused, but
    Update never writes Paused (intentional: Win2D-on-WinUI-3 game-thread
    park bug). An app mounted with isPaused:true could never unpause.
    Fixed: never touch ctrl.Paused at any stage; IsPaused gates the user's
    OnUpdate delegate via InvokeUpdate. New selftest fixture
    'Win2D_AnimatedCanvas_InitialPausedResumes' locks in the invariant.

  #2 HIGH — unsynchronized Ref<T> across UI/game threads
    Rewrote UseDrawState XML doc to be honest: Ref<T> is a plain
    auto-property, has no memory barriers, does not protect compound
    mutations. New doc lists per-shape synchronization options (volatile,
    Interlocked, lock, producer/consumer queue). Updated win2d-canvas.md.dt
    threading section to match.
    Fixed the actual race in ParticleStorm: Burst is now a
    ConcurrentQueue<(x,y,n)> producer; ParticleField.Step drains the queue
    on the game thread BEFORE iterating the particle array. No more torn
    Particle structs from UI-thread mutation racing the game-thread loop.

  #3 MED — RedrawKey uses reference equality
    Win2DCanvasHandler diff was !ReferenceEquals; boxed ints differ across
    renders, so every parent re-render triggered a redundant Invalidate.
    Switched to !Equals. New selftest fixture
    'Win2D_Canvas_SameRedrawKeyNoExtraDraws' verifies the no-op behavior.

  #4 MED — docs/sample reference nonexistent '.Of(...)' API
    Updated win2d-canvas.md.dt (4 occurrences), cheat-sheet.md.dt (1),
    samples/apps/particle-storm/README.md (1) to match the actual factory
    shape: Win2DCanvas(...) / Win2DAnimatedCanvas(...) / Win2DVirtualCanvas(...)
    via 'using static Microsoft.UI.Reactor.Advanced.Factories;'.
    Recompiled docs/guide/win2d-canvas.md and docs/guide/cheat-sheet.md.

  #5 MED — missing screenshot + placeholder perf
    Removed broken ../../samples/apps/particle-storm/screenshot.png
    reference from the Win2D guide template (this was the mkdocs --strict
    failure on the CI Docs build job). Toned down the 'canonical
    performance proof' claim — Particle Storm is now described as the
    'canonical worked example' and the guide tells readers to capture
    their own FPS numbers on their own hardware.

  #6 MED — skipped placeholder tests
    Selftest coverage gap acknowledged. Added two new fixtures (above) to
    cover the two scenarios most affected by review bugs (#1 and #3).
    The headless xUnit placeholders for handler updates and device-loss
    remain skipped — those genuinely need live WinUI activation, which
    the AppTests.Host selftest tier provides.

  #7 LOW — silent catches in PackLocalCommand
    Replaced catch { /* best effort */ } with explicit Console.Error
    warnings (stale-package cleanup + HTTP-cache-clear paths). Pack-local
    still succeeds when cleanup fails, but the user sees why.

CodeQL inline findings:

  - Win2DCanvasFixtures.WaitForCollectedOrDetached: removed GC.Collect()
    calls. Visual-tree detach check is the observable invariant; weak-ref
    is a secondary signal under normal GC, not a forced collection probe.
  - Win2DVirtualCanvasHandler.Update: replaced double != check with a
    SizesEqual helper using a 0.5 DIP epsilon (below display rounding,
    above float-precision noise from layout/devicescale math).
  - PackLocalCommand / TrimAssertions / threading test Path.Combine
    warnings: not addressed (low priority, all in test/CLI code; intent
    is clear and operands are repo-internal).

CI failures (https://github.com/microsoft/microsoft-ui-reactor/actions/runs/26819092595,
                https://github.com/microsoft/microsoft-ui-reactor/actions/runs/26819092535):

  - Pack (x64 + arm64) — NU5026 'Reactor.Advanced.dll not found': the
    release workflow's 'dotnet build/pack' runs without -p:Platform, so
    MSBuild defaults to AnyCPU. Reactor.Advanced.csproj had
    Platforms='x64;ARM64' only (no AnyCPU). Added AnyCPU to match
    Reactor.csproj. Both Pack steps now resolve.
  - Docs build — mkdocs --strict failed on the broken screenshot link
    (review finding #5 above); removing the reference fixes it.

Verification:

  - dotnet build Reactor.slnx -p:Platform=x64: clean (0/0).
  - dotnet test tests/Reactor.Advanced.Tests -p:Platform=x64: 27 passed.
  - Win2D selftests (JIT): 5 fixtures, 11/11 assertions green
    (added InitialPausedResumes + SameRedrawKeyNoExtraDraws).
  - mur docs compile --topic win2d-canvas/cheat-sheet: clean.

Co-authored-by: Copilot <[email protected]>
Chris Anderson (codemonkeychris) added a commit that referenced this pull request Jun 2, 2026
* spec 053: Reactor.Advanced + Win2D canvas integration

Implements docs/specs/053-reactor-advanced-and-win2d-canvas.md across all
four phases (per the implementation tracker):

Phase 1 — Library + L0/L1
- src/Reactor.Advanced/: new sibling library, ProjectReference-only consumer
  of Reactor core (no InternalsVisibleTo). Three element/handler triples
  (Win2DCanvas / Win2DAnimatedCanvas / Win2DVirtualCanvas) plus modifiers
  (ClearColor, Paused, TargetFps, Set) and three hooks (UseDrawState,
  UseCanvasResources, UseDrawCommand).
- Per-library trim unit: Factories class with single static cctor registers
  all three handlers. Authors consume via 'using static Microsoft.UI.Reactor
  .Advanced.Factories;' alongside the core factories, calling factories by
  their natural name (Win2DCanvas(...) etc.) — matching the in-tree DSL
  pattern. Touching any factory roots all three; touching none strips all
  three (verified by AOT trim probes).
- tests/Reactor.Advanced.Tests/: 27 passing, 4 skipped-covered-by-selftests.
- tests/aot_trim_proof/Reactor.AotHelloWorld.Advanced{,.Positive}{,.TrimAssertions}/:
  negative (zero handlers when no canvas factory called) + positive
  (handlers present when Win2DCanvas(...) is called) trim probes.
- mur pack-local now emits Microsoft.UI.Reactor.Advanced.{version}.nupkg
  alongside the core package.

Phase 1 game-thread isolation fix
- Win2DAnimatedCanvas Update/Draw fire on Win2D's game thread, not the
  WinUI dispatcher. Original Reactor binding path called DependencyProperty
  APIs from the trampoline, producing RPC_E_WRONG_THREAD (0xC000027B with
  WER P7=8001010e) at AOT-published startup. Fixed by subscribing Update/
  Draw directly with a volatile per-control element holder and tracking
  unsubscribe delegates for clean Unmount.

Phase 1 IsPaused workaround
- Writing CanvasAnimatedControl.Paused causes a known Win2D-on-WinUI-3 bug:
  the game thread wakes for exactly one tick after Paused=false and then
  parks permanently. Handler now never writes ctrl.Paused — IsPaused
  instead gates the user's OnUpdate callback (simulation stops) while
  leaving OnDraw active (last frame stays visible). Authors who want true
  game-thread suspension can opt in via Setters.

Phase 2 — Particle Storm sample
- samples/apps/particle-storm/: ~50k-particle Win2D animated canvas demo
  with chase/idle physics modes, cursor-driven gravity, periodic auto-
  burst, speed-modulated palette, real wall-clock fps meter, AOT publish
  gate. Sidebar is a Component<SidebarProps> per Reactor convention.

Phase 3 — Docs + selftests + skill
- docs/_pipeline/apps/win2d-canvas/ + templates/win2d-canvas.md.dt:
  doc-app with 4 snippets + manifest, comprehensive-tier guide page.
- tests/Reactor.AppTests.Host/SelfTest/Fixtures/Win2DCanvasFixtures.cs:
  three fixtures (manual/animated/virtual canvas mount), two-place
  registration in SelfTestFixtureRegistry, all 7 assertions green under
  both JIT and AOT.
- skills/advanced.md + plugins/reactor/skills/reactor-advanced/SKILL.md:
  two-place agent skill install; bundled into the Advanced nupkg under
  agentkit/skills/reactor-advanced.md.

Supporting changes outside spec-053 scope (justified):
- src/Reactor.Analyzers{,.Internal}/, Reactor.Localization.Generator/:
  added TreatAsLocalProperty='PublishTrimmed' + PublishTrimmed=false so
  Roslyn analyzer ProjectReferences don't inherit Reactor.Advanced's
  PublishTrimmed=true (NETSDK1207 isolation).
- src/Reactor.Cli/Pack/PackLocalCommand.cs: added Advanced as a third
  pack target.

Verification gates green:
- dotnet build Reactor.slnx -p:Platform=x64 — 0/0
- dotnet test tests/Reactor.Advanced.Tests -p:Platform=x64 — 27 passed
- Win2D selftests under JIT and AOT — 7/7 assertions each
- mur pack-local — produces 3 nupkgs side-by-side
- AOT trim probes — negative shows handlers stripped; positive shows present
- src/Reactor/ unchanged (per spec section 2 Goal 5)

Co-authored-by: Copilot <[email protected]>

* docs: recompile cheat-sheet, advanced, architecture-overview after spec-053 template edits

Phase 3's full mur docs compile run hung partway, so only docs/guide/win2d-canvas.md was
regenerated in the initial PR commit. The cheat-sheet / advanced / architecture-overview
templates had spec-053 cross-link edits that hadn't been compiled through. Running each
topic individually completed cleanly.

Co-authored-by: Copilot <[email protected]>

* spec 053: address review feedback + fix CI failures

Code-review findings (C:\temp\reactor-advanced-win2d-review.md):

  #1 HIGH — initially paused Win2DAnimatedCanvas can never resume
    Win2DAnimatedCanvasHandler.Mount wrote ctrl.Paused = el.IsPaused, but
    Update never writes Paused (intentional: Win2D-on-WinUI-3 game-thread
    park bug). An app mounted with isPaused:true could never unpause.
    Fixed: never touch ctrl.Paused at any stage; IsPaused gates the user's
    OnUpdate delegate via InvokeUpdate. New selftest fixture
    'Win2D_AnimatedCanvas_InitialPausedResumes' locks in the invariant.

  #2 HIGH — unsynchronized Ref<T> across UI/game threads
    Rewrote UseDrawState XML doc to be honest: Ref<T> is a plain
    auto-property, has no memory barriers, does not protect compound
    mutations. New doc lists per-shape synchronization options (volatile,
    Interlocked, lock, producer/consumer queue). Updated win2d-canvas.md.dt
    threading section to match.
    Fixed the actual race in ParticleStorm: Burst is now a
    ConcurrentQueue<(x,y,n)> producer; ParticleField.Step drains the queue
    on the game thread BEFORE iterating the particle array. No more torn
    Particle structs from UI-thread mutation racing the game-thread loop.

  #3 MED — RedrawKey uses reference equality
    Win2DCanvasHandler diff was !ReferenceEquals; boxed ints differ across
    renders, so every parent re-render triggered a redundant Invalidate.
    Switched to !Equals. New selftest fixture
    'Win2D_Canvas_SameRedrawKeyNoExtraDraws' verifies the no-op behavior.

  #4 MED — docs/sample reference nonexistent '.Of(...)' API
    Updated win2d-canvas.md.dt (4 occurrences), cheat-sheet.md.dt (1),
    samples/apps/particle-storm/README.md (1) to match the actual factory
    shape: Win2DCanvas(...) / Win2DAnimatedCanvas(...) / Win2DVirtualCanvas(...)
    via 'using static Microsoft.UI.Reactor.Advanced.Factories;'.
    Recompiled docs/guide/win2d-canvas.md and docs/guide/cheat-sheet.md.

  #5 MED — missing screenshot + placeholder perf
    Removed broken ../../samples/apps/particle-storm/screenshot.png
    reference from the Win2D guide template (this was the mkdocs --strict
    failure on the CI Docs build job). Toned down the 'canonical
    performance proof' claim — Particle Storm is now described as the
    'canonical worked example' and the guide tells readers to capture
    their own FPS numbers on their own hardware.

  #6 MED — skipped placeholder tests
    Selftest coverage gap acknowledged. Added two new fixtures (above) to
    cover the two scenarios most affected by review bugs (#1 and #3).
    The headless xUnit placeholders for handler updates and device-loss
    remain skipped — those genuinely need live WinUI activation, which
    the AppTests.Host selftest tier provides.

  #7 LOW — silent catches in PackLocalCommand
    Replaced catch { /* best effort */ } with explicit Console.Error
    warnings (stale-package cleanup + HTTP-cache-clear paths). Pack-local
    still succeeds when cleanup fails, but the user sees why.

CodeQL inline findings:

  - Win2DCanvasFixtures.WaitForCollectedOrDetached: removed GC.Collect()
    calls. Visual-tree detach check is the observable invariant; weak-ref
    is a secondary signal under normal GC, not a forced collection probe.
  - Win2DVirtualCanvasHandler.Update: replaced double != check with a
    SizesEqual helper using a 0.5 DIP epsilon (below display rounding,
    above float-precision noise from layout/devicescale math).
  - PackLocalCommand / TrimAssertions / threading test Path.Combine
    warnings: not addressed (low priority, all in test/CLI code; intent
    is clear and operands are repo-internal).

CI failures (https://github.com/microsoft/microsoft-ui-reactor/actions/runs/26819092595,
                https://github.com/microsoft/microsoft-ui-reactor/actions/runs/26819092535):

  - Pack (x64 + arm64) — NU5026 'Reactor.Advanced.dll not found': the
    release workflow's 'dotnet build/pack' runs without -p:Platform, so
    MSBuild defaults to AnyCPU. Reactor.Advanced.csproj had
    Platforms='x64;ARM64' only (no AnyCPU). Added AnyCPU to match
    Reactor.csproj. Both Pack steps now resolve.
  - Docs build — mkdocs --strict failed on the broken screenshot link
    (review finding #5 above); removing the reference fixes it.

Verification:

  - dotnet build Reactor.slnx -p:Platform=x64: clean (0/0).
  - dotnet test tests/Reactor.Advanced.Tests -p:Platform=x64: 27 passed.
  - Win2D selftests (JIT): 5 fixtures, 11/11 assertions green
    (added InitialPausedResumes + SameRedrawKeyNoExtraDraws).
  - mur docs compile --topic win2d-canvas/cheat-sheet: clean.

Co-authored-by: Copilot <[email protected]>

* spec 053: fix release Pack CI + address new CR feedback (round 2)

CI fix — Pack (x64 + arm64) job:

  Local repro on Reactor.slnx Release build:
    src/Reactor/bin/Release/.../Reactor.dll               present (AnyCPU)
    src/Reactor/bin/ARM64/Release/.../Reactor.dll         present (ARM64)
    src/Reactor.Advanced/bin/ARM64/Release/.../*.dll      present (ARM64)
    src/Reactor.Advanced/bin/Release/.../*.dll            MISSING

  Reactor.csproj happens to land at bin/Release/ (AnyCPU) because its
  analyzer ProjectReferences (netstandard2.0 AnyCPU) force an AnyCPU
  sub-build. Reactor.Advanced has no AnyCPU-forcing consumer in the
  slnx, so the no-Platform 'dotnet build Reactor.slnx --configuration
  Release' only builds it for ARM64. The 'dotnet pack --no-build'
  Advanced step then looks at bin/Release/ and fails with NU5026.

  Added explicit 'Build Advanced (AnyCPU)' step before 'Pack Advanced
  NuGet' in .github/workflows/release.yml, mirroring the Templates
  pattern (which also passes -p:Platform=AnyCPU). The Pack step now
  uses -p:Platform=AnyCPU for symmetry.

  Verified locally that the produced nupkg contains
  lib/net10.0-windows10.0.22621/Reactor.Advanced.dll plus .pri, .xml,
  and the bundled agentkit/skills/reactor-advanced.md.

CR feedback (round 2, github-code-quality bot):

  - src/Reactor.Cli/Pack/PackLocalCommand.cs:68 — Path.Combine
    flagged. Switched to Path.Join (preserves segments even if a
    later segment is rooted; relevant defense-in-depth here).
  - src/Reactor.Cli/Pack/PackLocalCommand.cs:159 — generic catch in
    DeleteStaleNupkg. Replaced with specific catches for IOException,
    UnauthorizedAccessException, and System.Security.SecurityException
    (the three real failure modes for File.Delete).
  - src/Reactor.Advanced/Win2D/Hooks/UseCanvasResources.cs:69 —
    generic 'catch when (disposed)' on the create() failure path.
    Replaced with typed catches for OperationCanceledException and
    ObjectDisposedException (the cancellation/teardown races that
    actually happen here); other failures still propagate so real
    create() bugs aren't masked.
  - tests/aot_trim_proof/.../TrimAssertionTests.cs:56 — Path.Combine
    on appDirectoryName. Added an IsPathRooted guard (returns
    string.Empty on invalid input, matching the existing failure
    behavior) and switched to Path.Join for the combine.

Verification:

  - dotnet build Reactor.slnx -p:Platform=x64: clean (0/0).
  - dotnet test tests/Reactor.Advanced.Tests -p:Platform=x64: 27 passed.
  - Standalone pack verified: nupkg contains Reactor.Advanced.dll.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jul 7, 2026
…me tokens)

Implements docs/specs/061 Phase 2 - the deterministic vocabulary did-you-mean
case that is still live against the current Reactor surface, as a Roslyn
analyzer + paired code fix:

- REACTOR_DYM_002 ThemeBackgroundSuffixAnalyzer: an invented Theme.*Background
  token (CS0117, e.g. Theme.AppBackground) -> Theme.SolidBackground;
  Theme.LayerBackground -> Theme.LayerFill. Mirrors mur check
  ThemeBackgroundSuffixRule.

It fires only when the access did not bind (always co-occurs with CS0117, so
Warning is safe under TreatWarningsAsErrors), requires the receiver to be
exactly Microsoft.UI.Reactor.Core.Theme, and self-disables if the target no
longer exists on the live surface. The local vocab map is locked to the CLI
Tier-3 rule by a cross-check parity test; full shared-engine unification is a
spec-061 follow-up.

The alignment case (corpus #4, .VerticalAlignment/.HorizontalAlignment) is
deliberately NOT shipped: ElementExtensions already defines those as real
modifier aliases (commit e38b57c, #319), so the calls bind and no CS1061
occurs - an in-build analyzer there would be dead code and could mis-fire on a
wrong-argument call. Spec 061 section 6 documents this and flags the now-obsolete
mur check AlignmentShortcutRule for follow-up removal.

Co-authored-by: Copilot App <[email protected]>
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jul 8, 2026
…ackground tokens) (#829)

* Analyzers: ship Phase 2 in-build "did you mean" (REACTOR_DYM_002, Theme tokens)

Implements docs/specs/061 Phase 2 - the deterministic vocabulary did-you-mean
case that is still live against the current Reactor surface, as a Roslyn
analyzer + paired code fix:

- REACTOR_DYM_002 ThemeBackgroundSuffixAnalyzer: an invented Theme.*Background
  token (CS0117, e.g. Theme.AppBackground) -> Theme.SolidBackground;
  Theme.LayerBackground -> Theme.LayerFill. Mirrors mur check
  ThemeBackgroundSuffixRule.

It fires only when the access did not bind (always co-occurs with CS0117, so
Warning is safe under TreatWarningsAsErrors), requires the receiver to be
exactly Microsoft.UI.Reactor.Core.Theme, and self-disables if the target no
longer exists on the live surface. The local vocab map is locked to the CLI
Tier-3 rule by a cross-check parity test; full shared-engine unification is a
spec-061 follow-up.

The alignment case (corpus #4, .VerticalAlignment/.HorizontalAlignment) is
deliberately NOT shipped: ElementExtensions already defines those as real
modifier aliases (commit e38b57c, #319), so the calls bind and no CS1061
occurs - an in-build analyzer there would be dead code and could mis-fire on a
wrong-argument call. Spec 061 section 6 documents this and flags the now-obsolete
mur check AlignmentShortcutRule for follow-up removal.

Co-authored-by: Copilot App <[email protected]>

* Address Copilot review: spec Status label + test comment wording

- Spec 061 Status: "Proposed" -> "Implemented (in part)" to match the
  repo convention now that Phases 1-2 have shipped (fuzzy phases stay
  design-only).
- Reword the Theme test stub comment for clarity ("binds fine" negative
  case).

Co-authored-by: Copilot App <[email protected]>

* Add alias + fully-qualified Theme receiver tests (Copilot review round 2)

Empirically confirms REACTOR_DYM_002 fires when Theme is reached through a
using-alias or a global::-qualified name: GetSymbolInfo resolves an alias to
its target type (the alias is only surfaced via GetAliasInfo), so the
exact-Theme symbol-equality gate still matches. Documents why the receiver
uses GetSymbolInfo (a static class has no GetTypeInfo value type).

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
ReneeGA2020 pushed a commit to ReneeGA2020/microsoft-ui-reactor that referenced this pull request Jul 9, 2026
Add ControlledInputAnalyzer (Reactor.Hooks, Warning) + code fix. Flags a
controlled-input DSL factory call (TextBox, PasswordBox, NumberBox, Slider,
ComboBox, CheckBox, ToggleSwitch, RatingControl, CalendarDatePicker, …) whose
value argument is state-derived (identifier / member access) but whose change
callback is present yet inert — an empty-block lambda or a lambda that never
references its parameter. The control renders the value and silently drops the
user's edits (the XAML Mode=OneWay / read-it-back-via-x:Name habit).

Gating (spec 060 §4.1): fires only on an explicit state-derived value; a bare
TextBox("label") or an omitted callback is a legitimate read-only display and is
left alone. Factory shapes are non-uniform (ComboBox's value is arg microsoft#2, Slider's
callback is arg microsoft#4), so value/callback are matched by parameter type — the single
Optional<T> value param and the first delegate param — not by fixed position. An
explicit .IsReadOnly(true)/.IsReadOnly() already in the chain suppresses the rule.

Fix (TextBox, RatingControl only — the two controls with an IsReadOnly modifier):
wraps the call with .IsReadOnly(true) to make read-only intent explicit. Controls
without IsReadOnly are nudge-only. Never .IsEnabled(false) (destructive).

Adds the AnalyzerReleases.Unshipped row, the agent-kit cheat-table row, and the
analyzer-architecture template rules-table row. 20 analyzer/code-fix tests.

Co-authored-by: Copilot App <[email protected]>
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