follow-up(telemetry): P3 cleanups from #93 review (cardholder name) #101

Open
opened 2026-09-25 12:14:47 +00:00 by gabogg · 0 comments
Owner

Follow-ups from the pass-2 review of #93 (comment on #93). All P3; the P2 (untested person_id masking) was fixed in cfefbf3 before merge.

Standards

  • Duplicated person_id extraction in both insert paths of cycle_repository.py and both door/events polls in door_service.py.
  • Loose credential fields. cardNo, personId, personName, personRole and picUrl travel as loose dict keys through six files; a small Credential value would absorb the next field (code-standards §2.3).
  • Empty person_id guard. fill_person_name_async would write one name onto every nameless cycle with no person id (~4,900 rows in production) if called with ''. Return 0 when empty.
  • Sanitizer duplication. sanitizer_repository.py repeats the try/UPDATE/debug block in sync and async paths (existing pattern).

Spec

  • FORCED on an already-open cycle. The new forced-open test uses the create path. Add: an existing open cycle plus an anonymous opening, then an alarm webhook carrying a card; assert open_trigger stays FORCED after settle() resolves the name. Spec: "Button / manual / forced / unknown triggers unaffected."
  • Wording on #73. Comment 2048 says the cycle has a "CREDENTIAL trigger" after resolution; the write-back doesn't change the trigger. The card set it at ingestion.

🤖 Generated with Claude Code

Follow-ups from the pass-2 review of #93 (comment on #93). All P3; the P2 (untested `person_id` masking) was fixed in cfefbf3 before merge. ## Standards - [ ] **Duplicated `person_id` extraction** in both insert paths of `cycle_repository.py` and both `door/events` polls in `door_service.py`. - [ ] **Loose credential fields.** `cardNo`, `personId`, `personName`, `personRole` and `picUrl` travel as loose dict keys through six files; a small `Credential` value would absorb the next field (code-standards §2.3). - [ ] **Empty `person_id` guard.** `fill_person_name_async` would write one name onto every nameless cycle with no person id (~4,900 rows in production) if called with `''`. Return 0 when empty. - [ ] **Sanitizer duplication.** `sanitizer_repository.py` repeats the try/`UPDATE`/debug block in sync and async paths (existing pattern). ## Spec - [ ] **FORCED on an already-open cycle.** The new forced-open test uses the create path. Add: an existing open cycle plus an anonymous opening, then an alarm webhook carrying a card; assert `open_trigger` stays `FORCED` after `settle()` resolves the name. Spec: "Button / manual / forced / unknown triggers unaffected." - [ ] **Wording on #73.** Comment 2048 says the cycle has a "CREDENTIAL trigger" after resolution; the write-back doesn't change the trigger. The card set it at ingestion. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#101
No description provided.