Skip to content

Spec 014: C# Timeout Extraction - #190

Merged
adrian-xping merged 8 commits into
mainfrom
feat/spec-014-csharp-timeout-extraction
Dec 4, 2026
Merged

adrian-xping merged 8 commits into
mainfrom
feat/spec-014-csharp-timeout-extraction

Conversation

@adrian-xping

@adrian-xping adrian-xping commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Spec 014 (docs/specs/core/014-csharp-timeout-extraction.md): C# Timeout Extraction. Built by spec-runner; a human merges this PR.

Phase PRs

Acceptance (criteria from docs/specs/work-breakdown.md)

# Criterion Result Evidence
AC-1 Fixtures for the slow-runner example (250 ms → 2 s) and each pattern above; values normalized to milliseconds. met samples/timeouts/ has every folder listed in Spec 014 §12.1 (slow-runner, framework-attributes, cancellation, waits, delay-race, elapsed, completion, polling, values, helpers, not-limits, preprocessor), each with old.cs, new.cs and expected.json. Values in expected.json are in ms (e.g. cancellation: 250 -> 2000 from TimeSpan.FromMilliseconds(250) -> TimeSpan.FromSeconds(2); elapsed: TotalSeconds < 0.25 -> 250). TimeoutFixtureTests.EveryTimeoutFixtureMatchesItsExpectedFile compares the extractor output to each expected.json; TheSlowRunnerTimeoutIsRaisedEightTimes checks 250 -> 2000. Caveat: I could not run the tests in this session (command needed approval), so this is from reading the code, fixtures and tests.
AC-2 A test checks that every table row is used by a fixture. met tests/Xping.Analyzers.CSharp.Tests/Timeouts/TimeoutFixtureTests.cs EveryPatternRowIsUsedByAFixture extracts every *.cs under samples/timeouts, unions ExtractedTimeouts.UsedRows (filled in TimeoutExtractor.cs, where used.Add(row.Id) is called for each matched row), and fails listing any TimeoutPatterns.Default.Rows id no fixture used. It would fail if a row were unused. Not run here.
AC-3 The analyzer reproduces the timeouts of every C# samples/facts/ fixture. met tests/Xping.Analyzers.CSharp.Tests/FactsFixtureTests.cs TheAnalyzerReproducesTheTimeoutPartOfEveryFactsFixture is a theory over every samples/facts/ folder with a facts.json. It runs CSharpTestAnalyzer on each C# old/new side and compares timeouts (TimeoutPart) with the fixture, failing on any difference. samples/facts/catalog was extended (Search_IsFast, with an elapsedAssertion timeout and subject) to match. Not run here.

Follow-ups created

None.

Spec-Runner: spec=014 step=claim
…urces, waits and delay races (spec 014 phase 1)

Adds the embedded timeout pattern table with its loader and validation, the value folder
(literals, TimeSpan forms, arithmetic, same-file locals, fields and properties), and the
extractor for framework attributes (xUnit, NUnit incl. class attributes, MSTest),
CancellationTokenSource/CancelAfter, WaitAsync/Wait/WaitOne/WaitAll/WaitAny and Task.WhenAny
delay races. CSharpTestAnalyzer now fills `timeouts`. Fixtures under samples/timeouts/.

Spec-Runner: spec=014 phase=1 step=implement
… skip argument is unresolved (spec 014 phase 1)

Spec-Runner: spec=014 phase=1 step=fix-1
…extraction/1-engine

feat(analyzers): extract C# timeouts from attributes, cancellation sources, waits and delay races (spec 014 phase 1)
… and helper timeouts in C# (spec 014 phase 2)

Spec 013's extractor hands Spec 014 the helpers it followed and, per recognized
assertion, its upper bounds, condition comparisons and NUnit constraint. The
timeout extractor reads elapsed upper bounds (§8.1-§8.2) with the assertion's
span and the elapsed root as subject, completion checks (§8.3), NUnit .After(n)
and FluentAssertions NotThrowAfter polling (§9), and helper limits once per call
site with parameters folded as the caller's arguments (§10). TimeoutFact gains
an optional Subject. §8.5 stays a TODO(spec) until Spec 085 adds
ExpectedValue.Resolved.

Spec-Runner: spec=014 phase=2 step=implement
…ved (spec 014 phase 2)

Spec-Runner: spec=014 phase=2 step=fix-1
…extraction/2-assertions

feat(analyzers): read elapsed-time bounds, completion checks, polling and helper timeouts in C# (spec 014 phase 2)
Spec-Runner: spec=014 step=done
@adrian-xping
adrian-xping marked this pull request as ready for review December 4, 2026 00:46
@adrian-xping
adrian-xping merged commit 260bfba into main Dec 4, 2026
5 checks passed
@adrian-xping
adrian-xping deleted the feat/spec-014-csharp-timeout-extraction branch December 4, 2026 00:56
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