Skip to content

Conversation

@kipz
Copy link
Contributor

@kipz kipz commented Nov 6, 2025

Allows Refresh() to be called multiple times during an Updater's lifetime by removing workflow state
guards that prevented re-updating metadata after dependent metadata was loaded.

The Update* methods in TrustedMetadata already handle atomic updates, version checking, and rollback
protection. The removed guards only enforced workflow order within a single refresh cycle but prevented
subsequent refresh cycles.

This enables long-running processes to periodically refresh metadata without creating new Updater
instances.

Relates to #593

kipz added 2 commits November 6, 2025 11:25
Add test cases that demonstrate the current limitation where
Refresh() can only be called once during an Updater's lifetime.

- TestMultipleRefreshCalls: Tests calling Refresh() multiple times
  with metadata updates between calls
- TestMultipleRefreshCallsNoChanges: Tests calling Refresh() multiple
  times when no changes are available

These tests currently fail with "cannot update timestamp after snapshot"
errors due to TrustedMetadata state machine restrictions.

Related to theupdateframework#593

Signed-off-by: James Carnegie <[email protected]>
Allow Refresh() to be called multiple times during the lifetime of an
Updater by removing workflow guards that prevented re-updating metadata
after dependent metadata was loaded.

The Update* methods in TrustedMetadata already handle atomic updates,
version checking, and rollback protection. The guards were only needed
to enforce workflow order within a single refresh cycle, but prevented
multiple refresh cycles.

This enables long-running processes to periodically refresh metadata
without creating new Updater instances. Updates are atomic and
thread-safe - metadata is never cleared, only replaced after validation.

Fixes theupdateframework#593

Signed-off-by: James Carnegie <[email protected]>
@kommendorkapten
Copy link
Member

This has come up a few times, and has not been merged as we want to stay close to the Python implementation (where this is not allowed), and the recommended approach has been to just recreate the TUF client if that's needed. See this comment for more info: #699 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants