Projects: restore store-owned fields under the store lock on save (PR re-review)

update_project restored marketplace installs (and status, container id,
flags) from a copy read before validation, then wrote the whole record
later, so an install landing in between was lost. ProjectsStore gains
update_restoring, which runs restore_store_owned_fields against the record
as stored under the lock, and update_project writes through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 13:22:43 -07:00
co-authored by Claude Opus 5.5
parent 60c03baf62
commit 0a4d1d5f95
2 changed files with 65 additions and 1 deletions
@@ -1112,7 +1112,14 @@ pub async fn update_project(
// for every already-running container at launch. The version of this that
// re-asserted on every save is what turned a stale flag in a payload into a
// restarted bridge.
state.projects_store.update(project)
//
// The restore above served the validation; it is redone under the store's
// lock against the record as it is *now*, so a marketplace install, a
// status change or a container id landing since `stored` was read is kept
// rather than written over.
state
.projects_store
.update_restoring(project, restore_store_owned_fields)
}
/// Restore onto `project` the fields whose value belongs to the store rather