Skip to content

Sync from ADO: Clean up Reactor build warnings (PR 15346990) - #6

Merged
Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
sync/ado-8550e0d
Apr 17, 2026
Merged

Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
sync/ado-8550e0d

Conversation

@codemonkeychris

Copy link
Copy Markdown
Collaborator

Mirroring the latest merge on the ADO source-of-truth (andersonch.Patch / PR 15346990) into the GitHub mirror.

Upstream commit

8550e0d — Clean up Reactor build warnings after Duct rename

  • Remove duplicate using directives (CS0105) in DataGrid and FlexPanel left behind by the Duct → Reactor rename
  • Fix latent nullable warnings: CS8604 in PropertyGridComponent and CS8620 in DataGridComponent overlay children
  • #pragma warning disable CS8305 around the ElementFactory usage in Reconciler.Update — we control the WinUI version and rely on this API
  • Set PlatformTarget=AnyCPU on Reactor.Localization.Generator.csproj so the source-generator DLL is arch-neutral instead of inheriting Platform=x64 and tripping CS8034 on load

Verification (from upstream PR)

  • Full rebuild of Reactor — 0 warnings, 0 errors
  • dotnet test tests/Reactor.Tests — 3515 passed, 0 failed
  • AppTests self-test — 0 failures
  • stress_perf 50% @ 7s across all 6 variants — clean

Sync policy

Going forward, each ADO merge gets pushed to a sync/ado-<sha> branch here and opens a PR — no more force-pushes to main.

## Summary
- Remove duplicate `using` directives (CS0105) in DataGrid and FlexPanel left behind by the Duct → Reactor rename
- Fix latent nullable warnings: CS8604 in PropertyGridComponent and CS8620 in DataGridComponent overlay children
- `#pragma warning disable CS8305` around the `ElementFactory` usage in `Reconciler.Update` — we control the WinUI version and rely on this API
- Set `PlatformTarget=AnyCPU` on `Reactor.Localization.Generator.csproj` so the source-generator DLL is truly arch-neutral instead of inheriting `Platform=x64` from the consumer project and tripping CS8034 on load

## Test plan
- [x] Full rebuild of `Reactor/Reactor.csproj` — 0 warnings, 0 errors
- [x] `dotnet test tests/Reactor.Tests` — 3515 passed, 0 failed
- [x] `dotnet run --project tests/Reactor.AppTests.Host -- --self-test` — `# Total failures: 0`
- [x] stress_perf 50% @ 7s across all 6 variants (Wpf, Direct, Bound, Reactor, ReactorGrid, DirectX) — all report clean
@codemonkeychris
Chris Anderson (codemonkeychris) merged commit bc9d2fa 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
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]>
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 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
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
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]>
@codemonkeychris
Chris Anderson (codemonkeychris) deleted the sync/ado-8550e0d 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]>
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