feat(ci): CI host integration as ports & adapters (ADR-0005)#341
Open
ChrisonSimtian wants to merge 5 commits into
Open
feat(ci): CI host integration as ports & adapters (ADR-0005)#341ChrisonSimtian wants to merge 5 commits into
ChrisonSimtian wants to merge 5 commits into
Conversation
ChrisonSimtian
added a commit
that referenced
this pull request
Jun 3, 2026
…ts (onion step 5b) Move the concrete CI host providers (AppVeyor, AzurePipelines, TeamCity, GitHubActions, GitLab, TravisCI, Jenkins, Bitrise, Bitbucket, Bamboo, SpaceAutomation) and their config generators from Fallout.Common.CI.* to Fallout.Infrastructure.CI.*. The Application ring uses provider-SPECIFIC capabilities (PublishTestResults, PushArtifact, SetBuildNumber, UpdateBuildNumber, Token, …), so a generic host abstraction can't capture them. Instead, per-provider ports in Fallout.Application.CI — IAppVeyor/IAzurePipelines/ITeamCity/IGitHubActions — plus a CiHost accessor that casts the detected Host.Instance to the port (null when not running on that host). No registration needed: Host.Instance is the existing detection seam, and the providers (subclasses of Host) implement the ports. Components (ITest/IReportCoverage/ISignPackages/ICreateGitHubRelease) and version/coverage attributes now call CiHost.X instead of X.Instance, so the Application ring keeps no dependency on Fallout.Infrastructure.* — the fitness gate still passes. The two enums the ports expose move to Fallout.Application.CI as vocabulary. Nuke.Common CI host shims repointed to the new namespace. (The generic CI host abstraction — ADR-0005 IBuildHost/IBuildReporter, #341 — stays a separate additive effort.) Tooling: OnionRewriter rules retargeted for 5b (CI → Infrastructure.CI, enums overridden to Application.CI). Lesson #13: alias-qualified `global::Ns.Type` refs aren't rewritten (Left includes `global::`) — hit in the shims, mopped up. Full suite green; Application-ring fitness gate green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Model CI host integration as ports & adapters (hexagonal seam) with an additive-now / deletions-batched-to-the-year-cut compatibility strategy, plus the GitHub-adapter-end-to-end spike that validates the runtime-host port shape. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Additive seam per ADR-0005: IBuildHost supersedes the anemic IBuildServer as the build's-eye-view runtime-host port (context + reporting). GitHubActions implements it via explicit interface implementation, leaving the public surface and generated workflows untouched. Adds an architecture fitness test asserting the ports layer (Fallout.Build) never references the adapters layer (Fallout.Common). Spike work on experimental; LogEventSink rewire deferred (see spike verdict #2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two ports, justified by differing implementor sets: every Host reports (so the local Terminal is an IBuildReporter), but only CI hosts carry run context (so Terminal is not an IBuildHost). IBuildHost rescoped to context (branch/ commit/is-PR); new IBuildReporter (warnings/errors/grouping) implemented by the Host base via explicit impls over the existing protected-virtual hooks — so adapters override reporting exactly as before. No behavior change. Fitness tests pin the split (Terminal: reporter not host; GitHubActions: both). Corrects spike finding #2 (reporting was already wired in the *.Theming.cs partials; there was no latent bug). Updates ADR-0005 + spike verdict. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Host.Default now probes an overridable Host.IsActive member instead of
reflecting for the magic-string IsRunning{TypeName} static. The default
IsActive falls back to that legacy convention, so all existing hosts work
unchanged; new adapters override IsActive directly (no static, no name match).
Host ctors are side-effect-free, so construct-then-probe is cheap and the
active host (constructed last) remains Host.Instance.
Covers ADR-0005 #3. Tests exercise both the override and fallback paths.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
First adapter built on the finished ADR-0005 seam, proving it generalizes:
- Runtime host overrides Host.IsActive (no IsRunning{Name} static — first user
of the #3 detection style) and implements both ports (IBuildHost context via
GitHub-compatible GITHUB_* vars; IBuildReporter reporting).
- Config generation composes the GitHub config model + a shared WorkflowCommands
helper for the ::cmd:: dialect, rather than inheriting GitHubActionsAttribute
(which is blocked anyway by ConfigurationAttributeBase.Build's internal set).
Common-case scaffold; full parity needs the GH model-builder extracted.
- Detection (FORGEJO_ACTIONS) is a naive guess pending the live instance.
Tests assert both ports, the IsActive detection path, and non-inheritance from
the GitHubActions adapter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9735c5e to
64b1ea9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the runtime-host ports & adapters seam for CI host integration (ADR-0005), validated by a GitHub-adapter spike and a new Forgejo adapter. Additive / non-breaking. Targets
experimental.What
IBuildHost(context — branch/commit/is-PR — CI hosts only) andIBuildReporter(warnings/errors/grouping — every host, including localTerminal).Host.Defaultprobes an overridableHost.IsActiveinstead of the magic-stringIsRunning{Name}convention. The old convention stays as fallback, so existing hosts are unchanged.Terminalis a reporter, not a context-host).IsActiveoverride (no static), both ports, and config generation by composing the GitHub config model + a sharedWorkflowCommandshelper rather than inheritingGitHubActions.Why
Establishes a stable, enforced CI-adapter seam ahead of the public plugin SDK (milestone #7), without breaking consumers. Full rationale in ADR-0005.
Validation
.githubworkflows byte-identical (config path untouched).Follow-ups (in the spike doc)
FORGEJO_ACTIONSguess — confirm against a live instance.WorkflowCommandsontoGitHubActions(deferred to protect that adapter's byte-identical output).Docs:
docs/adr/0005-ci-host-integration-ports-and-adapters.md,docs/spikes/0001-ci-ports-and-adapters.md.🤖 Generated with Claude Code