Release v0.6.2#162
Conversation
* feat: add NEMAR community assistant for dataset discovery Add new NEMAR assistant that helps researchers find and explore BIDS-formatted EEG/MEG/iEEG datasets from nemar.org via its public API. Includes search/filter tool and detail retrieval tool with client-side filtering (API has no server-side search). Also adds .context/nemar-api.md for future API reference. * test: add tests for NEMAR tools against live API Tests cover: helper functions (_parse_sep_field, _matches), API fetch, search with various filters, dataset detail retrieval, edge cases (nonexistent datasets, no results). 93% coverage on tools.py. All tests use real NEMAR API, no mocks. * fix: address PR review findings for NEMAR tools - Add 5-minute TTL cache for _fetch_all_datasets() to avoid hitting API on every search call - Move response parsing inside try/except in get_nemar_dataset_details - Add dataset_id input validation (ds + 4-6 digits) - Handle JSONDecodeError, non-numeric keys defensively - Log warning on empty API response instead of silent return - Narrow generic Exception catches; don't leak internals to users - Fix system prompt: "descriptions" -> actual searched fields - Fix docstring: "sorted by dataset ID" -> "in API response order" - Add tests for validation, caching (45 tests, all pass) * fix: address minor comment review findings - Fix "one-line" docstring on multi-line _format_summary - Clarify has_hed parameter behavior (None has no effect) - Remove -k (insecure) from curl examples in API docs * feat: add NEMAR to demo page, mark BIDS as active - Add NEMAR community card with widget config and suggested questions - Change BIDS status from 'soon' to 'active' (backend already available) - Update README to list all 4 active communities * fix: make knowledge tools test config-aware The test assumed all communities have github and citations sections, which generates discussions/recent/papers tools. NEMAR is a data portal with custom tools instead. Test now checks config to determine which auto-generated tools to expect.
Prevents non-fast-forward push failures when develop advances between checkout and push (race with other workflows).
* fix: boost exact symbol_name matches in docstring search When searching docstrings, exact symbol_name and file basename matches now rank above BM25 results. This fixes the erpimage function being buried at rank 10 due to BM25 term frequency dilution from its large docstring. Closes #141 * refactor: use FTS5 bm25() column weights + exact match promotion Replace Python-only post-processing with FTS5 bm25() column weights (10x for symbol_name) combined with exact match promotion. Remove _sort_key from SearchResult dataclass and _docstring_sort_key helper. Add integration test reproducing the erpimage ranking bug from #141. Guard against None values from database rows.
* feat: move widget config to YAML, add per-page instructions - Add WidgetConfig model to CommunityConfig schema with title, initial_message, placeholder, and suggested_questions fields - Add widget sections to all community YAML configs (hed, bids, eeglab, nemar) migrated from hardcoded frontend values - Create GET /communities endpoint returning community metadata with widget config for frontend consumption - Add widget_instructions field to PageContext for per-page customization (sent alongside page URL/title to backend) - Update frontend demo page to fetch communities from API instead of hardcoding; setConfig() still works for overrides - Add tests for WidgetConfig validation and /communities endpoint Closes #152, closes #158 * fix: address PR review findings (XSS, prompt injection, error handling) - Fix XSS: use DOM API instead of innerHTML for error display - Add prompt injection guardrails for widget_instructions in system prompt - Add error handling with logging in /communities endpoint - Validate API response is array in frontend fetch - Filter empty string widgetInstructions in widget JS - Add tests for widget_instructions in API model and system prompt * refactor: harden WidgetConfig with validation, frozen, and resolve() - Add field validators: normalize empty strings to None, strip whitespace - Add max_length constraints on title (100), initial_message (1000), placeholder (200) - Validate suggested_questions: filter empties, cap at 10 entries - Make WidgetConfig frozen (immutable after construction) - Add resolve() method to consolidate defaulting logic - Simplify /communities endpoint using resolve() - Add 12 new tests for validation, immutability, and resolve() * fix: make demo page embed examples dynamic from API - Embed snippet on landing page now shows actual community IDs from API - Configuration options list populated dynamically - Added widgetInstructions to config options documentation - Community-specific page shows widgetInstructions example in embed snippet * fix: remove defensive try/except, simplify template literals - Remove bare except in /communities; these are validated Pydantic models so serialization failures are code bugs, not transient errors - Simplify dense template literal in embed example with pre-computed vars - Remove unused logger import
Release PR #162 Review SummaryRan 3 specialized review agents (code reviewer, silent failure hunter, test coverage analyzer) against the full develop->main diff (64 files, +9098/-617 lines). CRITICAL (must fix before merge)
IMPORTANT (should fix)
SUGGESTIONS (nice to have)
What's Good
|
- Add /communities route to worker (was returning 404, breaking demo page) - Add except HTTPException: raise in ask endpoint (was converting 403s to 500s) - Return generic error in worker top-level catch (was exposing error.message) - Add JSON parse error handling in worker endpoints (return 400 not 500) - Add NEMAR to worker root endpoint community list - Add /communities to worker endpoint documentation
Review Fixes Applied (commit b91a555)All 4 critical and 1 important issue addressed:
All 1352 tests pass, lint clean. |
🚀 Preview Deployment
This preview will be updated automatically when you push new commits. |
Summary
Release v0.6.2 from develop to main.
Changes since v0.6.1
feat: move widget config to YAML, add per-page instructions (feat: move widget config to YAML, add per-page instructions #161, closes Move widget suggested questions to community YAML config #152, [FEATURE] More options for configuration of the widget #158)
WidgetConfigmodel with validation (frozen, string normalization, max lengths, question filtering)/communitiesAPI endpoint exposing community metadata with widget configwidgetInstructionsviasetConfig()for page-specific assistant behaviorfix: boost exact symbol_name matches in docstring search (fix: boost exact symbol_name matches in docstring search #160)
feat: add NEMAR community assistant for dataset discovery (feat: add NEMAR community assistant for dataset discovery #159)
feat: add BIDS community assistant (Phase 1) (feat: add BIDS community assistant (Phase 1) #151)
feat: community dashboard (Community Dashboard: metrics, auth, budget alerting #148, Phase 4: Auth, quality metrics, cost/budget alerting #147, Phase 3: Serve dashboard from /osa/ base path #143, Phase 2: Dashboard frontend with public metrics and community tabs #140, feat: backend metrics collection and request logging #138)
feat: number-based lookup and switch to Claude Haiku 4.5 (feat: number-based lookup and switch to Claude Haiku 4.5 #154)
fix: hybrid rate limiting (Implement hybrid rate limiting: built-in API + KV #130)
Various bug fixes, CI improvements, and CORS sync updates
Test plan