Skip to content

Docs/fix chatbot cms documentation#582

Merged
hardbyte merged 7 commits intomainfrom
docs/fix-chatbot-cms-documentation
Feb 8, 2026
Merged

Docs/fix chatbot cms documentation#582
hardbyte merged 7 commits intomainfrom
docs/fix-chatbot-cms-documentation

Conversation

@hardbyte
Copy link
Owner

@hardbyte hardbyte commented Feb 8, 2026

No description provided.

- 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
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
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.
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
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Wriveted’s CMS/chatflow documentation and seed fixtures, while also making runtime and seeding changes to better support composite sub-flows (Huey Bookbot) and adding unit test coverage for key CMS/chatbot helpers.

Changes:

  • Add Huey Bookbot + sub-flow JSON fixtures (profile, preferences, recommendation) and extend seeding to resolve composite sub-flow references by seed_key.
  • Update chat runtime + action processor behavior (sub-flow context persistence, message handling, internal handler fallback/logging behavior).
  • Add multiple documentation updates/new docs, add unit tests, and update dev dependencies (remove Playwright-related deps, add psutil).

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/seed_admin_ui_data.py Adds composite sub-flow reference resolution after seeding flows; switches missing flow-file warning to stdout.
scripts/fixtures/huey-recommendation-flow.json New recommendation sub-flow fixture used by composite nodes.
scripts/fixtures/huey-profile-flow.json New user profiling sub-flow fixture (age + reading ability).
scripts/fixtures/huey-preferences-flow.json New preferences sub-flow fixture (random preference questions + hue aggregation).
scripts/fixtures/huey-bookbot-flow.json New top-level composite flow referencing the three sub-flows via composite_flow_seed_key.
scripts/fixtures/admin-ui-seed.json Adds new preference questions + includes the new flow fixture files in seed config.
pyproject.toml Dependency changes (remove Playwright-related deps, add psutil).
poetry.lock Lockfile updates reflecting dependency changes.
docs/testing-credentials.md New guide for seeding/auth token setup and local env vars.
docs/design-session-replay.md Large rewrite to reflect current tracing implementation status and locations.
docs/cms.md Documentation corrections/clarifications (schema notes, analytics notes, migration history).
docs/chatbot-system.md Updates execution model docs (sync runtime), schemas, endpoint paths, and remaining work list.
docs/architecture-service-layer.md New document describing implemented service/repo/event architecture.
docs/architecture-roadmap.md New roadmap doc outlining planned architecture evolution.
docs/analytics-design-note.md New design note classifying analytics endpoints by “real vs simulated” and recommendations.
app/tests/unit/test_cms_workflow.py Adds unit tests for CMSWorkflowService workflows and helpers.
app/tests/unit/test_chatbot_integrations.py Adds unit tests for chatbot integration helpers and Pydantic models.
app/services/chat_runtime.py Adjusts session flow context + question option persistence, and sub-flow return handling.
app/services/action_processor.py Adds stripping of unresolved templates and internal-handler fallback behavior.
README.md Adds “running without Docker”, admin permission setup, and expanded test instructions.
CLAUDE.md Refactors contributor guidance and command reference.
.gitignore Allows committing scripts/fixtures/*.json despite global *.json ignore.
Comments suppressed due to low confidence (1)

app/tests/unit/test_cms_workflow.py:284

  • Variable result is not used.
        result = await self.service.publish_flow_with_validation(

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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
@hardbyte hardbyte merged commit 7ff67e5 into main Feb 8, 2026
11 checks passed
@hardbyte hardbyte deleted the docs/fix-chatbot-cms-documentation branch February 8, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants