Commit 0d4c322
committed
fix: separate identities that shared a runtime representation
Seven confirmed defects from the typed-contracts audit, each one two
semantically different values wearing the same type and name.
Speaker tenant. speaker_recognition_client sent a literal user_id="1" on
every diarization, identification and wake-word gating call, so every
Chronicle user resolved to one shared gallery. The speaker service now
takes Chronicle's own user id as its tenant (users.id and the three FKs
become String) and the client passes it. Callers that had no tenant to
give — guided enrollment, fine-tuning, drift, enrollment health — thread
the owning user instead of defaulting to 1.
registered_clients. Stored as a {client_id: {...}} mapping while the
inverse lookup queried registered_clients.client_id, which MongoDB
resolves across array elements but not object keys, so it matched nothing
for every real device. Disconnects never stamped last_seen and admins
could not act on another user's device. Now a typed list[RegisteredClient].
ClientId. The upload controller had a second generate_client_id that
interpolated the raw device name, so one device got two identities
depending on how its audio arrived. One constructor now; server-generated
labels use synthetic_client_id, which does not sanitize a name that was
never user input.
End reason vs processing trigger. file_upload, reprocess_orphan,
reprocess_transcript and rebound were passed as end_reason while none is
an EndReason member, so each was stored as UNKNOWN while the emitted event
still reported the raw string. They travel in ProcessingTrigger now, and a
reprocess passes no end reason at all, so a recording keeps the reason it
really ended with.
Transcription provider vs mode. The streaming consumer wrote
provider=b"streaming" — a mode — which persisted as the transcript
version's provider AND model, losing which service produced it. provider,
mode and model are three fields now. The "deepgram" fallback is gone: a
guessed provider is indistinguishable from a real one afterwards.
Timeline audio claims. Split deep-copied every audio range onto both
halves, so both played the whole original; merge never unioned them, so
absorbed episodes' audio died with their documents. Ranges are now clipped
on split and unioned on merge. A chunk with no captured_at (3% here) can
be placed on neither side, so it stays with the head rather than being
dropped or double-claimed.
Durable spool identity. The phone's spool-file id travelled as
durable_session_id and came back as session_id, colliding with the backend
SessionId that means something else. Now spool_segment_id end to end.
Also fixed, same class, found while working:
- DerivedOperation was {split, merge} but maybe_trim_silence passes
"silence_trim", so the remnant's lineage record raised at construction
and silence trimming crashed outright.
- The wake-word service could never start: identities.py is committed but
absent from both the .dockerignore allowlist and the Dockerfile COPY.
- A truncated day write was either mislabelled `written` or retried three
times and settled `skipped`. DayWriteOutcome.PARTIAL is a third terminal
state so it is neither.1 parent 2590985 commit 0d4c322
59 files changed
Lines changed: 2460 additions & 763 deletions
File tree
- app/src
- hooks
- services
- backends/advanced
- src
- advanced_omi_backend
- controllers
- models
- routers/modules
- services
- audio_stream
- memory
- providers
- timeline
- transcription
- workers
- scripts
- tests
- extras
- speaker-recognition
- src/simple_speaker_recognition
- api/routers
- core
- database
- utils
- tests
- wakeword-service
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
| 233 | + | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | | - | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
59 | | - | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | | - | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
100 | | - | |
| 106 | + | |
101 | 107 | | |
102 | 108 | | |
103 | 109 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
116 | | - | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| |||
Lines changed: 39 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
457 | 490 | | |
458 | 491 | | |
459 | 492 | | |
460 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
461 | 499 | | |
462 | 500 | | |
463 | 501 | | |
| |||
478 | 516 | | |
479 | 517 | | |
480 | 518 | | |
481 | | - | |
482 | | - | |
| 519 | + | |
483 | 520 | | |
484 | 521 | | |
485 | 522 | | |
| |||
Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
| |||
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | | - | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | | - | |
46 | | - | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | | - | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | | - | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | | - | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
Lines changed: 27 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
979 | 978 | | |
980 | 979 | | |
981 | 980 | | |
982 | | - | |
| 981 | + | |
983 | 982 | | |
984 | 983 | | |
985 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
986 | 988 | | |
987 | 989 | | |
988 | 990 | | |
| |||
1004 | 1006 | | |
1005 | 1007 | | |
1006 | 1008 | | |
1007 | | - | |
| 1009 | + | |
1008 | 1010 | | |
1009 | 1011 | | |
1010 | 1012 | | |
| |||
1051 | 1053 | | |
1052 | 1054 | | |
1053 | 1055 | | |
1054 | | - | |
| 1056 | + | |
1055 | 1057 | | |
1056 | | - | |
| 1058 | + | |
1057 | 1059 | | |
1058 | 1060 | | |
1059 | 1061 | | |
| |||
1103 | 1105 | | |
1104 | 1106 | | |
1105 | 1107 | | |
1106 | | - | |
1107 | | - | |
| 1108 | + | |
1108 | 1109 | | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
| 1110 | + | |
| 1111 | + | |
1118 | 1112 | | |
1119 | 1113 | | |
1120 | | - | |
| 1114 | + | |
| 1115 | + | |
1121 | 1116 | | |
1122 | 1117 | | |
1123 | 1118 | | |
1124 | 1119 | | |
1125 | 1120 | | |
1126 | | - | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1127 | 1124 | | |
1128 | 1125 | | |
1129 | 1126 | | |
| |||
1224 | 1221 | | |
1225 | 1222 | | |
1226 | 1223 | | |
1227 | | - | |
| 1224 | + | |
1228 | 1225 | | |
1229 | 1226 | | |
1230 | 1227 | | |
| |||
1236 | 1233 | | |
1237 | 1234 | | |
1238 | 1235 | | |
1239 | | - | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1240 | 1239 | | |
1241 | 1240 | | |
1242 | 1241 | | |
| |||
1281 | 1280 | | |
1282 | 1281 | | |
1283 | 1282 | | |
1284 | | - | |
| 1283 | + | |
1285 | 1284 | | |
1286 | 1285 | | |
1287 | 1286 | | |
| |||
1293 | 1292 | | |
1294 | 1293 | | |
1295 | 1294 | | |
1296 | | - | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1297 | 1298 | | |
1298 | 1299 | | |
1299 | 1300 | | |
| |||
1519 | 1520 | | |
1520 | 1521 | | |
1521 | 1522 | | |
1522 | | - | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
1523 | 1526 | | |
1524 | 1527 | | |
1525 | 1528 | | |
| |||
0 commit comments