feat(context): hierarchical context model with parent_id and context_stack #385

Open
opened 2026-03-03 23:02:47 +00:00 by forbes · 0 comments
Owner

Summary

Replace the flat priority-based context model with a hierarchical one that reflects real editing state nesting (e.g., sketch inside body inside assembly).

Current state (MISSING)

ContextDefinition has no parent_id field. EditingContextResolver resolves to exactly one active context via priority. Breadcrumb segments display a visual hierarchy (Part > Body > Sketch > [editing]) but this is hardcoded display logic in BreadcrumbToolBar, not a queryable stack.

Proposed design

  • Optional parent_id parameter on register_context() — declares that this context can only activate as a child of another
  • sdk.context_stack() — returns the active hierarchy as a list, e.g. ["assembly.idle", "partdesign.body", "sketcher.edit"]
  • Breadcrumb auto-built from the stack, not just the leaf context
  • Resolution: walk up from the most specific match, collecting ancestors

Implementation notes

  • Add parent_id field to ContextDefinition struct in EditingContext.h
  • Modify EditingContextResolver::resolve() to build a stack, not a single result
  • EditingContext struct gains a stack field (QStringList of context IDs)
  • BreadcrumbToolBar::buildSegments() reads from stack instead of hardcoded logic
  • Python SDK: add parent_id param to register_context(), add context_stack()

Roadmap

v0.2.0 — Context System

## Summary Replace the flat priority-based context model with a hierarchical one that reflects real editing state nesting (e.g., sketch inside body inside assembly). ## Current state (MISSING) `ContextDefinition` has no `parent_id` field. `EditingContextResolver` resolves to exactly one active context via priority. Breadcrumb segments display a visual hierarchy (Part > Body > Sketch > [editing]) but this is hardcoded display logic in `BreadcrumbToolBar`, not a queryable stack. ## Proposed design - Optional `parent_id` parameter on `register_context()` — declares that this context can only activate as a child of another - `sdk.context_stack()` — returns the active hierarchy as a list, e.g. `["assembly.idle", "partdesign.body", "sketcher.edit"]` - Breadcrumb auto-built from the stack, not just the leaf context - Resolution: walk up from the most specific match, collecting ancestors ## Implementation notes - Add `parent_id` field to `ContextDefinition` struct in `EditingContext.h` - Modify `EditingContextResolver::resolve()` to build a stack, not a single result - `EditingContext` struct gains a `stack` field (QStringList of context IDs) - `BreadcrumbToolBar::buildSegments()` reads from stack instead of hardcoded logic - Python SDK: add `parent_id` param to `register_context()`, add `context_stack()` ## Roadmap v0.2.0 — Context System
forbes added the enhancement label 2026-03-03 23:02:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#385