tortoise-graph 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tortoise/__init__.py +45 -0
- tortoise/__main__.py +1865 -0
- tortoise/analyze.py +473 -0
- tortoise/api.py +303 -0
- tortoise/archived/search_legacy.py +31 -0
- tortoise/audit.py +236 -0
- tortoise/audit_events.py +284 -0
- tortoise/auth.py +107 -0
- tortoise/backup.py +155 -0
- tortoise/config.py +99 -0
- tortoise/connector_loader.py +74 -0
- tortoise/connectors/__init__.py +5 -0
- tortoise/connectors/github.py +432 -0
- tortoise/connectors/github_docs.py +146 -0
- tortoise/connectors/linear.py +199 -0
- tortoise/connectors/slack.py +222 -0
- tortoise/consistency.py +132 -0
- tortoise/crypto.py +52 -0
- tortoise/deployment.py +62 -0
- tortoise/domain_loader.py +142 -0
- tortoise/dream.py +153 -0
- tortoise/embedded_reaper.py +744 -0
- tortoise/embeddings.py +227 -0
- tortoise/ep.py +534 -0
- tortoise/exceptions.py +16 -0
- tortoise/extractor.py +945 -0
- tortoise/hosted_api.py +1982 -0
- tortoise/hosted_middleware.py +22 -0
- tortoise/idempotency.py +39 -0
- tortoise/ids.py +23 -0
- tortoise/indexer/github_indexer.py +129 -0
- tortoise/ingest.py +614 -0
- tortoise/log.py +29 -0
- tortoise/m0.py +50 -0
- tortoise/mcp_auth.py +337 -0
- tortoise/mcp_client.py +108 -0
- tortoise/mcp_server.py +1356 -0
- tortoise/memory_orchestrator.py +492 -0
- tortoise/memory_scope.py +15 -0
- tortoise/migrate_db.py +244 -0
- tortoise/migrate_kinds.py +141 -0
- tortoise/mining.py +338 -0
- tortoise/models.py +109 -0
- tortoise/monitoring.py +133 -0
- tortoise/navigation.py +216 -0
- tortoise/pack_registry.py +767 -0
- tortoise/pipeline_cli.py +197 -0
- tortoise/projection/__init__.py +913 -0
- tortoise/projection/edges.py +311 -0
- tortoise/projection/entities.py +521 -0
- tortoise/projection/grounding.py +95 -0
- tortoise/projection/propagation.py +114 -0
- tortoise/projection.py +37 -0
- tortoise/quadrature.py +90 -0
- tortoise/query_suggestions.py +194 -0
- tortoise/quota.py +163 -0
- tortoise/ranking.py +280 -0
- tortoise/render.py +108 -0
- tortoise/scripts/manifest.py +67 -0
- tortoise/sdk.py +4713 -0
- tortoise/search_engine.py +887 -0
- tortoise/security.py +268 -0
- tortoise/selfhost.py +157 -0
- tortoise/selfhost_api.py +201 -0
- tortoise/session_continuity.py +82 -0
- tortoise/session_indexer.py +569 -0
- tortoise/shared_state/__init__.py +20 -0
- tortoise/shared_state/concurrency.py +113 -0
- tortoise/shared_state/event_log.py +192 -0
- tortoise/shared_state/events.py +150 -0
- tortoise/shared_state/monitoring.py +87 -0
- tortoise/shared_state/recovery.py +126 -0
- tortoise/shared_state/tests/__init__.py +15 -0
- tortoise/shared_state/tests/test_concurrency.py +123 -0
- tortoise/shared_state/tests/test_events.py +145 -0
- tortoise/shared_state/tests/test_monitoring.py +54 -0
- tortoise/shared_state/tests/test_recovery.py +181 -0
- tortoise/source_credibility.py +306 -0
- tortoise/svbp.py +446 -0
- tortoise/taxonomy.py +71 -0
- tortoise/test_cross_ontology.py +180 -0
- tortoise/test_tortoise_client.py +206 -0
- tortoise/tool_registry.py +805 -0
- tortoise/tortoise_client.py +262 -0
- tortoise/verify_ontology.py +154 -0
- tortoise/version_vector.py +97 -0
- tortoise/weights.py +61 -0
- tortoise_graph-0.2.0.dist-info/METADATA +152 -0
- tortoise_graph-0.2.0.dist-info/RECORD +93 -0
- tortoise_graph-0.2.0.dist-info/WHEEL +5 -0
- tortoise_graph-0.2.0.dist-info/entry_points.txt +4 -0
- tortoise_graph-0.2.0.dist-info/licenses/LICENSE +95 -0
- tortoise_graph-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Cross-ontology integration test — end-to-end memory cycle.
|
|
2
|
+
|
|
3
|
+
Creates test data in FalkorDB (Points + Events), queries across ontologies
|
|
4
|
+
via Memory Orchestrator, verifies merged results with provenance tags.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python3 tortoise/test_cross_ontology.py [--db tortoise.db]
|
|
8
|
+
|
|
9
|
+
S6 of Memory System V1 epic (#5199).
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
import time
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
# Ensure tortoise is importable
|
|
18
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
19
|
+
|
|
20
|
+
from tortoise.projection import FalkorProjection
|
|
21
|
+
from tortoise.memory_orchestrator import (
|
|
22
|
+
dispatch, merge, routeRead, translateNL, MergeResult
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
DB_PATH = os.path.join(tempfile.gettempdir(), "tortoise-test-s6.db")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def setup_test_data(proj: FalkorProjection) -> None:
|
|
29
|
+
"""Create test Point + Event nodes in ontology-specific graphs."""
|
|
30
|
+
ts = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
|
31
|
+
|
|
32
|
+
# ── Epistemic graph: Points ──
|
|
33
|
+
eg = proj.db.select_graph("epistemic")
|
|
34
|
+
eg.query("""
|
|
35
|
+
CREATE (:Point {
|
|
36
|
+
id: 'p-integration-1',
|
|
37
|
+
content: 'ADR-005 selected three-layer expansion pack architecture',
|
|
38
|
+
pointKind: 'decision',
|
|
39
|
+
aboutEntities: ['expansion-packs', 'ADR-005'],
|
|
40
|
+
authoredBy: 'org-design',
|
|
41
|
+
confidence: 0.92,
|
|
42
|
+
status: 'live',
|
|
43
|
+
createdAt: $ts
|
|
44
|
+
})
|
|
45
|
+
""", params={"ts": ts})
|
|
46
|
+
eg.query("""
|
|
47
|
+
CREATE (:Point {
|
|
48
|
+
id: 'p-integration-2',
|
|
49
|
+
content: 'FalkorDB deployment completed via docker-compose',
|
|
50
|
+
pointKind: 'observation',
|
|
51
|
+
aboutEntities: ['falkordb', 'infrastructure'],
|
|
52
|
+
authoredBy: 'epistemic-team',
|
|
53
|
+
confidence: 0.98,
|
|
54
|
+
status: 'live',
|
|
55
|
+
createdAt: $ts
|
|
56
|
+
})
|
|
57
|
+
""", params={"ts": ts})
|
|
58
|
+
|
|
59
|
+
# ── Episodic graph: Events ──
|
|
60
|
+
evg = proj.db.select_graph("episodic")
|
|
61
|
+
evg.query("""
|
|
62
|
+
CREATE (:Event {
|
|
63
|
+
id: 'ev-integration-1',
|
|
64
|
+
eventKind: 'decision',
|
|
65
|
+
subject: 'org-design',
|
|
66
|
+
object: 'ADR-005',
|
|
67
|
+
startedAt: $ts
|
|
68
|
+
})
|
|
69
|
+
""", params={"ts": ts})
|
|
70
|
+
evg.query("""
|
|
71
|
+
CREATE (:Event {
|
|
72
|
+
id: 'ev-integration-2',
|
|
73
|
+
eventKind: 'deployment',
|
|
74
|
+
subject: 'epistemic-team',
|
|
75
|
+
object: 'falkordb',
|
|
76
|
+
startedAt: $ts
|
|
77
|
+
})
|
|
78
|
+
""", params={"ts": ts})
|
|
79
|
+
|
|
80
|
+
print(f" Created 2 Points (epistemic graph) + 2 Events (episodic graph)")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def cleanup_test_data(proj: FalkorProjection) -> None:
|
|
84
|
+
"""Remove test nodes from both ontology graphs."""
|
|
85
|
+
for nid in ["p-integration-1", "p-integration-2"]:
|
|
86
|
+
proj.db.select_graph("epistemic").query(
|
|
87
|
+
"MATCH (n {id: $id}) DELETE n", params={"id": nid}
|
|
88
|
+
)
|
|
89
|
+
for nid in ["ev-integration-1", "ev-integration-2"]:
|
|
90
|
+
proj.db.select_graph("episodic").query(
|
|
91
|
+
"MATCH (n {id: $id}) DELETE n", params={"id": nid}
|
|
92
|
+
)
|
|
93
|
+
print(" Cleaned up test data")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_happy_path(proj: FalkorProjection) -> None:
|
|
97
|
+
"""Query across episodic + epistemic, verify merged results."""
|
|
98
|
+
patterns, _ = translateNL("what decisions about ADR-005?")
|
|
99
|
+
ontologies = routeRead(patterns)
|
|
100
|
+
assert "epistemic" in ontologies or "episodic" in ontologies, \
|
|
101
|
+
f"No ontologies matched: {ontologies}"
|
|
102
|
+
|
|
103
|
+
results, errors = dispatch(ontologies, proj.db, timeout=5.0)
|
|
104
|
+
assert not errors, f"Dispatch errors: {errors}"
|
|
105
|
+
assert results, "No results returned"
|
|
106
|
+
|
|
107
|
+
merged = merge(results, errors)
|
|
108
|
+
assert merged.mergedCount > 0, f"Merge produced 0 results: {merged}"
|
|
109
|
+
assert merged.totalByOntology, "No per-ontology counts"
|
|
110
|
+
print(f" Happy path: {merged.mergedCount} results across {len(merged.totalByOntology)} ontologies")
|
|
111
|
+
for ont, count in merged.totalByOntology.items():
|
|
112
|
+
print(f" {ont}: {count} results")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_empty_graph() -> None:
|
|
116
|
+
"""Query an empty DB — should return explicit no-results, not crash."""
|
|
117
|
+
empty_db = Path("/tmp/tortoise-empty-s6.db")
|
|
118
|
+
if empty_db.exists():
|
|
119
|
+
empty_db.unlink()
|
|
120
|
+
|
|
121
|
+
proj = FalkorProjection(str(empty_db))
|
|
122
|
+
try:
|
|
123
|
+
results, errors = dispatch(["epistemic", "episodic"], proj.db, timeout=1.0)
|
|
124
|
+
# Empty graph → no results, no errors
|
|
125
|
+
assert not errors or all("no Cypher" not in str(e) for e in errors.values()), \
|
|
126
|
+
f"Unexpected errors on empty graph: {errors}"
|
|
127
|
+
print(f" Empty graph: {sum(len(v) for v in results.values())} results (expected 0)")
|
|
128
|
+
finally:
|
|
129
|
+
empty_db.unlink(missing_ok=True)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def test_partial_failure() -> None:
|
|
133
|
+
"""One ontology fails — partial results returned, failure flagged."""
|
|
134
|
+
proj = FalkorProjection("/tmp/tortoise-partial-s6.db")
|
|
135
|
+
try:
|
|
136
|
+
# Query an ontology that doesn't exist in this empty DB
|
|
137
|
+
results, errors = dispatch(["epistemic", "nonexistent_ontology"], proj.db, timeout=2.0)
|
|
138
|
+
assert "nonexistent_ontology" in errors, \
|
|
139
|
+
f"Expected error for nonexistent ontology, got: {errors}"
|
|
140
|
+
# Epistemic should return empty (graph is empty, not error)
|
|
141
|
+
assert "epistemic" in results, f"Expected epistemic in results: {results}"
|
|
142
|
+
print(f" Partial failure: epistemic OK, nonexistent flagged as error")
|
|
143
|
+
finally:
|
|
144
|
+
Path("/tmp/tortoise-partial-s6.db").unlink(missing_ok=True)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def test_nl_translation() -> None:
|
|
148
|
+
"""NL query → patterns → ontologies."""
|
|
149
|
+
patterns, _ = translateNL("what happened last session?")
|
|
150
|
+
assert patterns, f"No patterns matched for 'what happened'"
|
|
151
|
+
ontologies = routeRead(patterns)
|
|
152
|
+
assert "episodic" in ontologies, f"Expected episodic, got: {ontologies}"
|
|
153
|
+
print(f" NL: 'what happened' → {patterns} → {ontologies}")
|
|
154
|
+
|
|
155
|
+
patterns, _ = translateNL("what do we believe about competitors?")
|
|
156
|
+
ontologies = routeRead(patterns)
|
|
157
|
+
assert "epistemic" in ontologies, f"Expected epistemic, got: {ontologies}"
|
|
158
|
+
print(f" NL: 'what do we believe' → {patterns} → {ontologies}")
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
db_path = sys.argv[2] if len(sys.argv) > 2 and sys.argv[1] == "--db" else DB_PATH
|
|
163
|
+
|
|
164
|
+
print("=== Cross-Ontology Integration Test (S6) ===")
|
|
165
|
+
proj = FalkorProjection(db_path)
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
setup_test_data(proj)
|
|
169
|
+
test_happy_path(proj)
|
|
170
|
+
test_empty_graph()
|
|
171
|
+
test_partial_failure()
|
|
172
|
+
test_nl_translation()
|
|
173
|
+
print("\nAll integration tests passed ✓")
|
|
174
|
+
finally:
|
|
175
|
+
cleanup_test_data(proj)
|
|
176
|
+
# Safety (issue #176): never unlink the canonical DB via this script
|
|
177
|
+
if os.path.realpath(db_path) == os.path.realpath(os.environ.get("TORTOISE_DB_PATH", os.path.expanduser("~/.tortoise/tortoise.db"))):
|
|
178
|
+
print("REFUSING to unlink canonical DB path", db_path)
|
|
179
|
+
raise SystemExit(2)
|
|
180
|
+
Path(db_path).unlink(missing_ok=True)
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"""Integration tests for S9 skill wiring contracts (tortoise_client.py).
|
|
2
|
+
|
|
3
|
+
Validates the §6.3 contracts:
|
|
4
|
+
- queryPriorResearch(domain) → returns claims about a domain
|
|
5
|
+
- writeStrategyPoints(points) → persists Points, queryable via queryExistingStrategies()
|
|
6
|
+
- queryExistingVisions(context) → returns vision Points
|
|
7
|
+
- End-to-end: write → query → verify data integrity
|
|
8
|
+
|
|
9
|
+
Runs with FalkorDBLite (embedded) — no Docker needed.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
import tempfile
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
# Ensure Tortoise + client are importable
|
|
19
|
+
_TORTOISE_ROOT = Path(__file__).resolve().parent
|
|
20
|
+
if str(_TORTOISE_ROOT) not in sys.path:
|
|
21
|
+
sys.path.insert(0, str(_TORTOISE_ROOT))
|
|
22
|
+
|
|
23
|
+
import tortoise_client
|
|
24
|
+
from tortoise.sdk import TortoiseSDK
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _fresh_sdk() -> TortoiseSDK:
|
|
28
|
+
"""Create a fresh temp db, wire tortoise_client to it, return SDK."""
|
|
29
|
+
db_dir = tempfile.mkdtemp(prefix="tortoise_s9_test_")
|
|
30
|
+
db_path = os.path.join(db_dir, "tortoise.db")
|
|
31
|
+
tortoise_client._TORTOISE_ROOT = Path(db_dir)
|
|
32
|
+
return TortoiseSDK(db_path)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
36
|
+
# Test: queryPriorResearch
|
|
37
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
38
|
+
|
|
39
|
+
class TestQueryPriorResearch:
|
|
40
|
+
"""§6.3: queryPriorResearch(domain) returns claims about a domain."""
|
|
41
|
+
|
|
42
|
+
def test_returns_existing_claims_by_context(self):
|
|
43
|
+
sdk = _fresh_sdk()
|
|
44
|
+
sdk.create_point("statement", "El Dato competes with OpenTable",
|
|
45
|
+
context="competitor-analysis", authoredBy="research-skill")
|
|
46
|
+
sdk.create_point("statement", "Competitor X has 20% market share",
|
|
47
|
+
context="competitor-analysis", authoredBy="research-skill")
|
|
48
|
+
sdk.create_point("statement", "Unrelated claim",
|
|
49
|
+
context="other-domain", authoredBy="other")
|
|
50
|
+
sdk.close()
|
|
51
|
+
|
|
52
|
+
results = tortoise_client.query_prior_research("competitor-analysis")
|
|
53
|
+
assert len(results) >= 2, f"Expected at least 2 results, got {len(results)}"
|
|
54
|
+
contents = {r["content"] for r in results}
|
|
55
|
+
assert "El Dato competes with OpenTable" in contents
|
|
56
|
+
assert "Competitor X has 20% market share" in contents
|
|
57
|
+
assert "Unrelated claim" not in contents
|
|
58
|
+
|
|
59
|
+
def test_returns_claims_by_kind_match(self):
|
|
60
|
+
sdk = _fresh_sdk()
|
|
61
|
+
sdk.create_point("decision", "Deploy FalkorDB in production",
|
|
62
|
+
context="memory-system", authoredBy="research-skill")
|
|
63
|
+
sdk.close()
|
|
64
|
+
|
|
65
|
+
results = tortoise_client.query_prior_research("memory-system")
|
|
66
|
+
assert len(results) >= 1
|
|
67
|
+
assert results[0]["pointKind"] == "decision"
|
|
68
|
+
|
|
69
|
+
def test_empty_when_no_match(self):
|
|
70
|
+
sdk = _fresh_sdk()
|
|
71
|
+
sdk.create_point("statement", "Something else", context="other")
|
|
72
|
+
sdk.close()
|
|
73
|
+
|
|
74
|
+
results = tortoise_client.query_prior_research("nonexistent-domain")
|
|
75
|
+
assert results == []
|
|
76
|
+
|
|
77
|
+
def test_dedup_by_id(self):
|
|
78
|
+
"""If same Point matches both context and kind, only count once."""
|
|
79
|
+
sdk = _fresh_sdk()
|
|
80
|
+
sdk.create_point("observation", "Double-matched claim",
|
|
81
|
+
context="shared-domain", authoredBy="test")
|
|
82
|
+
sdk.close()
|
|
83
|
+
|
|
84
|
+
results = tortoise_client.query_prior_research("shared-domain")
|
|
85
|
+
ids = [r["id"] for r in results]
|
|
86
|
+
assert len(ids) == len(set(ids)), f"Duplicate IDs found: {ids}"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
90
|
+
# Test: writeStrategyPoints + queryExistingStrategies
|
|
91
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
92
|
+
|
|
93
|
+
class TestStrategyPoints:
|
|
94
|
+
"""§6.3: writeStrategyPoints → persisted → queryExistingStrategies."""
|
|
95
|
+
|
|
96
|
+
def test_write_and_query(self):
|
|
97
|
+
_fresh_sdk() # wire tortoise_client to fresh db
|
|
98
|
+
|
|
99
|
+
points = [
|
|
100
|
+
{"content": "Focus on B2B carousel pipeline in Q3",
|
|
101
|
+
"context": "content-strategy", "authoredBy": "define-strategy-skill",
|
|
102
|
+
"confidence": 0.8},
|
|
103
|
+
{"content": "Defer mobile app until Q4",
|
|
104
|
+
"context": "content-strategy", "authoredBy": "define-strategy-skill",
|
|
105
|
+
"confidence": 0.9},
|
|
106
|
+
]
|
|
107
|
+
created = tortoise_client.write_strategy_points(points)
|
|
108
|
+
assert len(created) == 2
|
|
109
|
+
for c in created:
|
|
110
|
+
assert c["pointKind"] == "strategy"
|
|
111
|
+
assert "id" in c
|
|
112
|
+
assert c["context"] == "content-strategy"
|
|
113
|
+
|
|
114
|
+
results = tortoise_client.query_existing_strategies()
|
|
115
|
+
assert len(results) >= 2
|
|
116
|
+
contents = {r["content"] for r in results}
|
|
117
|
+
assert "Focus on B2B carousel pipeline in Q3" in contents
|
|
118
|
+
assert "Defer mobile app until Q4" in contents
|
|
119
|
+
|
|
120
|
+
def test_empty_strategies_on_fresh_db(self):
|
|
121
|
+
_fresh_sdk() # fresh db with no data
|
|
122
|
+
|
|
123
|
+
results = tortoise_client.query_existing_strategies()
|
|
124
|
+
assert results == []
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
128
|
+
# Test: Vision queries
|
|
129
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
130
|
+
|
|
131
|
+
class TestVisionPoints:
|
|
132
|
+
"""Vision Point query/write from the skill wiring contracts."""
|
|
133
|
+
|
|
134
|
+
def test_write_vision_via_client(self):
|
|
135
|
+
"""P0 regression: write_strategy_points(kind='vision') creates vision Points."""
|
|
136
|
+
_fresh_sdk()
|
|
137
|
+
created = tortoise_client.write_strategy_points(
|
|
138
|
+
[{"content": "Vision written via client", "context": "test-vision"}],
|
|
139
|
+
kind="vision",
|
|
140
|
+
)
|
|
141
|
+
assert len(created) == 1
|
|
142
|
+
assert created[0]["pointKind"] == "vision"
|
|
143
|
+
|
|
144
|
+
# Should appear in vision query, NOT in strategy query
|
|
145
|
+
visions = tortoise_client.query_existing_visions()
|
|
146
|
+
assert any(p["content"] == "Vision written via client" for p in visions)
|
|
147
|
+
|
|
148
|
+
strategies = tortoise_client.query_existing_strategies()
|
|
149
|
+
assert not any(p["content"] == "Vision written via client" for p in strategies)
|
|
150
|
+
|
|
151
|
+
def test_query_visions_by_context(self):
|
|
152
|
+
sdk = _fresh_sdk()
|
|
153
|
+
sdk.create_point("vision", "El Dato will be the OS for restaurant discovery",
|
|
154
|
+
context="product-strategy", authoredBy="define-vision-skill",
|
|
155
|
+
confidence=0.6)
|
|
156
|
+
sdk.create_point("statement", "Not a vision", context="product-strategy")
|
|
157
|
+
sdk.close()
|
|
158
|
+
|
|
159
|
+
results = tortoise_client.query_existing_visions(context="product-strategy")
|
|
160
|
+
assert len(results) == 1
|
|
161
|
+
assert results[0]["pointKind"] == "vision"
|
|
162
|
+
assert "OS for restaurant discovery" in results[0]["content"]
|
|
163
|
+
|
|
164
|
+
def test_query_visions_all(self):
|
|
165
|
+
sdk = _fresh_sdk()
|
|
166
|
+
sdk.create_point("vision", "Vision A", context="domain-a")
|
|
167
|
+
sdk.create_point("vision", "Vision B", context="domain-b")
|
|
168
|
+
sdk.close()
|
|
169
|
+
|
|
170
|
+
results = tortoise_client.query_existing_visions()
|
|
171
|
+
assert len(results) >= 2
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
175
|
+
# Test: write_claim (generic single-claim writer)
|
|
176
|
+
# ══════════════════════════════════════════════════════════════════════
|
|
177
|
+
|
|
178
|
+
class TestWriteClaim:
|
|
179
|
+
"""Generic write_claim function used by research skill."""
|
|
180
|
+
|
|
181
|
+
def test_write_and_retrieve(self):
|
|
182
|
+
_fresh_sdk()
|
|
183
|
+
|
|
184
|
+
result = tortoise_client.write_claim(
|
|
185
|
+
"El Dato has 5 active competitors", kind="statement",
|
|
186
|
+
context="competitor-analysis", authored_by="research-skill",
|
|
187
|
+
confidence=0.8,
|
|
188
|
+
)
|
|
189
|
+
assert result["id"]
|
|
190
|
+
assert result["pointKind"] == "statement"
|
|
191
|
+
assert result["content"] == "El Dato has 5 active competitors"
|
|
192
|
+
|
|
193
|
+
results = tortoise_client.query_prior_research("competitor-analysis")
|
|
194
|
+
assert len(results) >= 1
|
|
195
|
+
assert results[0]["content"] == "El Dato has 5 active competitors"
|
|
196
|
+
|
|
197
|
+
def test_write_hypothesis_with_low_confidence(self):
|
|
198
|
+
_fresh_sdk()
|
|
199
|
+
|
|
200
|
+
result = tortoise_client.write_claim(
|
|
201
|
+
"Competitors may launch similar feature in Q3", kind="hypothesis",
|
|
202
|
+
context="product-strategy", authored_by="research-skill",
|
|
203
|
+
confidence=0.2,
|
|
204
|
+
)
|
|
205
|
+
assert result["pointKind"] == "hypothesis"
|
|
206
|
+
assert result["confidence"] == 0.2
|