Skip to content

Revisit EnvContainer::initialize to accept narrower config slices instead of &Configuration #1861

Closed

Description

@josecelano

Summary

Revisit the initialization API of EnvContainer (and related server environment types) to evaluate whether accepting narrower config slices (Arc<Core>, Arc<UdpTracker>, etc.) instead of &Configuration would reduce the coupling forcing function at the initialisation boundary.

Background

Issue #1856 (DEC-07) identified that the root reason a UDP-only binary must compile all service config types is not the config package structure — it is the EnvContainer::initialize / Environment::new signature, which accepts &Arc<Configuration> (the full aggregate) rather than only the config types actually needed by that server.

As a result, the compiler must include HttpTracker, HttpApi, HealthCheckApi, TslConfig, and AccessTokens even when none of those services run, because the initialisation function signature demands the full struct.

Goal

Evaluate whether changing the initialization API to accept narrower config slices is practical:

  • UdpEnvironment::new(&Arc<Core>, &Arc<UdpTracker>) instead of &Arc<Configuration>
  • HttpEnvironment::new(&Arc<Core>, &Arc<HttpTracker>) instead of &Arc<Configuration>

The output is a decision and, if narrowing is adopted, an implementation that verifies the UDP-only example binary no longer compiles HttpTracker/HttpApi/etc.

Acceptance Criteria

  • A decision entry is added to DECISIONS.md with the chosen approach and rationale
  • If narrowing is adopted: Environment::new accepts narrower config types and the coupling table in the Cargo examples no longer shows "Compiled but idle" types
  • The two Cargo examples in packages/udp-server/examples/ and packages/axum-http-server/examples/ are updated to reflect the new API
  • All tests pass; no new clippy warnings

Notes

This is a design-first issue. The implementation may require changes to how the bootstrap layer constructs config slices from the full Configuration, so that higher-level binaries still work without modification.

Related

Activity

  1. self-assigned this
    on Jun 1, 2026
  2. added 3 commits that reference this issue on Jun 2, 2026
    455257c
    f7e2222
    d6686dc
  3. added 2 commits that reference this issue on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions