Skip to content

Make updater configuration immutable - #3028

Open
Harshil-1603 wants to merge 1 commit into
theupdateframework:developfrom
Harshil-1603:fix/immutable-updater-config
Open

Harshil-1603 wants to merge 1 commit into
theupdateframework:developfrom
Harshil-1603:fix/immutable-updater-config

Conversation

@Harshil-1603

Copy link
Copy Markdown

Description of the changes being introduced by the pull request:

Make UpdaterConfig a frozen dataclass and expose Updater.config as a read-only property. This prevents changing settings after initialization or refresh, when some settings have already been used to initialize trusted metadata or the default fetcher.

This intentionally changes the API: callers that assign settings on an existing configuration must pass them to UpdaterConfig(...) instead, or use dataclasses.replace(...) to derive settings for a new Updater. The API docstrings explain that migration. Existing limit and download tests now pass their settings at construction and retain their behavioral assertions.

A regression test covers both mutation through the caller's original config reference and mutation/replacement through the updater, before and after refresh. It fails on the previous implementation.

Fixes #2471

Validation:

  • Full unittest suite: 206 tests passed.
  • Coverage: 97%; required 97% gate passed.
  • Ruff checks and formatting: passed.
  • Full-tree mypy in the isolated lint environment: 49 source files passed.
  • Sphinx HTML documentation build with warnings treated as errors: passed.
  • Zizmor workflow checks: passed.

AI assistance: Codex GPT-6 was used to prepare the change.

Signed-off-by: Harshil <181649964+Harshil-1603@users.noreply.github.com>
@Harshil-1603
Harshil-1603 requested a review from a team as a code owner October 12, 2026 20:07

This branch has not been deployed

No deployments
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.

ngclient: Make updater.config immutable

1 participant