-
Notifications
You must be signed in to change notification settings - Fork 725
refactor: carve out ARF & Storage into first-class Code Blue domains #1596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felixschmetz
wants to merge
8
commits into
main
Choose a base branch
from
feat/arf-code-blue-domain
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e7c01a2
refactor: migrate ARF to Code Blue domain architecture
felixschmetz 675d8ca
refactor: revert admin_sync_service to singleton, remove backward-com…
felixschmetz 4285c9b
refactor: migrate storage to Code Blue domain architecture
felixschmetz 3f2cac6
refactor: wire StorageBackend through Container, drop factory lru_cache
felixschmetz e567a4d
test: close domain coverage gaps for ARF and storage
felixschmetz 58d7072
refactor: explicit protocol impls, fix broken snapshot import, clean …
felixschmetz 4f766ca
refactor: move SyncFileManager to Container DI with protocol and Inje…
felixschmetz 5139bbd
refactor: make FileService.storage_backend required, drop TYPE_CHECKI…
felixschmetz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| """ARF (Airweave Raw Format) domain. | ||
|
|
||
| Raw entity capture for replay, debugging, and evals. | ||
| """ | ||
|
|
||
| from airweave.domains.arf.protocols import ArfReaderProtocol, ArfServiceProtocol | ||
| from airweave.domains.arf.types import EntitySerializationMeta, SyncManifest | ||
|
|
||
| __all__ = [ | ||
| "ArfServiceProtocol", | ||
| "ArfReaderProtocol", | ||
| "SyncManifest", | ||
| "EntitySerializationMeta", | ||
| ] |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| """In-memory fake for ArfReaderProtocol.""" | ||
|
|
||
| from typing import Any, AsyncGenerator, Dict, List, Optional | ||
|
|
||
| from airweave.platform.entities._base import BaseEntity | ||
|
|
||
|
|
||
| class FakeArfReader: | ||
| """In-memory fake for ArfReaderProtocol. | ||
|
|
||
| Returns pre-seeded entities and manifest data. | ||
| """ | ||
|
|
||
| def __init__(self) -> None: | ||
| self._entities: List[BaseEntity] = [] | ||
| self._manifest: Optional[Dict[str, Any]] = None | ||
| self._valid: bool = True | ||
| self._calls: List[tuple] = [] | ||
| self._should_raise: Optional[Exception] = None | ||
|
|
||
| # -- Test helpers ---------------------------------------------------------- | ||
|
|
||
| def seed_entities(self, entities: List[BaseEntity]) -> None: | ||
| """Pre-populate entities to return during iteration.""" | ||
| self._entities = list(entities) | ||
|
|
||
| def seed_manifest(self, manifest: Dict[str, Any]) -> None: | ||
| """Pre-populate the manifest dict.""" | ||
| self._manifest = manifest | ||
|
|
||
| def set_valid(self, valid: bool) -> None: | ||
| """Control what validate() returns.""" | ||
| self._valid = valid | ||
|
|
||
| def set_error(self, error: Exception) -> None: | ||
| """Configure next call to raise.""" | ||
| self._should_raise = error | ||
|
|
||
| def get_calls(self, method: str) -> List[tuple]: | ||
| """Return calls for a specific method.""" | ||
| return [c for c in self._calls if c[0] == method] | ||
|
|
||
| # -- Protocol implementation ----------------------------------------------- | ||
|
|
||
| async def validate(self) -> bool: | ||
| self._calls.append(("validate",)) | ||
| if self._should_raise: | ||
| exc, self._should_raise = self._should_raise, None | ||
| raise exc | ||
| return self._valid | ||
|
|
||
| async def read_manifest(self) -> Dict[str, Any]: | ||
| self._calls.append(("read_manifest",)) | ||
| if self._should_raise: | ||
| exc, self._should_raise = self._should_raise, None | ||
| raise exc | ||
| if self._manifest is None: | ||
| raise FileNotFoundError("No manifest seeded") | ||
| return self._manifest | ||
|
|
||
| async def get_entity_count(self) -> int: | ||
| self._calls.append(("get_entity_count",)) | ||
| if self._should_raise: | ||
| exc, self._should_raise = self._should_raise, None | ||
| raise exc | ||
| return len(self._entities) | ||
|
|
||
| async def iter_entities(self) -> AsyncGenerator[BaseEntity, None]: | ||
| self._calls.append(("iter_entities",)) | ||
| if self._should_raise: | ||
| exc, self._should_raise = self._should_raise, None | ||
| raise exc | ||
| for entity in self._entities: | ||
| yield entity | ||
|
|
||
| def cleanup(self) -> None: | ||
| self._calls.append(("cleanup",)) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporary - let's defer restructuring the admin stuff