You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: postback target ID mismatch + wait for JS bootstrap in tests
- WebFormsPageBase: _postBackTargetId now uses GetType().Name to match
ResolveControlId() (was appending _GetHashCode() causing lookup miss)
- PostBackTests: wait for __doPostBack function before clicking (race fix)
- PostBackTests: use Assertions.Expect().ToContainTextAsync() instead of
fixed 2-second delays for more reliable CI assertions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .ai-team/agents/bishop/history.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,3 +214,21 @@ Added `ClientScriptTransform.cs` (Order 850) to the code-behind pipeline. Handle
214
214
-**Tests:** All 349 tests pass (same count as before), updated 20 unit test assertions + TC33 expected output file.
215
215
-**Regex approach:** Single `PageOrThisPrefixRegex` with lookahead handles all three shim-compatible methods in one pass. Much simpler than the old per-pattern regexes with inline script extraction.
-`PageOrThisPrefixRegex` lookahead expanded to include `GetPostBackEventReference`
229
+
- Removed `GetPostBackEventRefRegex` and `ScriptManagerGetCurrentRegex` (TODO-emitting regexes)
230
+
- Added `ScriptManagerGetCurrentPageRegex` for Page→this substitution
231
+
-**Shim comment:** Now conditionally mentions `ScriptManagerShim` when ScriptManager patterns detected (dual-shim comment)
232
+
-**Tests:** 353 total (was 349) — 4 new test cases for Phase 2 patterns, updated 6 existing assertions
233
+
-**Key design decision:**`hasScriptManagerCall` flag tracks ScriptManager presence separately from `hasShimCall` to conditionally generate the dual-shim comment
Copy file name to clipboardExpand all lines: .squad/agents/beast/history.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
-**Stack:** C#, Blazor, .NET, ASP.NET Web Forms, bUnit, xUnit, MkDocs, Playwright
6
6
-**Created:** 2026-02-10
7
7
8
-
8
+
9
9
📌 Team update (2026-08-XX): ClientScriptShim documentation delivery — Updated ClientScriptMigrationGuide.md with prominent new section positioning ClientScriptShim as zero-rewrite path (+2,100 lines total), including supported methods table, before/after example, "How It Works" technical explanation, and migration approach comparison (ClientScriptShim vs. manual IJSRuntime vs. JS modules). Updated BWFC022.md, BWFC023.md, BWFC024.md analyzer docs with cross-references to new ClientScriptShim guidance. mkdocs.yml verified (guide already in nav). Strategy: Lead with easiest path first (ClientScriptShim), then modern alternatives for teams ready to modernize. Enables rapid migration for large Web Forms codebases. — decided by Beast
10
10
11
11
📌 Team update (2026-07-30): ClientScript Migration Support PRD delivered 9-section product requirements document (dev-docs/prd-clientscript-migration-support.md, 38K) covering analyzer improvements (BWFC022/023/024), CLI transforms (startup scripts, includes), safe automation boundaries, TODO guidance, documentation (ClientScriptMigrationGuide.md), testing (8 test cases), and 3-phase roadmap (P1: analyzers + transforms + docs, P2: samples, P3: runtime helpers). Based on Forge CLI Gap Analysis 1.2 (HIGH impact gap). Establishes BWFC position: prefer IJSRuntime over ClientScript shim; emit clear TODO for postback patterns; DO NOT emulate __doPostBack. Ready for implementation planning. decided by Beast
**Status:** Compiles clean (0 errors). Demo page not yet created by Jubilee — tests will pass once the page exists.
301
+
**Patterns used:** Same `[Collection(nameof(PlaywrightCollection))]` + `PlaywrightFixture` pattern as all other migration tests. 30s navigation timeout, 10s element wait, 2s post-action settle for CI reliability. `try/finally` with `page.CloseAsync()`.
302
+
**Commit:**`0c75aba2` on `feature/clientscript-phase2`
**Summary:** Replaced NotSupportedException stubs with working PostBack/Callback implementations. Created full JS interop bridge for __doPostBack and ScriptManager.GetCurrent() pattern.
- System.CommandLine tests work by reconstructing the command tree locally rather than trying to invoke Program.Main — this decouples from Bishop's refactoring of Program.cs.
491
491
- Test case count: 21 TC* cases (TC01-TC21), of which 8 have code-behind pairs (TC13-TC16, TC18-TC21). Total 29 input files + 29 expected files = 58 TestData files.
**Wrote 35 new unit tests across 3 files for Phase 2 shims.** All 70 targeted tests pass (including pre-existing Phase 1 tests) across net8.0/net9.0/net10.0. Zero regressions (55 pre-existing failures in ViewState/RequestShim unrelated).
496
+
497
+
**Files modified/created:**
498
+
-`ClientScriptShimTests.cs` (modified) — 15 new tests: GetPostBackEventReference escaping (single quotes, backslashes), output format, null/empty args, control type resolution; GetPostBackClientHyperlink consistency with EventReference, null control, escaping; GetCallbackEventReference escaping (single quotes, backslashes in context), null context/argument defaults, output format with all params.
-`PostBackEventArgsTests.cs` (created) — 11 tests: Constructor sets EventTarget/EventArgument, null target/argument allowed, both null, empty strings; Immutability via reflection (CanWrite=false); Inherits from System.EventArgs; Round-trip with special characters, Unicode, long strings.
501
+
502
+
**Key patterns used:**
503
+
- Reflection to inject `_clientScript`/`_clientScriptResolved` on `Mock<BaseWebFormsComponent>` for `GetCurrent` success test (ClientScript property is non-virtual, can't be mocked directly).
504
+
- Fully-qualified `BlazorWebFormsComponents.BaseWebFormsComponent` required — test project has a `BaseWebFormsComponent/` folder creating namespace ambiguity. Same for `System.EventArgs` vs `EventArgs/` folder.
505
+
-`dotnet test --filter` uses `|` for OR (not `OR` keyword) in vstest filter expressions.
# Decision: CLI Transform Preserves All ClientScript/ScriptManager Patterns (Phase 2)
2
+
3
+
**Date:** 2026-07-31
4
+
**Author:** Bishop (Migration Tooling Dev)
5
+
**Status:** Implemented
6
+
7
+
## Context
8
+
9
+
ClientScriptTransform Phase 1 emitted TODO markers for `GetPostBackEventReference` and `ScriptManager.GetCurrent()` because no runtime shim existed. Phase 2 shims (ClientScriptShim + ScriptManagerShim) now handle these patterns.
10
+
11
+
## Decision
12
+
13
+
The CLI transform now preserves ALL six ClientScript/ScriptManager patterns instead of commenting out two of them. Zero TODO markers remain — shims handle everything at runtime.
14
+
15
+
-`GetPostBackEventReference` → prefix-stripped, preserved for ClientScriptShim
16
+
-`ScriptManager.GetCurrent(Page)` → converted to `ScriptManager.GetCurrent(this)` for ScriptManagerShim
- All agents: migrated code no longer has `// TODO: Replace __doPostBack` or `// TODO: ScriptManager.GetCurrent() has no Blazor equivalent` — these calls just work via shims
22
+
- Layer 2 agents: less manual fixup needed for postback and ScriptManager patterns
ClientScriptShim Phase 1 left `GetPostBackEventReference()`, `GetPostBackClientHyperlink()`, and `GetCallbackEventReference()` as `NotSupportedException` stubs. Phase 2 needed to make these return working JavaScript strings — zero rewrite, same API.
10
+
11
+
## Decision
12
+
13
+
1.**Inline JS bootstrap** — WebFormsPageBase.OnAfterRenderAsync injects `__doPostBack` and registration functions via `eval()` on firstRender. This avoids race conditions with external script loading while keeping `bwfc-postback.js` available as an optional static asset.
14
+
15
+
2.**ResolveControlId priority** — Checks `BaseWebFormsComponent.ID` first (the developer-assigned HTML ID), then falls back to `GetType().Name`. This matches Web Forms' ClientID behavior.
16
+
17
+
3.**ScriptManagerShim dual-path** — Supports both DI injection (`services.AddScoped<ScriptManagerShim>`) and static `GetCurrent(page)` factory. Migrated code using `ScriptManager.GetCurrent(Page)` compiles unchanged.
18
+
19
+
4.**PostBack target ID format** — `TypeName_HashCode` ensures per-instance uniqueness when multiple page components exist.
20
+
21
+
## Impact
22
+
23
+
- Tests updated: 3 tests changed from throw-verification to return-value-verification, plus 3 new null-handling tests
24
+
- No breaking changes to existing consumers
25
+
- WebFormsPageBase now implements IAsyncDisposable (new interface on the class)
0 commit comments