Skip to content

Expose collection freshness in school bot endpoint#591

Merged
hardbyte merged 4 commits intomainfrom
feat/jokes-spelling-stale-collection
Feb 24, 2026
Merged

Expose collection freshness in school bot endpoint#591
hardbyte merged 4 commits intomainfrom
feat/jokes-spelling-stale-collection

Conversation

@hardbyte
Copy link
Copy Markdown
Owner

@hardbyte hardbyte commented Feb 24, 2026

Summary

  • Adds collection_updated_at (ISO datetime or null) and collection_book_count (int) to the /v1/school/{id}/bot response
  • Enables the chatflow to detect stale school collections (e.g. >3 years old) and show a message prompting the librarian to upload a fresh CSV
  • No breaking changes — two new optional fields added to existing response

Context

The Huey Bookbot chatflow needs to warn schools when their book collection data is outdated, so recommendations are based on current stock. The collection_updated_at field lets the flow's condition nodes check staleness.

The experiments field already contains "no-jokes": false per-school, which will be used to gate the upcoming joke sub-flow.

Test plan

  • Unit tests pass (443 passed)
  • Lint clean (ruff check)
  • Integration test: verify /v1/school/{id}/bot returns new fields for schools with/without collections

Add collection_updated_at and collection_book_count to the
/v1/school/{id}/bot response. The chatflow uses this to warn
schools with stale (>3 years old) collection data.
Copy link
Copy Markdown
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 pull request adds collection freshness tracking to the school bot endpoint to help detect stale book collections in the Huey Bookbot chatflow. The endpoint now returns collection_updated_at (ISO datetime or null) and collection_book_count (int) to enable the chatflow to prompt librarians when their book collection data is more than 3 years old.

Changes:

  • Modified /v1/school/{id}/bot endpoint to include collection metadata (updated_at, book_count)
  • Added conditional logic to return collection info when present, null/0 when absent
  • No breaking changes - two new optional fields added to existing response

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

hardbyte and others added 3 commits February 25, 2026 06:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add Huey Jokes sub-flow with randomized precursor/bridge messages
  using new random_choice() CEL function
- Add Huey Spelling sub-flow with 3-round pick-the-correct-spelling
  game, difficulty matched to reading ability
- Add CMS content loaders for jokes (from CSV) and spelling questions
- Fix composite sub-flows not blocking on questions when entered via
  condition auto-chain (questions were dumped as messages instead of
  pausing for user input)
- Add days_since() CEL function for date comparisons
- Update Huey Bookbot flow to v3.0.0 with jokes, spelling composites
  and stale collection warning
- Make /school/{id}/bot endpoint public (no auth required)
- Fix KeyError on missing experiments key in school info
Use <strong> tags on the correct word in spelling wrong-answer messages
so frontends that support rich_text rendering show it emphasized.
@hardbyte hardbyte merged commit 1824488 into main Feb 24, 2026
11 checks passed
@hardbyte hardbyte deleted the feat/jokes-spelling-stale-collection branch February 24, 2026 19:03
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