Skip to content

fix(backend): keep the backend image id when only image_url is unusable - #111

Merged
simonvanlierde merged 3 commits into
mainfrom
fix/keep-backend-image-id
Oct 27, 2026
Merged

simonvanlierde merged 3 commits into
mainfrom
fix/keep-backend-image-id

Conversation

@simonvanlierde

Copy link
Copy Markdown
Contributor

This keeps the backend's real image id when its upload reply has a valid image_id but a bad or missing image_url. Before, the whole reply was dropped and the sink fell back to the Pi's local capture id.

  • upload_image returned UploadedImageInfo(image_id=None, image_url=None) for any invalid reply, so BackendPushSink.put used the local id.
  • It now checks the validation errors from DeviceImageUploadAck: if none are on image_id, the id is kept and only the URL is dropped. An invalid id is still dropped.
  • Also renames _API_PORT to API_PORT in app/pairing/routers, since another module imports it. No behaviour change.

Tests: just check passes (918 passed, 1 skipped). The new test for a valid id with a bad URL failed before the fix with assert None == 'server-abc'. Not tried against a real backend.

- a 2xx reply with a valid image_id and a bad or missing image_url returned no id, so the sink fell back to the local capture id
- the id is now kept when it passes validation on its own; only the URL is dropped

Signed-off-by: Simon van Lierde <simonvanlierde@gmail.com>
- the constant is imported by another module, so it is not private

Signed-off-by: Simon van Lierde <simonvanlierde@gmail.com>
@codspeed

codspeed Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 12 untouched benchmarks


Comparing fix/keep-backend-image-id (43cf435) with main (85158d9)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (64bad1b) during the generation of this report, so 85158d9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@simonvanlierde
simonvanlierde enabled auto-merge (squash) October 27, 2026 16:00
@simonvanlierde
simonvanlierde merged commit 54f3c21 into main Oct 27, 2026
9 checks passed
@simonvanlierde
simonvanlierde deleted the fix/keep-backend-image-id branch October 27, 2026 16:04
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.

1 participant