Skip to content

Move ParameterService onto the BuildContext - #452

Merged
dennisdoomen merged 1 commit into
Fallout-build:developfrom
ChrisonSimtian:engine/ft4-parameter-service
Oct 10, 2026
Merged

dennisdoomen merged 1 commit into
Fallout-build:developfrom
ChrisonSimtian:engine/ft4-parameter-service

Conversation

@ChrisonSimtian

@ChrisonSimtian ChrisonSimtian commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #309 (make ParameterService per run). Step 3 of the engine de-statification work, after #450 and #451. Part of the epic #315.

Problem

ParameterService.Instance was one static object for the whole process. It has two mutable fields: the arguments read from files, and the arguments read from the commit message. They lived as long as the process, so one build run could leave state for the next.

Outcome

  • BuildContext has a new Parameters property. Each run gets its own ParameterService.
  • ParameterService.Instance returns the service of the current run.
  • Outside a run, Instance returns one shared service. Callers without a run still work.
  • ParameterService.CreateDefault() builds the service in one place. BuildContext and the shared fallback both use it.

This is internal. The static ParameterService API does not change.

Not in this PR

#309 also asks that the engine can run with an injected arguments and environment source. That is not done here. The per-run service still reads the process arguments (EnvironmentInfo.ArgumentParser) and environment variables. #309 stays open for that part.

Specs

Four new specs in BuildContextSpecs:

  • Instance returns the current run's service.
  • Instance returns a stable shared service outside a run.
  • Each run gets its own service.
  • The commit-message arguments of one run are not visible in the next run.

I checked that the specs guard the change. If Instance ignores the run's service, or every run shares one service, two specs fail in each case.

Verification

  • dotnet build fallout.slnx: 0 errors.
  • All 14 test projects pass (Fallout.Build.Specs: 246).
  • The repo's own build ran with --help and renders its parameters through the per-run service.

Stack

#453 and #454 are built on top of this PR. They contain these commits and need a rebase after this PR changes or merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RJw6L2mf6MpeRBvJaow54b

@ChrisonSimtian ChrisonSimtian added the target/vCurrent Targets the current version label Jun 30, 2026
@ChrisonSimtian ChrisonSimtian added target/vNext Targets the next calendar-version and removed target/vCurrent Targets the current version labels Jul 20, 2026
@ChrisonSimtian
ChrisonSimtian force-pushed the engine/ft4-parameter-service branch from 119fee5 to 69b4088 Compare July 26, 2026 10:17
@ChrisonSimtian ChrisonSimtian added target/vCurrent Targets the current version skip-changelog Dont add to the Github Release Notes and removed target/vNext Targets the next calendar-version labels Jul 26, 2026
@ChrisonSimtian
ChrisonSimtian marked this pull request as ready for review July 26, 2026 10:18
@ChrisonSimtian
ChrisonSimtian requested a review from a team as a code owner July 26, 2026 10:18
ChrisonSimtian added a commit to ChrisonSimtian/Fallout that referenced this pull request Jul 26, 2026
Runs a fixture build end-to-end, twice in one process, and asserts what the de-static work promised:
both runs succeed, the second gets its own context/parameter service/log sink, it opens on an empty
sink, and the static facades inside a run point at that run.

This is what the original FT-9 commit set out to do. Its unit-level assertions have since landed
with the steps they belong to (FT-2 in Fallout-build#451, FT-4 in Fallout-build#452, FT-6 in Fallout-build#453), so what is left here is
the end-to-end case they could not cover — and it immediately found the leaked file-sink logger
fixed in the previous commit. Verified as a real guard: reverting that fix fails 4 of these 5 specs.

Two process-wide inputs are pinned to make a build runnable under a test host — the argument parser
(swapped and restored) and the statically-resolved root directory (asserted to carry the .fallout
marker, since UpdateNotification prompts for input without it). Both are de-statification candidates
in their own right.
@ChrisonSimtian ChrisonSimtian added target/vNext Targets the next calendar-version target/vCurrent Targets the current version and removed target/vCurrent Targets the current version target/vNext Targets the next calendar-version labels Aug 4, 2026
ChrisonSimtian added a commit to ChrisonSimtian/Fallout that referenced this pull request Sep 4, 2026
Runs a fixture build end-to-end, twice in one process, and asserts what the de-static work promised:
both runs succeed, the second gets its own context/parameter service/log sink, it opens on an empty
sink, and the static facades inside a run point at that run.

This is what the original FT-9 commit set out to do. Its unit-level assertions have since landed
with the steps they belong to (FT-2 in Fallout-build#451, FT-4 in Fallout-build#452, FT-6 in Fallout-build#453), so what is left here is
the end-to-end case they could not cover — and it immediately found the leaked file-sink logger
fixed in the previous commit. Verified as a real guard: reverting that fix fails 4 of these 5 specs.

Two process-wide inputs are pinned to make a build runnable under a test host — the argument parser
(swapped and restored) and the statically-resolved root directory (asserted to carry the .fallout
marker, since UpdateNotification prompts for input without it). Both are de-statification candidates
in their own right.
@ChrisonSimtian
ChrisonSimtian force-pushed the engine/ft4-parameter-service branch from 69b4088 to e7241d7 Compare September 4, 2026 10:06
Each build run now gets its own `ParameterService`, held on `BuildContext`.
`ParameterService.Instance` returns the service of the current run. Outside a
run, it returns one shared service, so callers without a run still work.

The service has two mutable fields: the arguments read from files, and the
arguments read from the commit message. Before, they lived as long as the
process, so one run could leave state for the next. Now they are discarded with
the run.

This is internal plumbing. The static `ParameterService` API does not change.
The service still reads the process command-line arguments and environment
variables. Passing in a different source for a run is not part of this change.

Part of Fallout-build#309.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RJw6L2mf6MpeRBvJaow54b
@ChrisonSimtian
ChrisonSimtian force-pushed the engine/ft4-parameter-service branch from e7241d7 to 85db4b3 Compare October 4, 2026 08:15
ChrisonSimtian added a commit to ChrisonSimtian/Fallout that referenced this pull request Oct 4, 2026
Runs a fixture build end-to-end, twice in one process, and asserts what the de-static work promised:
both runs succeed, the second gets its own context/parameter service/log sink, it opens on an empty
sink, and the static facades inside a run point at that run.

This is what the original FT-9 commit set out to do. Its unit-level assertions have since landed
with the steps they belong to (FT-2 in Fallout-build#451, FT-4 in Fallout-build#452, FT-6 in Fallout-build#453), so what is left here is
the end-to-end case they could not cover — and it immediately found the leaked file-sink logger
fixed in the previous commit. Verified as a real guard: reverting that fix fails 4 of these 5 specs.

Two process-wide inputs are pinned to make a build runnable under a test host — the argument parser
(swapped and restored) and the statically-resolved root directory (asserted to carry the .fallout
marker, since UpdateNotification prompts for input without it). Both are de-statification candidates
in their own right.
@ChrisonSimtian ChrisonSimtian added this to the Architecture Foundation milestone Oct 4, 2026
@ChrisonSimtian ChrisonSimtian changed the title Move ParameterService onto the BuildContext (FT-4) Move ParameterService onto the BuildContext Oct 4, 2026
@dennisdoomen
dennisdoomen self-requested a review October 10, 2026 09:01
@dennisdoomen
dennisdoomen merged commit 7e2217c into Fallout-build:develop Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Dont add to the Github Release Notes target/vCurrent Targets the current version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants