|
Download docs/VERIFICATION_PLAN.md from bthaile/opteee: direct link, hf CLI and curl.
- Browser
- Download file 11.1 kB
-
https://huggingface.co/spaces/bthaile/opteee/resolve/main/docs/VERIFICATION_PLAN.md
- Command line
-
hf download hf://spaces/bthaile/opteee/docs/VERIFICATION_PLAN.md
-
curl -L -o VERIFICATION_PLAN.md https://huggingface.co/spaces/bthaile/opteee/resolve/main/docs/VERIFICATION_PLAN.md
11.1 kB
Application Verification Plan
Purpose: Ensure the application works correctly after highlighting fixes and cleanup
Created: 2025-10-12
π― Verification Strategy
Pre-Change Baseline
- Test current production state
- Document baseline behavior
- Create rollback points
Post-Change Verification
- Verify highlighting feature works
- Ensure no regression in core features
- Check performance metrics
π Phase 1: Pre-Deployment Verification
Run BEFORE deploying highlighting fix
1.1 Application Health Check
# Check if app is running
curl http://localhost:7860/api/health
# Expected response:
# {"status": "healthy", "timestamp": "...", "version": "..."}
1.2 Basic Query Test
# Test a simple query
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{
"query": "What is a covered call?",
"provider": "claude",
"num_results": 5
}' | jq '.answer' | head -20
# Expected: Should return an answer with sources
1.3 Check Server Logs
# Monitor logs for errors
docker logs <container-name> --tail 100
# Look for:
# β
"RAG service initialized successfully"
# β
"Initialized chain for claude"
# β No ERROR or CRITICAL messages
1.4 Verify Core Files
# Ensure production files exist
ls -la app/services/formatters.py
ls -la app/services/rag_service.py
ls -la config.py
ls -la rag_pipeline.py
# All should exist and be readable
π Phase 2: Post-Deployment Verification (Highlighting)
Run AFTER deploying highlighting fix
2.1 Highlighting Feature Test
Test 1: Query with Expected Quotes
# Query that should trigger quoting
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{
"query": "What is PEAD?",
"provider": "claude",
"num_results": 5
}' > test_response.json
# Check the response
cat test_response.json | jq '.answer' | grep -o '"[^"]*"' | head -5
Expected in logs:
β
Extracted 2 quotes for highlighting:
1. "post earnings announcement drift is a thing"
2. "There's certain conditions that have to be met"
β Highlighted: "post earnings announcement drift is a thing"
β
Applied 2 highlight(s) to source content
Expected in response:
{
"answer": "...mentions that \"post earnings announcement drift is a thing\"...",
"sources": "...<mark class=\"quote-highlight\">post earnings announcement drift is a thing</mark>..."
}
Test 2: Visual Verification
- Open the UI in browser
- Ask: "What is post-earnings announcement drift?"
- Check for:
- β AI response includes quoted phrases (in "double quotes")
- β Source snippets show yellow/blue highlighting
- β Header: "π Source Videos with Highlighted Quotes"
- β Highlighted text matches phrases from AI answer
Test 3: No Quotes Scenario
# Query that might not trigger quotes
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{
"query": "Hello",
"provider": "claude",
"num_results": 5
}' > test_response2.json
Expected in logs:
β οΈ No quotes extracted from AI answer - highlighting will not work
Expected behavior:
- App still works normally
- No highlighting (which is fine)
- No errors or crashes
2.2 Check for Regressions
Test: Core RAG Functionality
# Multiple test queries
QUERIES=(
"What are the Greeks in options trading?"
"Explain implied volatility"
"How do I manage theta decay?"
"What is the wheel strategy?"
)
for query in "${QUERIES[@]}"; do
echo "Testing: $query"
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d "{\"query\": \"$query\", \"provider\": \"claude\", \"num_results\": 5}" \
| jq -r '.answer' | head -3
echo "---"
done
Expected:
- β All queries return answers
- β Sources are included
- β No 500 errors
- β Response time < 10 seconds
Test: Source Links
# Check that video links are properly formatted
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{"query": "PEAD", "provider": "claude", "num_results": 3}' \
| jq '.raw_sources[0]'
# Verify:
# - video_url exists
# - video_url_with_timestamp exists
# - timestamp is valid
# - content is not empty
2.3 Performance Check
# Test response time
time curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{"query": "What is delta in options?", "provider": "claude", "num_results": 5}' \
> /dev/null 2>&1
# Expected: < 10 seconds
π§Ή Phase 3: Post-Cleanup Verification
Run AFTER repository cleanup
3.1 Application Still Starts
# Rebuild and start
docker-compose build
docker-compose up -d
# Check logs
docker-compose logs --tail 50
# Expected:
# β
No import errors
# β
"RAG service initialized successfully"
# β
Server starts on port 7860
3.2 All Endpoints Work
# Test each endpoint
curl http://localhost:7860/api/health
curl http://localhost:7860/
curl -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{"query": "test", "provider": "claude", "num_results": 5}'
3.3 Essential Scripts Still Work
# Test moved scripts
python scripts/validate_system.py
python scripts/create_vector_store.py --help
# Expected: No import errors
3.4 Dependencies Intact
# Verify imports work
python -c "from app.services.formatters import ResponseFormatter; print('β
Formatters OK')"
python -c "from app.services.rag_service import RAGService; print('β
RAG Service OK')"
python -c "from rag_pipeline import run_rag_query; print('β
RAG Pipeline OK')"
python -c "from config import SYSTEM_PROMPT; print('β
Config OK')"
π¬ Automated Test Script
Save as verify_application.sh:
#!/bin/bash
set -e
echo "π§ͺ Running Application Verification Tests"
echo "=========================================="
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
FAILED=0
# Test 1: Health Check
echo -e "\nπ Test 1: Health Check"
if curl -f -s http://localhost:7860/api/health > /dev/null; then
echo -e "${GREEN}β
PASS${NC}: Health endpoint responding"
else
echo -e "${RED}β FAIL${NC}: Health endpoint not responding"
FAILED=$((FAILED + 1))
fi
# Test 2: Basic Query
echo -e "\nπ Test 2: Basic Query"
RESPONSE=$(curl -s -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{"query": "What is a call option?", "provider": "claude", "num_results": 3}')
if echo "$RESPONSE" | jq -e '.answer' > /dev/null 2>&1; then
echo -e "${GREEN}β
PASS${NC}: Query returns answer"
else
echo -e "${RED}β FAIL${NC}: Query failed or malformed response"
FAILED=$((FAILED + 1))
fi
# Test 3: Sources Included
echo -e "\nπ Test 3: Sources Included"
if echo "$RESPONSE" | jq -e '.raw_sources[0]' > /dev/null 2>&1; then
echo -e "${GREEN}β
PASS${NC}: Sources are included"
else
echo -e "${RED}β FAIL${NC}: No sources in response"
FAILED=$((FAILED + 1))
fi
# Test 4: Video URLs Valid
echo -e "\nπ Test 4: Video URLs"
VIDEO_URL=$(echo "$RESPONSE" | jq -r '.raw_sources[0].video_url_with_timestamp')
if [[ $VIDEO_URL == https://www.youtube.com/* ]]; then
echo -e "${GREEN}β
PASS${NC}: Video URL is valid"
else
echo -e "${RED}β FAIL${NC}: Video URL is invalid or missing"
FAILED=$((FAILED + 1))
fi
# Test 5: Highlighting Test
echo -e "\nπ Test 5: Highlighting Feature"
PEAD_RESPONSE=$(curl -s -X POST http://localhost:7860/api/chat \
-H "Content-Type: application/json" \
-d '{"query": "What is PEAD?", "provider": "claude", "num_results": 3}')
QUOTES=$(echo "$PEAD_RESPONSE" | jq -r '.answer' | grep -o '"[^"]*"' | wc -l)
if [ "$QUOTES" -gt 0 ]; then
echo -e "${GREEN}β
PASS${NC}: AI response includes quotes ($QUOTES found)"
else
echo -e "${YELLOW}β οΈ WARN${NC}: AI response has no quotes (may need prompt tuning)"
fi
HIGHLIGHTS=$(echo "$PEAD_RESPONSE" | jq -r '.sources' | grep -o '<mark class="quote-highlight">' | wc -l)
if [ "$HIGHLIGHTS" -gt 0 ]; then
echo -e "${GREEN}β
PASS${NC}: Highlighting applied ($HIGHLIGHTS highlights)"
else
echo -e "${YELLOW}β οΈ WARN${NC}: No highlights found (check if quotes match source)"
fi
# Summary
echo -e "\n=========================================="
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}β
All critical tests passed!${NC}"
exit 0
else
echo -e "${RED}β $FAILED test(s) failed${NC}"
exit 1
fi
π Success Criteria
β Highlighting Feature (New)
- AI responses include direct quotes from sources
- Transcript snippets show
<mark class="quote-highlight">tags - Logs show "Extracted X quotes" and "Applied X highlights"
- Visual: Yellow/blue highlighting visible in UI
- Header appears: "π Source Videos with Highlighted Quotes"
β Core Functionality (Regression Check)
- Health endpoint returns 200 OK
- Chat endpoint accepts queries
- Responses include answers and sources
- Video URLs are properly formatted
- Timestamps are included
- Response time < 10 seconds
- No Python import errors
- No 500 server errors
β After Cleanup
- Application builds successfully
- Application starts without errors
- All tests above still pass
- Essential scripts in
/scriptswork - No import errors from moved files
π¨ Rollback Triggers
Immediately rollback if:
- β Health endpoint returns 500 or doesn't respond
- β Import errors in logs
- β Application won't start
- β Queries return 500 errors
- β Response time > 30 seconds consistently
Consider rollback if:
- β οΈ Highlighting feature doesn't work (but app works)
- β οΈ More than 2 tests fail
- β οΈ User complaints about broken features
π Verification Checklist
Before Deployment
- Run
verify_application.sh(baseline) - Document current response times
- Tag current state:
git tag pre-deploy-$(date +%Y%m%d) - Backup production database if applicable
After Highlighting Deployment
- Run
verify_application.sh - Test 5-10 queries manually in UI
- Check logs for quote extraction messages
- Verify highlighting visible in UI
- Compare response times to baseline
After Cleanup
- Run
verify_application.sh - Rebuild Docker images
- Test production deployment
- Verify no import errors
Final Sign-off
- All tests passing
- No errors in logs for 1 hour
- Response times acceptable
- Highlighting working (or gracefully failing)
- Team notified of changes
Status: Ready to use
Estimated Time: 15-20 minutes for full verification
Automation Level: High (most tests can run automatically)