From 116355b502581500080f6c0201a305d505e4797d Mon Sep 17 00:00:00 2001 From: padreug Date: Mon, 15 Dec 2025 00:35:22 +0100 Subject: [PATCH] Fix get_entry_context to use /source_slice endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /context endpoint returns entry metadata but not the editable source. The /source_slice endpoint returns the actual source text and sha256sum needed for approving/rejecting entries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- fava_client.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fava_client.py b/fava_client.py index 5c66593..dd83699 100644 --- a/fava_client.py +++ b/fava_client.py @@ -951,18 +951,17 @@ class FavaClient: async def get_entry_context(self, entry_hash: str) -> Dict[str, Any]: """ - Get entry context including source text and sha256sum. + Get entry source text and sha256sum for editing. + + Uses /source_slice endpoint which returns the editable source. Args: entry_hash: Entry hash from get_journal_entries() Returns: { - "entry": {...}, # Serialized entry "slice": "2025-01-15 ! \"Description\"...", # Beancount source text "sha256sum": "abc123...", # For concurrency control - "balances_before": {...}, - "balances_after": {...} } Example: @@ -973,7 +972,7 @@ class FavaClient: try: async with httpx.AsyncClient(timeout=self.timeout) as client: response = await client.get( - f"{self.base_url}/context", + f"{self.base_url}/source_slice", params={"entry_hash": entry_hash} ) response.raise_for_status()