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)
| 321 | /// // GRAPH is the implicit base (dev is Shared → stop) |
| 322 | /// ``` |
| 323 | fn resolve_view_chain(&self, view: &ViewState) -> Result<Vec<u64>, PristineError> { |
| 324 | let mut chain: Vec<u64> = Vec::new(); |
| 325 | |
| 326 | if view.kind.is_shared() { |
| 327 | // Shared views read directly from GRAPH, no chain needed |
| 328 | return Ok(chain); |
| 329 | } |
| 330 | |
| 331 | chain.push(view.id); |
| 332 | |
| 333 | let mut cursor = view.parent; |
| 334 | while let Some(parent_id) = cursor { |
| 335 | let parent = self.get_view_by_id(parent_id)?; |
| 336 | match parent { |
| 337 | Some(p) if p.kind.is_draft() => { |
| 338 | chain.push(p.id); |
| 339 | cursor = p.parent; |
| 340 | } |
| 341 | _ => break, // Shared ancestor or not found → GRAPH is the base |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | Ok(chain) |
| 346 | } |
| 347 | |
| 348 | /// Find all views that have the given view as their parent. |
| 349 | /// |
no test coverage detected