Skip to content

refactor(host): move startup and endpoint wiring into testable libraries - #440

Merged
dnyw4l3n13 merged 7 commits into
mainfrom
refactor/429-testable-host-wiring
Oct 30, 2026
Merged

dnyw4l3n13 merged 7 commits into
mainfrom
refactor/429-testable-host-wiring

Conversation

@prpixie

@prpixie prpixie commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Refactors the BuildBot host so that startup, configuration binding, endpoint mapping and endpoint handlers live in feature libraries rather than in the host project. This makes the wiring unit-testable.

Per the approved plan on #429, this moves:

  • configuration binding out of the BuildBot host into feature libraries
  • endpoint mapping out of the BuildBot host into feature libraries
  • endpoint handlers out of the BuildBot host into feature libraries

This PR is the draft opened ahead of the implementation. Implementation follows in subsequent commits on this branch, and the placeholder CHANGELOG.md entry will be corrected once the primary code commit lands.

Closes #429

@prpixie prpixie added the auto-pr Pull request created automatically label Oct 29, 2026
@prpixie prpixie added the auto-pr Pull request created automatically label Oct 29, 2026
@dnyw4l3n13 dnyw4l3n13 changed the title docs: add changelog placeholder for #429 refactor(host): move startup and endpoint wiring into testable libraries Oct 29, 2026
@dnyw4l3n13 dnyw4l3n13 added AI-Work Work for an AI Agent Medium Medium Priority labels Oct 29, 2026
@credfeto

credfeto commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Roslyn analyzer findings

Source Rule Level File Line Suppressed Message
DotNet CA2000 error src/BuildBot/Helpers/ServerStartup.cs 99 yes Call System.IDisposable.Dispose on object created by 'CreateLogger()' before all references to it are out of scope

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed 644e029 moving BuildBot.GitHub config and endpoint wiring out of the host (tests pass). Remaining from the plan: CloudFormation, Watchtower, Discord, Health, then COVERAGE.md and the changelog correction.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed cbb6960 moving CloudFormation config and endpoint wiring into BuildBot.CloudFormation (409 tests pass). Remaining from the plan: Watchtower, Discord, Health, then COVERAGE.md and the changelog correction. Next cycle continues once CI settles.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed 2e54e02 moving Watchtower endpoint wiring into BuildBot.Watchtower (411 tests pass). Remaining from the plan: Discord, Health, then COVERAGE.md and the changelog correction. Next cycle continues once CI settles.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed 1b666ab moving Discord config wiring into BuildBot.Discord (415 tests pass). Remaining from the plan: Health (/ping endpoint), then COVERAGE.md and the changelog correction. Next cycle continues once CI settles.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed 79be93f moving the /ping endpoint wiring into BuildBot.Health (422 tests pass). Remaining from the plan: COVERAGE.md and the changelog correction. Next cycle continues once CI settles.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Simplify clean - advancing to code review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Code review clean - advancing to security review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Security review clean, advancing to coverage check

@dnyw4l3n13 dnyw4l3n13 added the Blocked Blocked by a dependency or external factor label Oct 29, 2026
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

This PR's automation idle-invocation budget (5) is exhausted with no known blocking reason — no required check has failed and there is no unaddressed review request. Blocking this PR until a human investigates. Board status: AI Coverage; next phase due: PHASE G (coverage).

@credfeto credfeto removed the Blocked Blocked by a dependency or external factor label Oct 29, 2026
@dnyw4l3n13
dnyw4l3n13 force-pushed the refactor/429-testable-host-wiring branch from 79be93f to 5da7692 Compare October 29, 2026 21:41
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Rebased onto origin/main (no conflicts, head 5da7692); CI will re-run, then the AI Coverage phase continues next cycle.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

.NET 98.0% < main 100.0% - returning to Development

Components below baseline: BuildBot.Health 71.4%, BuildBot.Watchtower 88.0%, BuildBot.CloudFormation 98.2%, BuildBot.GitHub 99.0%.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Development: pushed d26fecf adding tests (Health 71.4% -> 91.4%, CloudFormation 98.2% -> 99.1%; 425 tests pass). Remaining gap is 3 lines per component (GitHub, Watchtower, Health, CloudFormation) in AddMetadataIfMissing inside the ASP.NET RequestDelegateGenerator output (GeneratedRouteBuilderExtensions.g.cs), which has no [GeneratedCode] attribute and is never called, so no test can reach it. Human decision needed: exclude Microsoft.AspNetCore.Http.RequestDelegateGenerator output from coverage in src/UnitTests.props (like the existing ZLinq DropInGenerator exclusion), or waive the ratchet. Next cycle continues once CI settles.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Simplify clean - advancing to code review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Code review clean - advancing to security review

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Code review already clean on current head d26fecf; board advanced to AI Security Review. Next phase: security review.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Security review clean (no findings; behaviour-preserving move of endpoint/config wiring), advancing to coverage check

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Setup: checked out refactor/429-testable-host-wiring at d26fecf (up to date with origin). Next phase: AI Coverage.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

AI Coverage round 2: .NET is still below baseline, so I'm blocking for a human decision. I re-measured BuildBot.Health on head d26fecf and got 89.2%, against 100.0% for main. Every uncovered line (393, 395 and 397) is in the generated AddMetadataIfMissing code in GeneratedRouteBuilderExtensions.g.cs, which the ASP.NET RequestDelegateGenerator emits. It has no [GeneratedCode] attribute and nothing calls it, so no test can reach it. The previous round's report said the same 3-line gap sits in GitHub, Watchtower and CloudFormation; I did not re-measure those three this round. Trend: .NET overall went from 98.0% to roughly 99%, and Health from 71.4% to 89.2%. The remaining gap is only this generated code, so more Development rounds cannot close it. Needs a human choice: (1) exclude RequestDelegateGenerator output in src/UnitTests.props, as the existing ZLinq DropInGenerator source exclusion does (my recommendation), or (2) waive the ratchet for this PR. Reply with the choice and remove Blocked. COVERAGE.md is untouched.

@dnyw4l3n13 dnyw4l3n13 added the Blocked Blocked by a dependency or external factor label Oct 29, 2026
@credfeto

Copy link
Copy Markdown
Member

Raise an issue on funfair-server-template to exclude RequestDelegateGenerator like the zlinq drop-in is. Prototype it here to make sure you've got the correct xml then revert src/UnitTests.props

happy to accept the lower coverage rating this once

@credfeto credfeto removed the Blocked Blocked by a dependency or external factor label Oct 30, 2026
…t.GitHub (#429)

Move the BuildBot.GitHub configuration binding, endpoint mapping and handlers out of the host into the library, with tests. The host keeps only the composition calls (MapGitHubEndpoints in Endpoints.cs and AddGitHub in ServerStartup.cs). Host Endpoints.GitHub.cs and EndpointsLoggingExtensions.cs are removed.
… BuildBot.CloudFormation (#429)

Move the CloudFormation endpoints and configuration binding out of the src/BuildBot host into src/BuildBot.CloudFormation, so the host only wires it up. Adds tests for the endpoints and the setup configuration binding.

Tests: 409/409 passing. Build clean.
)

Add DiscordSetup.AddDiscord(IServiceCollection, IConfiguration) so the Discord webhook configuration is read inside BuildBot.Discord rather than in ServerStartup. Adds DiscordSetupConfigurationTests covering binding, service resolution, and missing or empty webhook URLs.
Add tests for the CloudFormation endpoint and setup configuration wiring and the Health status endpoints extracted under #429.
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Rebased onto origin/main (CHANGELOG conflict resolved, both entries kept) and force-pushed. The credfeto request (raise a funfair-server-template issue to exclude RequestDelegateGenerator, prototype in src/UnitTests.props, then revert) is not yet actioned; I'll handle it next cycle once CI settles on the rebased head.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

@credfeto Raised funfair-tech/funfair-server-template#1071 to exclude RequestDelegateGenerator output from coverage, alongside the ZLinq drop-in exclusion.

I prototyped it here in src/UnitTests.props and verified it. The working line is <Source>.*Microsoft\.AspNetCore\.Http\.RequestDelegateGenerator.*</Source> (percent-encoded as .%2AMicrosoft%5C.AspNetCore%5C.Http%5C.RequestDelegateGenerator.%2A). The generator assembly segment in the path is Microsoft.AspNetCore.Http.RequestDelegateGenerator, not Microsoft.AspNetCore.App.SourceGenerators. With the exclusion, GeneratedRouteBuilderExtensions.g.cs (lines 393/395/397) drops out of the BuildBot.Health report and coverage goes from 87.9% (51/58) to 100% (47/47).

I reverted the prototype afterwards, so this PR has no commit for it and the lower Health coverage stays as you agreed.

@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Coverage ratchet waived for this PR per credfeto's explicit acceptance of the lower .NET Overall (generated RequestDelegateGenerator code only; COVERAGE.md untouched) - advancing to Human Review.

@dnyw4l3n13
dnyw4l3n13 marked this pull request as ready for review October 30, 2026 10:57
@dnyw4l3n13
dnyw4l3n13 requested a review from a team as a code owner October 30, 2026 10:57
@dnyw4l3n13
dnyw4l3n13 enabled auto-merge October 30, 2026 10:57
@dnyw4l3n13

Copy link
Copy Markdown
Collaborator

Finalize: PR marked ready and auto-merge enabled (merge commit); no .deleteme.now present.

@credfeto

Copy link
Copy Markdown
Member

Super-linter summary

Language Validation result

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@dnyw4l3n13
dnyw4l3n13 merged commit aea0e9e into main Oct 30, 2026
41 checks passed
@dnyw4l3n13
dnyw4l3n13 deleted the refactor/429-testable-host-wiring branch October 30, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Work Work for an AI Agent auto-pr Pull request created automatically Medium Medium Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(host): Move startup and endpoint wiring out of the app into testable libraries

3 participants