chore(schedule): PR #176 second-pass P3 follow-ups (audit actions, freeze migration, default stamp span) #186
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#186
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?
These P3 findings from the second review pass on #176 (business-day schedule records, #113) were deferred. None of them blocked the merge.
Standards
ScheduleSourcenow generates its DB CHECK, but the audit action values are still spelled out in two places: the Literal atapp/schemas/occupancy_models.py:390and a hardcoded CHECK atapp/db/database.py:362.'FREEZE'is also a bare string literal atapp/db/occupancy_repository.py:865.ScheduleSource, and the repository uses it instead of literals.FREEZE.'FREEZE'was added only to theCREATE TABLE IF NOT EXISTSCHECK (database.py:362). A database whose audit table was created by the pass-1 branch, such as the local validation copy of prod, rejects every automatic freeze with an IntegrityError inside the monitor. Prod is safe because the table is new there.FREEZEis missing, or a note in the local-validation docs to recreate the database.recordedflag.get_original_business_day_schedule_async(occupancy_repository.py:976) decodes an auditold_valuethat can be an unrecorded fallback (recorded: false) throughBusinessDaySchedule.from_record, which forcesrecorded=True. Only calibration reads it today.recordedflag, with a test.database.py:344-351). There's no injection risk because the values come from a Literal, but others may copy the pattern.occupancy_service.py:192,205,209).Spec
occupancy_service.py:357-360), and the test asserts thatcounted+3stays unrecorded (test :168). A closed or outage stretch after counting stopped, up to yesterday, therefore stays on the fallback, and a later weekly edit would reclassify it. The same applies to days the monitor missed while it was down, because it freezes only the current day (monitor_service.py:108-115).active_day - 1, with the test updated. Alternatively, the maintainer decides to keep the counted span, and the help text says so.occupancy_repository.py:976-992). A future IMPORTED writer that adds records without an audit row would make calibration follow whatever that record later becomes. An OVERWRITE never changes the calibration value, and that behavior is not documented. This needs a design decision: keep the audit-row invariant (documented in the docstring and enforced for every writer), or add an explicitoriginal_valuecolumn.monitor_service.py:108);occupancy_service.py:259,303);day_name(:429-431).Refs #176, #113.
🤖 Generated with Claude Code
Triage decision, 2026-10-02 (maintainer)
active_day − 1, whether or not it has counted data. On startup the monitor backfills days it missed while down. Update the test (counted+3must now be recorded).day_name: accepted.FREEZE: add a generic migration that rebuilds the CHECK whenever the allowed action set differs from the single definition introduced by item 1. Any future action reuses it.Relabelled
ready-for-agent.🤖 Generated with Claude Code