feat: mirror solution writes into artefact.attributes (write-both) [2/3] - #849
Open
almeidaraul wants to merge 1 commit into
Open
feat: mirror solution writes into artefact.attributes (write-both) [2/3]#849almeidaraul wants to merge 1 commit into
almeidaraul wants to merge 1 commit into
Conversation
This was referenced Aug 18, 2026
Second step of the expand/contract migration to a generic `attributes`
field. The controllers now write to BOTH the legacy solution-specific fields
and `attributes`, so a later release can switch reads over safely:
- Starting a solution test still populates track/source/stage/
bundled_builds_hash and now also mirrors {track, source} into attributes.
- PATCHing bundled_builds still updates the legacy relationship/hash and now
mirrors {bundled_builds, bundled_builds_hash} into attributes (cleared when
bundled_builds is emptied).
Reads are unchanged and the API request/response contract is untouched, so
this is a no-op for existing clients and safe during a rolling upgrade.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
almeidaraul
force-pushed
the
TO-404/2-write-both
branch
from
August 18, 2026 13:13
27d23f0 to
bba7eea
Compare
almeidaraul
marked this pull request as ready for review
August 18, 2026 13:29
Contributor
There was a problem hiding this comment.
Pull request overview
Implements the “write-both” step for migrating solution-specific artefact data into the new generic artefact.attributes JSONB field, while keeping existing reads and the API contract unchanged for rolling-upgrade safety.
Changes:
- When starting a solution test execution, mirror
{track, source}intoartefact.attributesin addition to the legacy columns. - When PATCHing
bundled_builds, mirror{bundled_builds, bundled_builds_hash}intoartefact.attributes, and remove those mirrored keys when clearing bundled builds. - Add/extend controller tests to cover the write-both mirroring behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| backend/test_observer/controllers/test_executions/start_test.py | Mirrors solution identity (track, source) into artefact.attributes during artefact creation for solution test starts. |
| backend/test_observer/controllers/artefacts/artefacts.py | Mirrors bundled build IDs/hash into artefact.attributes when bundled_builds is patched/cleared. |
| backend/tests/controllers/test_executions/test_start_test.py | Adds a test asserting solution start writes both legacy fields and attributes. |
| backend/tests/controllers/artefacts/test_artefacts.py | Extends PATCH bundled builds tests to assert mirroring/clearing behavior for attributes. |
Suppressed comments (1)
backend/tests/controllers/artefacts/test_artefacts.py:1661
- Clearing
bundled_buildsshould remove the mirrored keys, but it shouldn’t require the entireattributesobject to be empty (other keys may legitimately remain). This assertion will fail if any other attributes are present.
assert response.status_code == 200
assert response.json()["attributes"] == {}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| } | ||
|
|
||
| self.artefact = get_or_create(self.db, Artefact, filter_kwargs=filter_kwargs, creation_kwargs=creation_kwargs) |
Comment on lines
+1619
to
+1623
| expected_ids = sorted([build1.id, build2.id]) | ||
| assert data["attributes"] == { | ||
| "bundled_builds": expected_ids, | ||
| "bundled_builds_hash": calculate_bundled_builds_hash(expected_ids), | ||
| } |
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.
Part 2 of 3 (stacked). Base:
TO-404/1-add-attributes(#848).What
Write-both step: the controllers now write to both the legacy solution-specific fields and the new
attributesfield, so a later release can switch reads over safely.track/source/stage/bundled_builds_hashand now also mirrors{track, source}intoattributes.bundled_buildsstill updates the legacy relationship/hash and now mirrors{bundled_builds, bundled_builds_hash}intoattributes(cleared whenbundled_buildsis emptied).Safety
Reads are unchanged and the API request/response contract is untouched (OpenAPI schema is identical), so this is a no-op for existing clients and safe during a rolling upgrade.
Review note
Review only against the base branch (#848). Merge/deploy after #848.