fix(telemetry): PR #52 review follow-ups — throttle ignores direct fetches, direction typing, engine contract docs #67
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#67
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)
createTrailingThrottle(app/static/js/src/utils.js) runs on the next tick when idle for a full window: a leading edge, while the spec says "trailing".refreshOccupancyData()calls (login andswitchTab('doors'), timespan change, about 14 admin actions inapp/static/js/app.js) don't reset the throttle'slastRunAt. So a push right after one of them causes a second fetch: simulated fetches at t=0 and t=0, or 0 s and 1 s in a burst.markRan()thatrefreshOccupancyDatacalls, or route the direct calls through it. Then decide explicitly whether the first push after idle should wait.Code quality (Standards)
app/controllers/occupancy_controller.py:~392:for direction, total, cams, spacing in (...)reusescams, which already holds the list of all cameras and is the fallback inin_cams = [...] or cams. Rename the loop variable (e.g.targets).ingestMessage/onRawMessagecontract is undocumented where callers look.app/static/js/src/telemetry/telemetry_engine.js: the rule thatingestMessage()does not fireonRawMessageis only an inline comment. Move it intoingestMessage's JSDoc, and documentonRawMessage(network messages only) and_handleMessage's{ fromNetwork }option./eventcontroller checks("IN", "OUT")by hand, andCountingEventInput.directionisLiteral["IN", "OUT"];CountingEventWebhookPayload.directionis stillstr. Define oneDirectiontype alias and use it in all three. Coordinate with #64, which owns that endpoint.directionis still a plain string past the input boundary.PassengerFlowEvent.directionandrecord_counting_event_async(direction: str)are untyped. Keep in mind that stored rows may predate validation (oldPASSrows) when narrowing the read model.GroupMember.sync_passenger_flow_from_artemis_asyncreadsmember.codein the new loop but still tuple-unpacksfor c_code, _ in in_camsin the totals just above. Use attribute access throughout.Acceptance criteria
node --test).Related: #14, #64, PR #52.
Follow-ups from PR #52 review: throttle ignores direct fetches, direction typing, engine contract docsto fix(telemetry): PR #52 review follow-ups — throttle ignores direct fetches, direction typing, engine contract docs