Commit 7ff67e5
authored
Docs/fix chatbot cms documentation (#582)
* Fix documentation inaccuracies and clean up dev dependencies
- chatbot-system.md: correct state namespaces (system/user/context/temp),
replace JSON Logic with CEL syntax, fix sync execution model description,
fix processor hierarchy, add /v1 prefix to endpoints, update schema
- cms.md: remove fictional webhook registration endpoints, add missing
schema fields (school_id, visibility, search_document), condense stale
Landbot migration references
- architecture-service-layer.md: refactor from 2294 to 287 lines,
separate current implementation from aspirational design, verify all
service and repository inventories against code
- pyproject.toml: add psutil to dev deps, remove unused playwright/
pytest-playwright
* Deduplicate docs, add unit tests, and create design notes
Documentation:
- CLAUDE.md: deduplicate with README (216 to 108 lines), keep AI-specific
instructions, reference README for shared content
- README.md: absorb unique content from CLAUDE.md, add LOCAL_BUILD_ONLY
flag, document @pytest.mark.isolated, reference setup-test-env.sh
- docs/cms.md: annotate analytics endpoints as real SQL vs placeholder,
trim verbose response examples (-313 lines)
- docs/design-session-replay.md: refactor from 886 to 104 lines, verify
all components against code, remove pseudo-code for implemented features
- docs/testing-credentials.md: consolidate on seed script as primary
approach, fix OpenAPI URLs (/docs to /v1/docs), fix absolute paths
- docs/architecture-roadmap.md: new file preserving design thinking cut
from architecture refactor (UoW, CQRS, migration strategy, events)
- docs/analytics-design-note.md: new design note categorizing 21 analytics
endpoints (8 real SQL, 5 hardcoded fake, 4 deferred, 5 no backend)
Tests:
- app/tests/unit/test_cms_workflow.py: 66 new unit tests covering publish,
bulk ops, validation, variants, content lifecycle
- app/tests/unit/test_chatbot_integrations.py: 49 new unit tests covering
helper functions and Pydantic models
* Remove legacy setup_test_environment.py and its documentation
The seed script (scripts/seed_admin_ui_data.py) is the canonical test
data setup. The legacy Playwright-focused script created a different
school with fewer roles and is no longer needed.
* Restructure Huey Bookbot flow into composite sub-flows with bug fixes
Split the flat 24-node flow into a hierarchical architecture using
CompositeNodeProcessor: main flow (10 nodes) orchestrates three sub-flows
for profile collection, preference discovery, and book recommendation.
Bug fixes:
- Strip unresolved {{...}} templates to None in API call bodies to prevent
Pydantic validation errors (e.g. Optional[UUID] rejecting literal strings)
- Use fallback_response when internal API handlers fail
- Preserve session_flow_id across sub-flow transitions (was resetting to None)
- Handle dict question results from composite nodes in parent flow return
- Extract messages correctly from sub-flow return results
- Refresh flow_stack from session after composite processing to catch new entries
- Build input_request and persist options for questions in parent flow return
* Address code review: fix template stripping, sub_flow_id bug, add tests
Fixes from code review:
- Use regex for _strip_unresolved_templates instead of naive string check,
add debug logging when stripping occurs
- Apply template stripping to query_params (was only on body)
- Use exc_info=True for structured exception logging in fallback handler
- Fix sub_flow_id sourcing: track source_result through the processing
loop so dict questions get flow_id from the correct result
- Extract _to_uuid helper to deduplicate UUID conversion (3 call sites)
Tests (30 new, 443 total):
- test_action_processor: _strip_unresolved_templates edge cases (12 tests),
fallback_response mechanism (3 tests)
- test_chat_runtime_subflow: _to_uuid (4), sanitize_user_input (4),
_try_return_to_parent_flow logic paths (7) including message extraction,
question node resolution, dict question flow_id, and source_result tracking
* Fix unused variable lint error in exception handler1 parent f861fce commit 7ff67e5
File tree
12 files changed
+1489
-21
lines changed- app
- services
- tests/unit
- scripts
- fixtures
12 files changed
+1489
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
32 | 52 | | |
33 | 53 | | |
34 | 54 | | |
| |||
319 | 339 | | |
320 | 340 | | |
321 | 341 | | |
| 342 | + | |
322 | 343 | | |
323 | 344 | | |
324 | 345 | | |
| 346 | + | |
325 | 347 | | |
326 | | - | |
327 | | - | |
328 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
329 | 363 | | |
330 | 364 | | |
331 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
1212 | 1219 | | |
1213 | 1220 | | |
1214 | 1221 | | |
1215 | | - | |
| 1222 | + | |
1216 | 1223 | | |
1217 | 1224 | | |
1218 | 1225 | | |
| |||
1230 | 1237 | | |
1231 | 1238 | | |
1232 | 1239 | | |
1233 | | - | |
| 1240 | + | |
1234 | 1241 | | |
1235 | 1242 | | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
1236 | 1247 | | |
1237 | 1248 | | |
1238 | 1249 | | |
| |||
1255 | 1266 | | |
1256 | 1267 | | |
1257 | 1268 | | |
1258 | | - | |
| 1269 | + | |
1259 | 1270 | | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
| 1271 | + | |
1265 | 1272 | | |
1266 | 1273 | | |
1267 | 1274 | | |
| |||
1644 | 1651 | | |
1645 | 1652 | | |
1646 | 1653 | | |
| 1654 | + | |
1647 | 1655 | | |
1648 | | - | |
| 1656 | + | |
1649 | 1657 | | |
1650 | 1658 | | |
1651 | 1659 | | |
1652 | | - | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
1653 | 1663 | | |
| 1664 | + | |
1654 | 1665 | | |
1655 | 1666 | | |
1656 | 1667 | | |
1657 | | - | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
1658 | 1676 | | |
1659 | 1677 | | |
1660 | 1678 | | |
1661 | | - | |
| 1679 | + | |
1662 | 1680 | | |
1663 | 1681 | | |
1664 | 1682 | | |
| |||
1675 | 1693 | | |
1676 | 1694 | | |
1677 | 1695 | | |
| 1696 | + | |
1678 | 1697 | | |
1679 | 1698 | | |
1680 | 1699 | | |
1681 | 1700 | | |
1682 | 1701 | | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
1683 | 1724 | | |
1684 | 1725 | | |
1685 | 1726 | | |
1686 | 1727 | | |
1687 | 1728 | | |
1688 | 1729 | | |
1689 | | - | |
1690 | | - | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1691 | 1736 | | |
1692 | 1737 | | |
1693 | 1738 | | |
| |||
0 commit comments