Skip to content

Replace ServerConfig.scope mutations with with-scope clones. - #1242

Open
floitsch wants to merge 1 commit into
floitsch/build-artemis-service.s-new.060from
floitsch/build-artemis-service.s-new.070
Open

floitsch wants to merge 1 commit into
floitsch/build-artemis-service.s-new.060from
floitsch/build-artemis-service.s-new.070

Conversation

@floitsch

Copy link
Copy Markdown
Member

ServerConfig.scope was mutable (:= null) for one reason: callers needed to attach a fleet's scope to a config that came from the global CLI config (which never carries a scope). Three sites mutated: FleetFile.init(), the legacy-format reader, and migration-start_.

Replaces that with proper clone methods:

  • ServerConfig grows an abstract with-scope --scope/Scope -> ServerConfig.
  • Each subclass (ServerConfigSupabase, ServerConfigHttp) implements it, returning a fresh instance with all other fields preserved.
  • The three mutation sites in fleet.toit now build a scoped copy instead.
  • ServerConfig.scope becomes immutable (the field declaration drops its := null initializer; the field is set via the constructor only).

ServerConfig.scope was mutable (`:= null`) for one reason: callers
needed to attach a fleet's scope to a config that came from the global
CLI config (which never carries a scope). Three sites mutated:
FleetFile.init(), the legacy-format reader, and migration-start_.

Replaces that with proper clone methods, matching the existing
'with --host' pattern on ServerConfigSupabase:
- ServerConfig grows an abstract 'with --scope/Scope -> ServerConfig'.
- Each subclass (ServerConfigSupabase, ServerConfigHttp) implements it,
  returning a fresh instance with all other fields preserved.
- The three mutation sites in fleet.toit now build a scoped copy instead.
- ServerConfig.scope becomes immutable (the field declaration drops its
  ':= null' initializer; the field is set via the constructor only).
@floitsch
floitsch force-pushed the floitsch/build-artemis-service.s-new.070 branch from 980afa4 to dbaef3e Compare May 23, 2026 12:52
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