Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8fe9da3
fix: update test mocks for create_openrouter_llm import location
neuromechanist Jan 29, 2026
ad3d252
Implement hybrid rate limiting: built-in API + KV (#130)
neuromechanist Jan 29, 2026
02c1dbe
Fix CI: fetch full history for git diff to work
neuromechanist Jan 29, 2026
3c2a37d
CI: run lint and tests on all PRs
neuromechanist Feb 2, 2026
bf26109
CI: run lint and tests on all PRs
neuromechanist Feb 2, 2026
6c9ef5d
Disable broken URL test until upstream fix
neuromechanist Feb 2, 2026
062293c
Disable broken URL test until upstream fix
neuromechanist Feb 2, 2026
652ba1d
feat: backend metrics collection and request logging (#138)
neuromechanist Feb 2, 2026
85bc5f3
Add backend database inspection docs to CLAUDE.md
neuromechanist Feb 3, 2026
0253e54
Phase 2: Dashboard frontend with public metrics and community tabs (#…
neuromechanist Feb 3, 2026
94bf3bb
Phase 3: Serve dashboard from /osa/ base path (#143)
neuromechanist Feb 3, 2026
fb3fcf7
Phase 4: Auth, quality metrics, cost/budget alerting (#147)
neuromechanist Feb 3, 2026
e69f38f
Address PR #148 review findings
neuromechanist Feb 4, 2026
1a342e1
Merge branch 'develop' into feature/issue-132-epic-community-dashboard
neuromechanist Feb 4, 2026
af48f4b
Merge pull request #148 from OpenScience-Collective/feature/issue-132…
neuromechanist Feb 4, 2026
4bcc07a
docs: add community development pointers to CLAUDE.md and generalize …
neuromechanist Feb 4, 2026
cf66a4d
feat: add BIDS community assistant (Phase 1) (#151)
neuromechanist Feb 4, 2026
00bc18f
chore: sync worker CORS from community configs [skip ci]
github-actions[bot] Feb 4, 2026
0f50128
ci: add workflow_dispatch trigger to CORS sync workflow
neuromechanist Feb 4, 2026
a0b7e12
fix: update BIDS suggested question to Common Principles
neuromechanist Feb 5, 2026
0d25a2b
fix: add PR/issue number lookup patterns to BIDS system prompt
neuromechanist Feb 5, 2026
b305ab2
feat: number-based lookup and switch to Claude Haiku 4.5 (#154)
neuromechanist Feb 5, 2026
b41995f
fix: dashboard CORS origin, worker routes, and API auto-detect (#155)
neuromechanist Feb 5, 2026
09f651a
chore: sync worker CORS from community configs [skip ci]
github-actions[bot] Feb 5, 2026
006a130
bump: 0.5.5.dev0 -> 0.6.0.dev0 for dashboard release
neuromechanist Feb 5, 2026
0c32dfa
merge: resolve version.py conflict (keep 0.6.0.dev0)
neuromechanist Feb 5, 2026
11de1b6
fix: apply worker security hardening lost in squash merge
neuromechanist Feb 5, 2026
2b1fe72
chore: sync worker CORS from community configs [skip ci]
github-actions[bot] Feb 5, 2026
0fd17a4
fix: dashboard total counts all requests, missing communities
neuromechanist Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 48 additions & 224 deletions .context/local-testing-guide.md
Original file line number Diff line number Diff line change
@@ -1,257 +1,81 @@
# Local Testing Guide for EEGLAB Assistant
# Local Testing Guide for Community Assistants

## Quick Test (Verify Configuration)
Quick reference for testing any community assistant locally. For the full guide, see https://docs.osc.earth/osa/registry/local-testing/

```bash
cd /Users/yahya/Documents/git/osa-phase1
## Quick Validation

# Run quick verification
uv run python test_eeglab_interactive.py
```bash
# Validate config loads
uv run pytest tests/test_core/ -k "community" -v

# Or programmatically
uv run python -c "
from pathlib import Path
from src.core.config.community import CommunityConfig
config = CommunityConfig.from_yaml(Path('src/assistants/COMMUNITY_ID/config.yaml'))
print(f'Loaded: {config.name} with {len(config.documentation)} docs')
"
```

## Full Backend Testing

### 1. Set Environment Variables
## Environment Variables

```bash
# Required: OpenRouter API key for LLM
export OPENROUTER_API_KEY="your-key-here"

# Optional: API keys for admin functions (sync)
# Optional: for sync operations
export API_KEYS="test-key-123"

# Optional: Specific EEGLAB key (if community has BYOK)
# export OPENROUTER_API_KEY_EEGLAB="eeglab-specific-key"
# Optional: community-specific key
# export OPENROUTER_API_KEY_COMMUNITY="key"
```

### 2. Start Backend Server
## Server Testing

```bash
cd /Users/yahya/Documents/git/osa-phase1

# Start development server
# Start dev server
uv run uvicorn src.api.main:app --reload --port 38528
```

Server will be available at: `http://localhost:38528`

### 3. Test Endpoints

#### A. List All Communities

```bash
# List communities (verify yours appears)
curl http://localhost:38528/communities | jq
```

**Expected response:**
```json
{
"communities": [
{
"id": "eeglab",
"name": "EEGLAB",
"description": "EEG signal processing and analysis toolbox",
"status": "available"
},
{
"id": "hed",
"name": "HED (Hierarchical Event Descriptors)",
...
}
]
}
```

#### B. Get EEGLAB Community Info

```bash
curl http://localhost:38528/communities/eeglab | jq
```

**Expected response:**
```json
{
"id": "eeglab",
"name": "EEGLAB",
"description": "EEG signal processing and analysis toolbox",
"status": "available",
"documentation_count": 26,
"github_repos": 6,
"has_sync_config": true
}
```

#### C. Ask a Question (Simple)

```bash
curl -X POST http://localhost:38528/eeglab/ask \
-H "Content-Type: application/json" \
-d '{
"question": "What is EEGLAB?",
"api_key": "your-openrouter-key"
}' | jq
```

**Expected response:**
```json
{
"answer": "EEGLAB is an interactive MATLAB toolbox...",
"sources": [
{
"title": "EEGLAB quickstart",
"url": "https://sccn.github.io/..."
}
]
}
```

#### D. Ask About ICA

```bash
curl -X POST http://localhost:38528/eeglab/ask \
# Ask a question
curl -X POST http://localhost:38528/COMMUNITY_ID/ask \
-H "Content-Type: application/json" \
-d '{
"question": "How do I run ICA in EEGLAB?",
"api_key": "your-openrouter-key"
}' | jq
-d '{"question": "What is this tool?", "api_key": "your-key"}' | jq
```

**Should mention:** ICA decomposition, ICLabel, artifact removal

#### E. Test Chat Endpoint
## CLI Testing (No Server Needed)

```bash
curl -X POST http://localhost:38528/eeglab/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "What preprocessing steps should I do?"}
],
"api_key": "your-openrouter-key"
}' | jq
```

**Should mention:** Filtering, re-referencing, ICA, artifact removal
# Interactive chat
uv run osa chat --community COMMUNITY_ID --standalone

### 4. Test Documentation Retrieval

The assistant should automatically retrieve docs. Test by asking specific questions:

```bash
# Should trigger retrieve_eeglab_docs tool
curl -X POST http://localhost:38528/eeglab/ask \
-H "Content-Type: application/json" \
-d '{
"question": "How do I filter my EEG data in EEGLAB?",
"api_key": "your-openrouter-key",
"stream": false
}' | jq '.tool_calls'
# Single question
uv run osa ask --community COMMUNITY_ID "What is this tool?" --standalone
```

**Expected:** Should call `retrieve_eeglab_docs` with filter-related docs

### 5. Test via CLI (Easier!)
## Knowledge Sync

```bash
cd /Users/yahya/Documents/git/osa-phase1

# Set API key
export OPENROUTER_API_KEY="your-key-here"

# Start interactive chat
uv run osa chat --community eeglab --standalone

# Or ask single question
uv run osa ask --community eeglab "What is EEGLAB?" --standalone
uv run osa sync init --community COMMUNITY_ID
uv run osa sync github --community COMMUNITY_ID --full
uv run osa sync papers --community COMMUNITY_ID --citations
```

**CLI is easier for testing because:**
- Handles API key automatically
- Shows formatted output
- Interactive mode for multi-turn conversations
## Test Checklist

## Test Questions for EEGLAB

Good test questions to verify configuration:

1. **Basic Info:**
- "What is EEGLAB?"
- "What can EEGLAB do?"

2. **Preprocessing:**
- "What preprocessing steps should I do?"
- "How do I filter EEG data?"
- "How do I re-reference my data?"

3. **ICA:**
- "How do I run ICA in EEGLAB?"
- "What is ICLabel?"
- "How do I remove artifacts with ICA?"

4. **Plugins:**
- "What is clean_rawdata?"
- "How do I use ASR?"
- "What is the PREP pipeline?"

5. **Integration:**
- "How do I use EEGLAB with BIDS?"
- "Can I use EEGLAB with Python?"

6. **Knowledge Base (requires sync):**
- "What are the latest issues in the eeglab repo?"
- "Show me recent PRs in ICLabel"
- "Papers about EEGLAB ICA"
- [ ] Config validates without errors
- [ ] Community appears in `/communities`
- [ ] `/ask` endpoint returns relevant answers
- [ ] `/chat` endpoint works for multi-turn
- [ ] Preloaded docs are in context
- [ ] On-demand docs retrieved when relevant
- [ ] Documentation URLs in responses are valid
- [ ] CLI standalone mode works
- [ ] Knowledge sync completes (if configured)
- [ ] Assistant does not hallucinate PR/issue numbers

## Troubleshooting

### Server won't start

```bash
# Check if port is already in use
lsof -i :38528

# Use different port
uv run uvicorn src.api.main:app --reload --port 38529
```

### "Assistant not found" error

```bash
# Verify EEGLAB is registered
uv run python -c "from src.assistants import discover_assistants, registry; discover_assistants(); print('eeglab' in registry)"
```

### Documentation not retrieved

- Check that `retrieve_eeglab_docs` tool is available
- Check network access to sccn.github.io
- Check tool calls in response

### Knowledge base empty

- Knowledge base requires `API_KEYS` env var for sync
- Run sync locally:
```bash
export API_KEYS="test-key"
uv run osa sync init --community eeglab
uv run osa sync github --community eeglab --full
```

## Expected Behavior

**What works without knowledge sync:**
- ✓ Assistant creation
- ✓ System prompt
- ✓ Documentation retrieval (fetches from URLs)
- ✓ Answering questions about EEGLAB
- ✓ Providing guidance on workflows

**What needs knowledge sync:**
- ✗ Searching GitHub issues/PRs
- ✗ Listing recent activity
- ✗ Searching papers
- ✗ Citation counts

## Next: Epic Branch Workflow

See `epic-branch-workflow.md` for multi-phase development process.
- **Server won't start**: Check port with `lsof -i :38528`
- **Assistant not found**: Check discovery with `uv run python -c "from src.assistants import discover_assistants, registry; discover_assistants(); print([a.id for a in registry.list_available()])"`
- **Docs not retrieved**: Test source_url with `curl -I <url>`
- **Knowledge empty**: Run `uv run osa sync init --community COMMUNITY_ID` first
Loading