Status: Accepted
Date: 2026-02-23
Authors: OSHUN Studio Architecture, OSHUN Web Engineering, OSHUN BFF
Reviewers: Domain Leads (Yemaya, Isis, Hathor, Aja, Bellona), Project
Obsidian Program Design
Context and Problem Statement#
Studio operators routinely switch between program, project, and workspace scopes while working across Yemaya, Isis, Hathor, Aja, and Bellona. Context switching must preserve intent, permissions, and execution continuity without introducing stale or ambiguous state.
Without a governed context-switch model, Studio risks:
- accidental execution in the wrong program/project/workspace scope
- context loss between discovery, navigation, and execution surfaces
- inconsistent permission evaluation during switch transitions
- weak auditability for context-switch decisions and failures
Decision Drivers#
- Context integrity: context must remain explicit, validated, and stable.
- Safety: context switching must prevent unsafe mutations and stale writes.
- Continuity: users should resume workflows without losing intent.
- Governance: context switches must be observable and auditable.
- Interoperability: one switching contract across web, BFF, and domains.
Considered Options#
Option 1: Route-Local Context State Only#
Each route maintains independent context-switch behavior.
Pros:
- Simple local implementation.
Cons:
- High drift risk across surfaces.
- Inconsistent permission and audit behavior.
Option 2: Client-Only Global Context Store#
Maintain one browser-side context store without server-validated switching contracts.
Pros:
- Faster local transitions.
Cons:
- Weak trust boundary for permission-sensitive changes.
- Risk of stale context under multi-tab or token refresh scenarios.
Option 3: Governed Context-Switch Transaction Model (Chosen)#
Adopt a canonical context envelope plus explicit switch transaction contracts validated by BFF and consumed by Studio surfaces.
Pros:
- Deterministic, auditable switching behavior.
- Consistent permission checks and policy enforcement.
- Safer handoff across domains and workflows.
Cons:
- Higher upfront contract/governance complexity.
Decision Outcome#
Chosen option: Option 3.
Workspace context switching requirements:
- Canonical context envelope containing
programId,projectId,workspaceId, actor role, and switch intent metadata. - Switch transaction contract with preflight validation, policy check, commit/rollback outcomes, and reason codes.
- Workflow continuity contract preserving return-path and pending-task hints through switch completion.
- Versioned compatibility rules for context schema and permission payloads.
- Release governance with validation, approval, telemetry/audit, and rollback controls.
Normative Rules#
Context Envelope Contract#
- Every switch operation must include
programId,projectId, andworkspaceId. - Context envelope must include
role,switchIntent, andrequestedAt. - Empty or partially specified context envelopes are invalid.
Switch Transaction Contract#
- Switch must execute as:
preflight -> policy check -> commit/rollback. - Policy-denied switches must not mutate active context.
- Failed commits must roll back to last confirmed context atomically.
Continuity Contract#
- Switch completion must preserve origin and back-path metadata.
- Pending workflow hints must be surfaced for user confirmation.
- Cross-domain route handoff must remain deterministic.
Compatibility Contract#
- Context schema changes require compatibility checks and explicit versioning.
- Breaking changes require migration guidance and rollback references.
Release Validity Contract#
A context-switch release is valid only when all are true:
- context envelope validation checks pass
- policy and entitlement checks pass
- commit/rollback semantics pass integration validation
- telemetry/audit records are complete
- rollback strategy is documented
Architecture Implications#
- Web shell and Studio surfaces consume one context-switch contract for route and workflow continuity.
- BFF performs authoritative validation and policy checks for switch transactions.
- Navigation/deep-link layers preserve origin/back-stack metadata.
- Analytics pipelines capture switch request, commit, rollback, and denial outcomes.
Acceptance Criteria (OST-00081)#
OST-00081 is complete only when:
- ADR exists at
docs/adr/ADR-0029-oshun-studio-workspace-context-switching.md. - ADR defines options, trade-offs, and selected strategy.
- ADR defines context envelope, switch transaction, continuity, compatibility, and release-validity contracts.
- ADR aligns with
ADR-0007throughADR-0022. - ADR aligns with
docs/releases/v1/design/ux-principles.md,apps/oshun/web/src/navigation/routes.ts, andlibs/oshun/domain-registry. - ADR explicitly covers Yemaya, Isis, Hathor, Aja, Bellona, and Project Obsidian.
Consequences#
Positive#
- Safer and more predictable workspace-context transitions.
- Stronger auditability and operational diagnostics for context changes.
- Better continuity across cross-domain workflows.
Negative#
- Additional coordination for contract and policy evolution.
- Requires strict discipline around context-schema migrations.
Related Decisions#
docs/adr/ADR-0013-oshun-shell-architecture-and-domain-adapters.mddocs/adr/ADR-0014-oshun-web-and-pwa-strategy.mddocs/adr/ADR-0015-deep-linking-and-cross-domain-routing.mddocs/adr/ADR-0016-shared-identity-and-cross-domain-session-model.mddocs/adr/ADR-0017-offline-caching-and-sync-strategy.mddocs/adr/ADR-0018-analytics-taxonomy-and-event-naming.mddocs/adr/ADR-0019-oshun-studio-information-architecture.mddocs/adr/ADR-0026-oshun-studio-navigation-and-command-surfaces.mddocs/adr/ADR-0027-oshun-studio-search-and-global-discovery.mddocs/adr/ADR-0028-oshun-studio-cross-domain-entity-model.md
References#
apps/oshun/web/src/components/DomainSwitcherEntryPanel.tsxapps/oshun/web/src/navigation/routes.tslibs/oshun/domain-registry/src/index.tsdocs/releases/v1/design/ux-principles.mddocs/domains/yemaya/features.mddocs/domains/isis/features.mddocs/domains/hathor/features.mddocs/domains/aja/features.mddocs/domains/bellona/features.md