Commit 2089c1c
committed
fix(callcenter): widen OwlIdentity slot u8 -> u16, preserve full registry IDs in audit
Per chatgpt-codex-connector P1 review on PR #364: owl_from_schema_ptr
truncated SchemaPtr::entity_type_id (u16) to 8 bits, so distinct
authorized entities whose registry IDs differ by 256 collided in the
audit log. RegistryState::append allocates IDs globally as rows.len()+1
u16, not per-namespace u8 slots, so the truncation was reachable on
otherwise-valid hydrated registries.
User decision (sprint-5-roadmap OQ): widen now, not defer to sprint 5.
Contract-level change rippling through three call sites:
* OwlIdentity: 2-byte packed u16 -> named fields { family: OgitFamily,
slot: u16 }. raw() removed; replaced by to_canonical_bytes() -> [u8; 3]
returning the deterministic on-wire form [family, slot_lo, slot_hi].
new()/is_slot() now take slot: u16. UNKNOWN literal updated.
* owl_from_schema_ptr: drop the & 0xFF truncation; entity_type_id flows
through full-width.
* UnifiedAuditEvent::canonical_bytes: grows 25 -> 26 bytes. owl now
occupies [13..16); op/decision/role_hash offsets shifted by 1. Wire
format is breaking for any persisted audit log — none exist outside
test fixtures at this commit, so no migration is needed in tree.
Cross-language emitters (Rust / C#) get the new layout via
OwlIdentity::to_canonical_bytes.
* OgitFamilyTable: [Option<FamilyEntry>; 256] dense array -> sparse
HashMap<u16, FamilyEntry>. Lookups stay O(1); resident set scales
with occupied-slot count, not the u16 keyspace. set()/clear() now
take slot: u16. The doc comments' '256-slot' framing is replaced
by 'sparse map'.
Tests:
* slot_keyspace_distinguishes_high_ids — locks the new invariant by
asserting slot 7 and slot 7+256 stay distinct (would alias under
the old layout).
* canonical_bytes_round_trips_field_order — updated to the 26-byte
layout and to_canonical_bytes() projection.
97/97 callcenter lib tests pass.
Refs: PR #364 review threads (P1 priority); sprint-5 roadmap OQ
'PR-D5 compat shim vs coordinated cutover' — resolved as cutover
(no compat shim because no on-disk audit log exists yet outside
test fixtures).1 parent bdbd08d commit 2089c1c
4 files changed
Lines changed: 108 additions & 62 deletions
File tree
- crates/lance-graph-callcenter/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
191 | 199 | | |
192 | 200 | | |
193 | 201 | | |
194 | | - | |
195 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
196 | 205 | | |
197 | | - | |
198 | | - | |
199 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
200 | 210 | | |
201 | 211 | | |
202 | 212 | | |
203 | | - | |
| 213 | + | |
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
210 | | - | |
| 220 | + | |
211 | 221 | | |
212 | 222 | | |
213 | 223 | | |
214 | 224 | | |
215 | | - | |
| 225 | + | |
216 | 226 | | |
217 | 227 | | |
218 | 228 | | |
219 | 229 | | |
220 | | - | |
| 230 | + | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
| |||
232 | 242 | | |
233 | 243 | | |
234 | 244 | | |
235 | | - | |
| 245 | + | |
236 | 246 | | |
237 | 247 | | |
238 | 248 | | |
| |||
270 | 280 | | |
271 | 281 | | |
272 | 282 | | |
273 | | - | |
| 283 | + | |
274 | 284 | | |
275 | | - | |
| 285 | + | |
276 | 286 | | |
277 | 287 | | |
278 | 288 | | |
279 | | - | |
| 289 | + | |
280 | 290 | | |
281 | | - | |
| 291 | + | |
282 | 292 | | |
283 | 293 | | |
284 | | - | |
| 294 | + | |
285 | 295 | | |
286 | 296 | | |
287 | | - | |
| 297 | + | |
288 | 298 | | |
289 | 299 | | |
290 | 300 | | |
291 | 301 | | |
292 | 302 | | |
293 | | - | |
| 303 | + | |
294 | 304 | | |
295 | 305 | | |
296 | 306 | | |
| |||
397 | 407 | | |
398 | 408 | | |
399 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
400 | 427 | | |
401 | 428 | | |
402 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| |||
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
180 | | - | |
| 182 | + | |
181 | 183 | | |
182 | | - | |
| 184 | + | |
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
455 | 457 | | |
456 | 458 | | |
457 | 459 | | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
462 | 464 | | |
463 | 465 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
106 | 115 | | |
107 | | - | |
108 | 116 | | |
109 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
110 | 121 | | |
111 | 122 | | |
112 | 123 | | |
113 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
114 | 128 | | |
115 | 129 | | |
116 | | - | |
| 130 | + | |
117 | 131 | | |
118 | | - | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
122 | 136 | | |
123 | 137 | | |
124 | | - | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
128 | | - | |
| 142 | + | |
129 | 143 | | |
130 | | - | |
| 144 | + | |
131 | 145 | | |
132 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
133 | 150 | | |
134 | | - | |
| 151 | + | |
135 | 152 | | |
136 | | - | |
| 153 | + | |
| 154 | + | |
137 | 155 | | |
138 | 156 | | |
139 | 157 | | |
140 | 158 | | |
141 | 159 | | |
142 | 160 | | |
143 | | - | |
| 161 | + | |
144 | 162 | | |
145 | 163 | | |
146 | 164 | | |
147 | 165 | | |
148 | | - | |
| 166 | + | |
149 | 167 | | |
150 | | - | |
| 168 | + | |
151 | 169 | | |
152 | 170 | | |
153 | 171 | | |
| |||
444 | 462 | | |
445 | 463 | | |
446 | 464 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
455 | | - | |
| 471 | + | |
456 | 472 | | |
457 | 473 | | |
458 | 474 | | |
| |||
0 commit comments