Repository navigation
controllers/repos: keep 'extra' when a POST does not send it - #159
Merged
Merged
Conversation
A POST to /api/repos/<project>/ always replaced 'extra' with
request.json.get("extra", {}), so any status update that omitted the
field wiped the repo's version metadata. On 2026-10-14 a replay of
~385 chacra.ceph.com repos (restoring rows lost to a purge) posted
without 'extra'; teuthology reads extra['package_manager_version'] from
/api/search and failed with KeyError: 'package_manager_version' across
an entire upgrade run until the rows were repaired by hand.
Only replace 'extra' when the request carries it. A repo that has no
'extra' yet (a new row) still defaults to {} so clients never see null.
Assisted-by: Claude Opus 5.5
Signed-off-by: David Galloway <[email protected]>
djgalloway
marked this pull request as ready for review
October 23, 2026 14:12
dmick
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
POST /api/repos/<project>/always setsextra=request.json.get("extra", {}), so any POST that leavesextraout wipes the repo's version metadata.On 2026-10-14 a replay of ~385 chacra.ceph.com repos (restoring shaman rows lost to the September chacra.ceph.com purge) posted
status=readywithoutextra. Teuthology readsextra['package_manager_version']from/api/search, so jobs failed withKeyError: 'package_manager_version'. For example, 30 of 32 failures inyuriw-2026-10-14_18:39:24-upgrade-umbrella-release-distro-default-trial. The affected rows were repaired by hand on 2026-10-20.Change
extrawhen the request carries it.extrayet (a newly created row) still defaults to{}, so/api/searchnever returnsnullfor it.Tests
test_update_without_extra_keeps_extra: regression test; fails onmain, passes here.test_create_a_repo_without_extra: a new repo created withoutextragets{}.test_update_with_extra_replaces_extra: a POST that does sendextrastill replaces it.pytest shaman/tests/controllers/test_repos.py shaman/tests/controllers/test_search.pypasses on sqlite: 73 tests.flake8 --select=F,E9is clean. The postgres tox env has not been run.Not covered
modifiedwith the current time. A replayed callback for an old build therefore still makes it the "latest" for its ref. Fixing that would mean honouring themodifiedthat chacra already sends, which changes "latest" ordering, so it's left for a separate change.api/builds/projects.pyhas the sameextradefault.urlin this handler likewise falls back to""when it's omitted.