Resolve the view chain for a draft view. Walks the `parent` links from the given view upward, collecting the IDs of each **Draft** ancestor. Stops when a **Shared ancestor (or the root) is reached. # Example ```ignore // feature-login (Draft, parent=service-auth) // service-auth (Draft, parent=dev) // dev (Shared, parent=main) let chain = txn.resolve_view_chain(&feature_login)?; //
(&self, view: &ViewState)
| 373 | /// // GRAPH is the implicit base (dev is Shared → stop) |
| 374 | /// ``` |
| 375 | fn resolve_view_chain(&self, view: &ViewState) -> Result<Vec<u64>, PristineError> { |
| 376 | let mut chain: Vec<u64> = Vec::new(); |
| 377 | |
| 378 | if view.kind.is_shared() { |
| 379 | // Shared views read directly from GRAPH, no chain needed |
| 380 | return Ok(chain); |
| 381 | } |
| 382 | |
| 383 | chain.push(view.id); |
| 384 | |
| 385 | let mut cursor = view.parent; |
| 386 | while let Some(parent_id) = cursor { |
| 387 | let parent = self.get_view_by_id(parent_id)?; |
| 388 | match parent { |
| 389 | Some(p) if p.kind.is_draft() => { |
| 390 | chain.push(p.id); |
| 391 | cursor = p.parent; |
| 392 | } |
| 393 | _ => break, // Shared ancestor or not found → GRAPH is the base |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | Ok(chain) |
| 398 | } |
| 399 | |
| 400 | /// Find all views that have the given view as their parent. |
| 401 | /// |
no test coverage detected