personal memory agent
1# SPDX-License-Identifier: AGPL-3.0-only
2# Copyright (c) 2026 sol pbc
3
4import json
5from pathlib import Path
6
7from jsonschema import Draft202012Validator
8
9from solstone.think.talent import get_talent
10
11TALENT_DIR = Path(__file__).resolve().parents[1] / "solstone" / "talent"
12PARTICIPATION_ENTRY_SCHEMA_PATH = TALENT_DIR / "participation_entry.schema.json"
13PARTICIPATION_SCHEMA_PATH = TALENT_DIR / "participation.schema.json"
14
15
16def _load_json(path: Path) -> dict:
17 return json.loads(path.read_text(encoding="utf-8"))
18
19
20def test_participation_entry_schema_is_valid_draft_2020_12():
21 schema = _load_json(PARTICIPATION_ENTRY_SCHEMA_PATH)
22
23 Draft202012Validator.check_schema(schema)
24
25
26def test_participation_schema_is_valid_and_matches_loaded():
27 schema = _load_json(PARTICIPATION_SCHEMA_PATH)
28
29 Draft202012Validator.check_schema(schema)
30
31 assert get_talent("participation")["json_schema"] == schema
32
33
34def test_participation_schema_items_match_fragment():
35 schema = _load_json(PARTICIPATION_SCHEMA_PATH)
36 fragment = _load_json(PARTICIPATION_ENTRY_SCHEMA_PATH)
37
38 items = dict(schema["properties"]["participation"]["items"])
39 fragment_without_schema = dict(fragment)
40
41 assert items == fragment_without_schema