fix(occupancy): PR #53 review follow-ups — unlisted-group state, typed camera rows, naming #65
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#65
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Behaviour (Spec P3s)
_skip_group_async(app/services/occupancy_service.py) records the new skip reason in memory beforemark_group_unlisted_asyncwrites. If that write fails once, later polls see the same reason and never retry, so the group never appears inGET /api/occupancy/camera-groups. Fix: write first, record the reason only after the write succeeds.is_unlistedis only cleared when HikCentral lists the group again. A group that is unlisted and then drops out ofcount_listentirely staysis_unlisted=Truein the endpoint forever, and its stale_group_skip_reasonsentry suppresses the warning if it returns with the same reason. Decide: clear or age out the flag when a group is absent from both lists, and prune_group_skip_reasonsfor codes not seen in the current poll.app/main.py, ifenforce_counting_integrity_asyncraises at startup,sync_initial_counts_from_artemis_asyncandreconcile_and_quarantine_historical_anomalies_asyncare skipped because they share itstry. Give the integrity check its owntry.Code quality (Standards)
OccupancyRepository.get_camera_asyncreturnsdict[str, Any] | NonealthoughCountingCameraItemexists;cam_payloadin the camera sync carries an untypedresource_group_codekey._group_skip_reasonscontrols whethermark_group_unlisted_asyncruns, while camera sync clears the DB flag without touching the dict, so the two can drift. Related to items 1–2; consider deriving the "already flagged" decision from the stored row instead.group_cam_map[g_code] = {"name", "in_cams", "out_cams"}in the passenger flow sync is a raw dict; a small typed structure would matchGroupMember.GroupMemberandGroupSkipReasonlive in the service whileQuarantineReasonlives inapp/schemas/. Pick one home.GroupSkipReasonvalues are log sentences; consider short codes plus a message map.QuarantineTally.totalmeans passages; rename topassagesand add a docstring.app/main.py(lines ~83 and ~100) still usesstatus.HTTP_422_UNPROCESSABLE_ENTITY(deprecated in the installed Starlette) while the occupancy controller usesHTTP_422_UNPROCESSABLE_CONTENT. Production runs Starlette 1.6.0, so both work; unify on_CONTENTand consider pinning a minimum Starlette version inrequirements.txt, sincefastapi>=0.115.0alone does not guarantee_CONTENTexists.Acceptance criteria
node --test).Related: #29, PR #53.
Follow-ups from PR #53 review: unlisted-group state, typed camera rows, namingto fix(occupancy): PR #53 review follow-ups — unlisted-group state, typed camera rows, naming