Skip to content

Conversation

@feltech
Copy link
Member

@feltech feltech commented Aug 28, 2025

The Context instance is passed into every API method. The Context may bundle arbitrary state from the manager. In order for the Context to be created with the appropriate state by the manager, the host is required to construct a Context object using the Manager.createContext() method. However, we were not doing that and instead constructed the Context directly, which should never be done (other than for trivial cases e.g. unit tests).

Note that this cannot be unit tested easily - currently our mock manager BAL does not make use of the Context.

The Context instance is passed into every API method. The Context may
bundle arbitrary state from the manager. In order for the Context to be
created with the appropriate state by the manager, the host is required
to construct a Context object using the `Manager.createContext()`
method. However, we were not doing that and instead constructed the
Context directly, which should never be done (other than for trivial
cases e.g. unit tests).

Signed-off-by: David Feltell <david.feltell@foundry.com>
@feltech feltech requested a review from hutchinson August 28, 2025 16:10
@feltech feltech changed the title [Core] Use OpenAssetIO context from manager Use OpenAssetIO context from manager Aug 28, 2025
@feltech feltech self-assigned this Aug 28, 2025
Copy link

@hutchinson hutchinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@feltech feltech merged commit 751925f into OpenAssetIO:main Sep 23, 2025
10 checks passed
@feltech feltech deleted the work/fixContextCreation branch September 23, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants