fix(live): propagate global zone status to video selector + per-video grid - #437
Merged
Conversation
…eo grid After concluding zone definition in a LIVE project, the drawing-tab video selector and the main-control per-video grid kept showing "—" (no arena/ROI), even though the arena and ROIs were saved. Root cause: live zones are GLOBAL (single camera → project_data["detection_zones"]), but the planned-session placeholder rows injected for live projects hardcoded has_arena/has_rois=False. Both views derive their badges from those rows, so the status never appeared. - validation_manager._add_live_planned_session_placeholders: derive has_arena/ has_rois once from the global zone data (pm.get_zone_data(fallback_to_global=True)) and apply to every planned placeholder, instead of hardcoding False. - zone_control_builder._on_conclude_video: also force a project-overview refresh after Concluir. The existing tree refresh only rebuilt the drawing-tab selector; the main-control grid is a separate view and needs its own refresh. Tests: placeholders reflect global arena/ROIs when defined, stay empty otherwise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a propagation gap in LIVE projects where global zone status (arena/ROIs stored in project_data["detection_zones"]) was not reflected in (1) the zones-tab video selector and (2) the main project overview per-video grid after the user clicked Concluir.
Changes:
- Update LIVE planned-session placeholders to derive
has_arena/has_roisfrom the global zone data instead of hardcodingFalse. - Trigger a project overview refresh on Concluir so the per-video grid updates alongside the drawing-tab selector.
- Add GUI tests ensuring planned placeholders reflect global arena/ROI presence (and stay empty when zones are unset).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/zebtrack/ui/components/validation_manager.py |
Compute global arena/ROI flags once and apply them to all planned-session placeholders in LIVE projects. |
src/zebtrack/ui/builders/zone_control_builder.py |
Force an overview refresh after concluding zone definition to update the main per-video grid. |
tests/ui/components/test_validation_manager.py |
Add GUI tests asserting placeholders reflect global zone flags for LIVE projects. |
Comment on lines
+259
to
+263
| if video_selector_manager is not None: | ||
| try: | ||
| video_selector_manager.request_overview_refresh( | ||
| reason="zones_concluded", force=True | ||
| ) |
Comment on lines
+264
to
+268
| except Exception: # except Exception justified: refresh must not break Concluir | ||
| log.debug( | ||
| "zone_control_builder.conclude_video.overview_refresh_failed", | ||
| exc_info=True, | ||
| ) |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- zone_control_builder: move the forced overview refresh AFTER the potential ZONE_SAVE_ARENA publish and gate it on `not zone_saved`. When an interactive edit is committed, ZONE_SAVE_ARENA → ZONES_UPDATED already schedules an overview refresh with post-save flags; forcing one before that rebuilt the grid with pre-save data and duplicated the work. - Include error=str(exc) alongside exc_info in both failure logs (overview refresh + global zone lookup) so structured logs show the root cause. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Continuação da cadeia de correções do fluxo de zonas em projeto LIVE (#433/#435/#436).
Problema
Depois de clicar Concluir, a informação não propagava: nem o box de selecionar vídeo para desenho mostrava os ícones de que o vídeo já tem arena e ROIs, nem a grade de detalhes por vídeo na aba de controle principal atualizava.
Causa raiz
Zonas de projeto LIVE são globais (uma câmera →
project_data["detection_zones"]), não por vídeo. Antes da 1ª gravação, as duas views mostram placeholders de "Sessão planejada" (_add_live_planned_session_placeholders), e esses placeholders hardcodavamhas_arena=False/has_rois=False. Como ambas as views derivam os badges desses placeholders, o status nunca aparecia.Além disso, o botão Concluir só reconstruía o seletor da aba de desenho (
VIDEO_TREE_REFRESH_REQUESTED) — a grade principal (project overview) é uma view separada e não era atualizada.Correção
validation_manager._add_live_planned_session_placeholders: derivahas_arena/has_roisuma vez da zona global (pm.get_zone_data(fallback_to_global=True)) e aplica a todos os placeholders, em vez de hardcodarFalse. Robusto para arena-only e com ROIs (osave_zone_datapopuladetection_zonesmesmo compersist=False).zone_control_builder._on_conclude_video: força também umrequest_overview_refresh(force=True)após Concluir, para a grade principal atualizar junto com o seletor.Proatividade (investigação da cadeia)
detection_zonesé escrito incondicionalmente emsave_zone_data(arena persist=False inclusa) → o fix 1 reflete a arena mesmo sem ROIs._build_video_hierarchy_data→_add_live_planned_session_placeholders, então um único fix cobre as duas.compute_project_status_counts) contam por vídeo gravado viahas_arena_data(path)e não refletem zonas globais antes da 1ª gravação — os cards são um agregado à parte, não a grade/seletor que o usuário reportou. Posso tratar em PR separado se desejado.Testes
tests/ui/components/test_validation_manager.py(+2): placeholders refletem arena/ROIs globais quando definidos; ficam vazios sem zona. Suíte gui do arquivo: 177 passed.ruff/format/mypy✅.🤖 Generated with Claude Code