-
Notifications
You must be signed in to change notification settings - Fork 0
feat: show ThreadWeave conversations fail-closed (v0.81.0) #219
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # 0.81.0 — Fail-closed ThreadWeave conversations | ||
|
|
||
| ## Added | ||
|
|
||
| - Home Conversations panel threads visible posts through | ||
| `ThreadWeaveClient`. After login with the port disabled or the | ||
| library missing, Demo Analyst sees **Conversations · ThreadWeave not | ||
| available**. An accepted tree lists the root title; click opens that | ||
| post. A hidden parent is omitted. Never invent a parent. |
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,34 @@ | ||
| """Load visible posts + visible-only lineage edges as ThreadWeave messages. | ||
|
|
||
| A hidden parent is omitted from ``references`` so the visible child | ||
| becomes a JWZ root. This module never invents a parent id. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Any, Callable, Mapping | ||
|
|
||
| from lineageweave.threadweave_client import conversation_messages_from_rows | ||
|
|
||
| if TYPE_CHECKING: | ||
| import asyncpg | ||
|
|
||
| __all__ = [ | ||
| "conversation_messages_from_rows", | ||
| "load_visible_conversation_messages", | ||
| ] | ||
|
|
||
|
|
||
| async def load_visible_conversation_messages( | ||
| conn: "asyncpg.Connection", | ||
| can_see_post: Callable[[Mapping[str, Any]], bool], | ||
| ) -> list[dict[str, Any]]: | ||
| """Read ``source_post`` / ``post_lineage_edge`` and drop hidden parents.""" | ||
| posts = await conn.fetch( | ||
| "select post_id, post_title, visibility_code, corporate_entity_id " | ||
| "from source_post" | ||
| ) | ||
| edges = await conn.fetch( | ||
| "select parent_post_id, child_post_id from post_lineage_edge" | ||
| ) | ||
| return conversation_messages_from_rows(posts, edges, can_see_post) |
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,55 @@ | ||
| # ADR 0021 — Fail-closed ThreadWeave conversation port | ||
|
|
||
| **Decision status:** Accepted | ||
| **Date:** 2026-08-17 | ||
|
|
||
| ## Context | ||
|
|
||
| LineageWeave already calls ThreadWeave inside `reconstruct.py` to | ||
| assemble RankWeave parent choices into trees. Demo Analyst had no | ||
| buyer-facing Conversations surface over those persisted edges. | ||
| ThreadWeave is an in-process library | ||
| ([API contract](https://github.com/ContextualWisdomLab/ThreadWeave/blob/main/docs/API_CONTRACT.md)): | ||
| it does not define HTTP, a mailbox host, or authentication. A missing | ||
| package, a disabled port, or a JWZ dummy for a hidden parent must not | ||
| become an invented conversation. | ||
|
|
||
| This ADR does not replace `reconstruct.py`, does not read naruon | ||
| tables, and does not bind the demo IdP to production Keyverse. ADR | ||
| 0020 already reserved later mapping of mailbox threads onto lineage | ||
| posts; this slice threads *visible* `source_post` rows only. | ||
|
|
||
| ## Decision | ||
|
|
||
| 1. Consume ThreadWeave only through `ThreadWeaveClient`. The default | ||
| transport raises `ThreadWeaveNotAvailable`. `build_threadweave_client | ||
| (disabled=False)` uses `LibraryThreadWeaveTransport`, which imports | ||
| `thread_messages` inside the call so a missing package fail-closes. | ||
| 2. `GET /api/conversations` (`post_read`) loads ABAC-visible posts and | ||
| visible-only `post_lineage_edge` rows as JWZ `references`. A hidden | ||
| parent is omitted; the child becomes a root. Never invent a parent. | ||
| 3. Dummy JWZ containers (referenced-but-missing ids) lift their | ||
| children instead of projecting an untitled parent. | ||
| 4. After login, Conversations sits above Calendar. Unavailable copy is | ||
| **Conversations · ThreadWeave not available**. An accepted tree | ||
| lists the root title; click opens that `source_post`. | ||
|
|
||
| ## Consequences | ||
|
|
||
| `THREADWEAVE_DISABLED=1` keeps the fail-closed transport. The default | ||
| seeded stack uses the in-process library and lists the designed A-100 | ||
| fork when those posts are visible. Mailbox stays on ADR 0020 / #217. | ||
| Leftover pairs stay on #211. TEPP stays on #214. | ||
|
|
||
| ## References | ||
|
|
||
| Crispin, M., & Murchison, K. (2008). *Internet Message Access Protocol | ||
| — SORT and THREAD extensions* (RFC 5256). IETF. | ||
| https://doi.org/10.17487/RFC5256 | ||
|
|
||
| Zawinski, J. (2002). *Message threading* [Technical note]. | ||
| https://www.jwz.org/doc/threading.html | ||
|
|
||
| Contextual Wisdom Lab. (2026). *ThreadWeave public API and version | ||
| contract* [Software documentation]. | ||
| https://github.com/ContextualWisdomLab/ThreadWeave/blob/main/docs/API_CONTRACT.md |
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
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.
Uh oh!
There was an error while loading. Please reload this page.