Skip to content

feat: Phase 3 — Event handler wiring & DataBind pattern conversion (GAP-09, GAP-32)#114

Open
csharpfritz wants to merge 7 commits intodevfrom
feature/phase3-databind-events
Open

feat: Phase 3 — Event handler wiring & DataBind pattern conversion (GAP-09, GAP-32)#114
csharpfritz wants to merge 7 commits intodevfrom
feature/phase3-databind-events

Conversation

@csharpfritz
Copy link
Copy Markdown
Owner

Summary

Phase 3 of the migration automation initiative, adding two critical L1 script transforms that Forge's analysis identified as eliminating ~70% of remaining manual migration work.

What's New

🎯 Event Handler Wiring (GAP-32) — "Make event binding compile"

Adds @ prefix to event handler attributes in markup so Blazor's Razor compiler resolves method references correctly:

<!-- Before (Phase 2 output) -->
<Button id="btnSave" Text="Save" OnClick="Save_Click" />

<!-- After (Phase 3) -->
<Button id="btnSave" Text="Save" OnClick="@Save_Click" />
  • New function: Convert-EventHandlerWiring
  • Regex-safe: only targets On[A-Z]* attributes with bare C# identifiers
  • Handles all event types: OnClick, OnTextChanged, OnSelectedIndexChanged, OnRowCommand, etc.

📊 DataBind Pattern Conversion (GAP-09) — "Make data binding work"

Cross-file transform that converts the DataSource/DataBind() pattern to Blazor's reactive Items binding:

Code-behind:

// Before
gvProducts.DataSource = GetProducts();
gvProducts.DataBind();

// After (generated)
private IEnumerable<object> _gvProductsData;
_gvProductsData = GetProducts();

Markup (correlated by control ID):

<!-- Before -->
<GridView id="gvProducts" />

<!-- After -->
<GridView id="gvProducts" Items="@_gvProductsData" />

New functions:

  • Get-DataBindMap — Pre-scans code-behind for cross-file correlation
  • Convert-DataBindPattern — Code-behind field generation + DataSource/DataBind removal
  • Add-DataBindItemsAttribute — Markup Items attribute injection

Test Results

25/25 L1 tests pass (100%) — 618/618 lines match

Test Description
TC22 DataBind with GridView (Page_Load → OnInitializedAsync + Items binding)
TC23 DataBind with multiple controls (GridView + Repeater)
TC24 Event wiring with 4 event types
TC25 Combined — DataBind + event wiring on same page
TC20/TC21 Updated expected output for @ prefix

Documentation

  • docs/Migration/Phase3-EventHandlerWiring.md
  • docs/Migration/Phase3-DataBindConversion.md
  • mkdocs.yml — Phase 3 section added
  • CODE-TRANSFORMS.md — Phase 3 patterns added

csharpfritz and others added 7 commits March 29, 2026 21:49
…AP-09, GAP-32)

Add two critical L1 script transforms that eliminate ~70% of remaining manual migration work:

Event Handler Wiring (GAP-32):
- Convert-EventHandlerWiring adds @ prefix to On* event attributes in markup
- OnClick="Handler"  OnClick="@handler" for proper Blazor event binding
- Handles all Web Forms event attributes (OnClick, OnTextChanged, OnRowCommand, etc.)
- Regex-safe: only targets bare C# identifiers, skips existing @ expressions

DataBind Pattern Conversion (GAP-09):
- Convert-DataBindPattern transforms DataSource/DataBind() in code-behind
- Get-DataBindMap pre-scans code-behind for cross-file markup correlation
- Add-DataBindItemsAttribute injects Items="@_fieldName" on matching markup tags
- Generates private IEnumerable<object> backing fields with _controlNameData naming

Tests: 25/25 L1 tests pass (100%), 618/618 lines match
- TC22: DataBind with GridView
- TC23: DataBind with multiple controls (GridView + Repeater)
- TC24: Event wiring with multiple event types
- TC25: Combined DataBind + event wiring
- TC20/TC21 updated for @ prefix in expected output

Docs: Phase3-EventHandlerWiring.md, Phase3-DataBindConversion.md
Skills: CODE-TRANSFORMS.md updated with Phase 3 section
Nav: mkdocs.yml updated with Phase 3 section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Covers the cumulative impact of all three automation phases:
- Phase 1: compilation (directives, markup, structure)
- Phase 2: runtime (lifecycle, signatures, session shims)
- Phase 3: data & events (DataBind conversion, event wiring)

Includes before/after comparisons, time savings estimates,
test coverage summary, and remaining manual work guidance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Shallow clones (fetch-depth: 1) cause Nerdbank.GitVersioning to fail
because it cannot walk the commit graph to calculate version heights.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Shallow clones (fetch-depth: 1) cause Nerdbank.GitVersioning to fail
because it cannot walk the commit graph to calculate version heights.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Strategic shift: L1 PowerShell frozen at Phase 3 (~70% automation).
Remaining migration gaps converted to Copilot skills for L2 transforms:
- bwfc-session-state: Application/Cache/HttpContext patterns
- bwfc-middleware-migration: HttpModule and Global.asax conversion
- bwfc-usercontrol-migration: .ascx to component with [Parameter]
- Enhanced identity migration skill with Forms Auth guidance
- Updated CODE-TRANSFORMS.md with Phase 4 skills section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Session: 2026-03-30-phase4-skills-and-ci-fix
Requested by: Scribe (Orchestration)

Changes:
- Created session log: 2026-03-30-phase4-skills-and-ci-fix.md
- Merged decisions: Added bishop-ci-fix (fetch-depth: 0 for NBGV)
- Created Phase 4 skills structure: .ai-team/decisions/inbox/
- Updated agent histories: Bishop (CI fix), Psylocke (Phase 4 skills freeze)
- Copied decision inbox files to canonical .ai-team/decisions/inbox/ path

Bishop work: Fixed squad-ci.yml NBGV shallow clone issue (PR #114 unblock)
Psylocke work: Froze L1 PowerShell at Phase 3, created Phase 4 skills for contextual transforms (session-state, middleware, usercontrol, identity v2)

Consolidated decision: L1 script deterministic limit reached (~70%). Remaining 30% migrates to L2 Copilot skills (Phase 4) and L3 developer judgment (Phase 5+).
- Forge's architecture proposal for webforms-to-blazor C# global tool
- Sequential pipeline design mapping 41 PS functions to ~30 C# classes
- Two public commands: migrate (full project) and convert (single file)
- Analysis stays internal (feeds into migrate --report)
- 25 L1 test cases become xUnit acceptance tests
- Security: no shell-out, no eval, signed NuGet package
- AI hook via --use-ai flag for L2 Copilot skill integration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant