Skip to content

Automatically load streams on accessor#79

Merged
bruno-f-cruz merged 15 commits intomainfrom
feat-auto-load
Nov 9, 2025
Merged

Automatically load streams on accessor#79
bruno-f-cruz merged 15 commits intomainfrom
feat-auto-load

Conversation

@bruno-f-cruz
Copy link
Copy Markdown
Member

@bruno-f-cruz bruno-f-cruz commented Nov 9, 2025

Fixes #78

@bruno-f-cruz bruno-f-cruz changed the title Automatically load streams on acessor Automatically load streams on accessor Nov 9, 2025
@bruno-f-cruz bruno-f-cruz mentioned this pull request Nov 9, 2025
@bruno-f-cruz bruno-f-cruz requested a review from Copilot November 9, 2025 02:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements automatic loading of data streams when accessed, controlled by a new implicit_loading context manager. By default, streams will auto-load when their data is accessed, eliminating the need to explicitly call load() in most cases. Users can disable this behavior when needed by using implicit_loading(False).

Key changes:

  • Added implicit_loading context manager using contextvars for thread-safe state management
  • Modified data access to automatically trigger loading when implicit loading is enabled
  • Refactored internal naming from _hashmap to _data_stream_mapping for clarity
  • Enhanced test coverage for implicit loading scenarios including error handling and nested collections

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/contraqctor/contract/base.py Implements implicit loading mechanism with context manager and updates data access logic to auto-load streams
tests/test_contract/test_core.py Adds comprehensive tests for implicit loading behavior in various scenarios including nested collections and error states

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bruno-f-cruz bruno-f-cruz changed the base branch from main to feat-add-error-sentinel November 9, 2025 03:41
@bruno-f-cruz bruno-f-cruz changed the base branch from feat-add-error-sentinel to main November 9, 2025 03:41
@bruno-f-cruz bruno-f-cruz merged commit 78dc5ae into main Nov 9, 2025
10 checks passed
@bruno-f-cruz bruno-f-cruz deleted the feat-auto-load branch November 9, 2025 03:44
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.

Consider automatically loading nodes

2 participants