Skip to content

Commit d7d9ad4

Browse files
csharpfritzCopilot
andcommitted
chore: session log — BWFC010-012 usage validation analyzers
Session: 2026-03-20-usage-validation-analyzers Requested by: Jeffrey T. Fritz Changes: - Added orchestration logs for Cyclops and Rogue agents (2026-03-20T12-43-10Z) - Added session log (2026-03-20T12-43-10Z-usage-validation-analyzers.md) - Merged 2 decisions from inbox: idempotent code fixes pattern, BWFC011 test failure bug - Deleted processed inbox files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 99349b0 commit d7d9ad4

5 files changed

Lines changed: 144 additions & 36 deletions

File tree

.squad/agents/rogue/history.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,25 @@ Pattern: Roslyn analyzer tests use CSharpAnalyzerTest with stub types for WebCon
368368
**Key Roslyn Trivia Lesson:** When using `EmptyStatement` as a replacement anchor for TODO comments, the semicolon token MUST be on its own line — never after a `//` comment. Single-line comments consume everything until end-of-line, making any trailing tokens invisible to re-parsing.
369369

370370
**Test stats:** 54/54 passing (BWFC001: 26, BWFC002: 6, BWFC003: 6, BWFC004: 6, BWFC005: 6, code fixes: 4).
371+
372+
### BWFC012 Analyzer + Integration Tests (2026-03-21)
373+
374+
**BWFC012 RunatServerAnalyzer (10 tests, all pass):** Detects leftover `runat="server"` and `runat='server'` patterns in C# string literals. Case-insensitive matching via `ToLowerInvariant()`. Registers on `SyntaxKind.StringLiteralExpression`. Code fix uses `Regex.Replace` to strip the attribute and surrounding whitespace from the string value.
375+
376+
**Tests:** 4 positive (double-quote, single-quote, field initializer, case-insensitive), 4 negative (runat without server, variable named runat, server without runat, empty string), 2 code fix (removes double-quote variant, removes single-quote variant).
377+
378+
**AllAnalyzersIntegrationTests (8 tests, all pass):** Cross-analyzer validation:
379+
- `AllAnalyzerTypes_AreDiscoverable` — reflection finds ≥8 analyzer classes in assembly
380+
- `AllDiagnosticIds_AreUnique` — no two analyzers share a diagnostic ID
381+
- `AllExpectedIds_AreRegistered` — all 8 IDs (BWFC001-005, 010-012) present
382+
- `AllAnalyzers_HaveUsageCategory` — every descriptor uses "Usage" category
383+
- `AllAnalyzers_AreEnabledByDefault` — all enabled by default
384+
- `ComplexWebControl_TriggersMultipleDiagnostics` — BWFC001+002+003 fire together on a single WebControl subclass
385+
- `KitchenSink_FiveAnalyzersFire` — 6 analyzers fire simultaneously (001+002+003+005+011+012)
386+
- `CleanBlazorComponent_NoDiagnostics` — properly migrated code produces zero warnings
387+
388+
**Pre-existing failure noted:** Cyclops's `EventHandlerSignatureAnalyzerTests.CodeFix_AddsTodoComment` (BWFC011) fails — code fix output doesn't match expected. Not related to BWFC012 or integration tests.
389+
390+
**Key patterns:** Multi-analyzer integration tests use `CompilationWithAnalyzers` directly (not `CSharpAnalyzerTest<T>`) since the standard test harness only supports single-analyzer testing. Stub types (WebControl, ViewState, Session) must be defined inline for the compilation to resolve semantic checks.
391+
392+
**Test stats:** 88/89 passing (BWFC001: 26, BWFC002: 6, BWFC003: 6, BWFC004: 6, BWFC005: 6, BWFC010: 9, BWFC011: 7 [1 fail], BWFC012: 10, integration: 8, code fixes: 4).

.squad/decisions.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11597,3 +11597,62 @@ Change the expression placeholder format to avoid `>`:
1159711597
- Option C: Use a regex for self-closing that is aware of quoted attribute values: `<(asp_\w+)((?:\s+\w+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*/>`
1159811598

1159911599
**Assigned to:** Cyclops (parser owner)
11600+
11601+
### 2026-07-25: Idempotent Code Fixes for Advisory Analyzers
11602+
11603+
**Author:** Cyclops
11604+
**Date:** 2026-07-25
11605+
**Context:** BWFC010/BWFC011 implementation
11606+
11607+
## Decision
11608+
11609+
When a Roslyn code fix adds a TODO comment but does NOT remove the underlying diagnostic (advisory/Info-severity analyzers), the code fix **must be idempotent** — check for existing TODO in leading trivia before adding.
11610+
11611+
## Rationale
11612+
11613+
The Roslyn test framework (and IDE) applies code fixes iteratively until convergence. If a fix adds a comment but the diagnostic persists, the fix runs again. Without an idempotency guard, duplicates accumulate.
11614+
11615+
## Pattern
11616+
11617+
`csharp
11618+
// In code fix provider, before adding TODO:
11619+
foreach (var trivia in node.GetLeadingTrivia())
11620+
{
11621+
if (trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) &&
11622+
trivia.ToString().Contains("TODO: <unique marker>"))
11623+
return document; // Already applied
11624+
}
11625+
`
11626+
11627+
Test configuration for persistent diagnostics:
11628+
`csharp
11629+
FixedState = { ExpectedDiagnostics = { ... } },
11630+
NumberOfIncrementalIterations = 2,
11631+
NumberOfFixAllIterations = 2,
11632+
`
11633+
11634+
## Scope
11635+
11636+
Applies to all future BWFC analyzers at Info severity where the code fix doesn't resolve the diagnostic.
11637+
11638+
### 2026-03-21: BWFC011 Code Fix Test Failure
11639+
11640+
**Author:** Rogue (QA Analyst)
11641+
**Date:** 2026-03-21
11642+
**Branch:** experiment/aspx-middleware
11643+
**Status:** Bug — needs Cyclops fix
11644+
11645+
## Context
11646+
11647+
While running the full analyzer test suite (89 tests), discovered that EventHandlerSignatureAnalyzerTests.CodeFix_AddsTodoComment fails with a content mismatch. The BWFC011 analyzer itself works correctly (all 6 non-code-fix tests pass), but the code fix provider produces output that doesn't match the expected fixed source.
11648+
11649+
## Impact
11650+
11651+
- 88/89 tests pass; only this one code fix test fails
11652+
- The analyzer detection is fine — only the automated fix is broken
11653+
- Not blocking BWFC012 or integration test work
11654+
11655+
## Recommendation
11656+
11657+
Cyclops should check the EventHandlerSignatureCodeFixProvider output against the expected ixedSource in the test. Likely a trivia/whitespace issue similar to the BWFC004/005 fixes that needed EndOfLine trivia corrections.
11658+

.squad/decisions/inbox/cyclops-idempotent-advisory-codefixes.md

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Orchestration: Cyclops (Component Dev)
2+
3+
**Spawn Time:** 2026-03-20T12:43:10Z
4+
**Mode:** background
5+
**Status:** SUCCESS
6+
7+
## Task
8+
Build BWFC010 (required attributes) + BWFC011 (event handler signatures) analyzers with code fixes and tests.
9+
10+
## Outcome
11+
12+
- **BWFC010 Analyzer:** Built. Part of earlier commit.
13+
- **BWFC011 Analyzer:** Built. EventHandlerSignatureAnalyzer + EventHandlerSignatureCodeFixProvider.
14+
- 6 analyzer tests ✓
15+
- 1 code fix test ⚠️ (failing on output mismatch — see Rogue's decision in inbox)
16+
- **Total Test Count:** 17 tests across both analyzers
17+
- **Commits:**
18+
- b2432e26 (BWFC010 as part of earlier work)
19+
- 928694b5 (BWFC011 implementation)
20+
- 99349b0a (history update)
21+
22+
## Decisions Filed
23+
24+
- **cyclops-idempotent-advisory-codefixes.md:** Pattern for preventing duplicate TODO comments in Info-severity analyzer code fixes when diagnostics persist.
25+
26+
## Known Issues
27+
28+
- BWFC011 code fix test failure flagged by Rogue — output content mismatch. Likely trivia/whitespace issue in EventHandlerSignatureCodeFixProvider.
29+
30+
## Next
31+
32+
Rogue's BWFC012 work and integration tests can proceed in parallel. Code fix failure in BWFC011 is non-blocking.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Orchestration: Rogue (QA Analyst)
2+
3+
**Spawn Time:** 2026-03-20T12:43:10Z
4+
**Mode:** background
5+
**Status:** SUCCESS
6+
7+
## Task
8+
Build BWFC012 (runat=server) analyzer + cross-analyzer integration tests.
9+
10+
## Outcome
11+
12+
- **BWFC012 Analyzer:** Built. RequiredRunatAttributeAnalyzer + RequiredRunatAttributeCodeFixProvider.
13+
- **Test Count:**
14+
- 10 unit tests (BWFC012-specific)
15+
- 8 integration tests (cross-analyzer: BWFC010, BWFC011, BWFC012)
16+
- **Total:** 18 tests, all passing
17+
- **Commits:**
18+
- baf3e40f (BWFC012 implementation)
19+
- b2432e26 (integration tests)
20+
21+
## Decisions Filed
22+
23+
- **rogue-bwfc011-codefix-failure.md:** Bug report on BWFC011 code fix test failure (88/89 tests pass). Output mismatch in EventHandlerSignatureCodeFixProvider — likely trivia/whitespace issue.
24+
25+
## Known Issues
26+
27+
- BWFC011 code fix test failure discovered during integration test runs. Flagged for Cyclops. Not blocking BWFC012 or integration work.
28+
29+
## Next
30+
31+
All analyzer pairs (BWFC010, BWFC011, BWFC012) integrated and tested. Ready for next phase.

0 commit comments

Comments
 (0)