feat: Deployed search logging and popular searches endpoint to ub01, ra…

GSD-Task: S01/T02
This commit is contained in:
jlightner 2026-04-03 04:07:10 +00:00
parent f64a0c1107
commit ea8a77be59
3 changed files with 95 additions and 1 deletions

View file

@ -68,7 +68,7 @@
- Estimate: 25m
- Files: backend/models.py, backend/schemas.py, backend/routers/search.py, alembic/versions/013_add_search_log.py, backend/redis_client.py
- Verify: cd backend && python -c "from models import SearchLog; from schemas import PopularSearchItem, PopularSearchesResponse; from routers.search import router; routes = [r.path for r in router.routes]; assert '/popular' in routes; print('ALL OK')"
- [ ] **T02: Deploy to ub01, run migration, and verify end-to-end** — Push code to ub01, rebuild containers, run the Alembic migration, and verify the full flow with real HTTP requests.
- [x] **T02: Deployed search logging and popular searches endpoint to ub01, ran Alembic migration 013, verified end-to-end with real HTTP requests** — Push code to ub01, rebuild containers, run the Alembic migration, and verify the full flow with real HTTP requests.
## Steps

View file

@ -0,0 +1,16 @@
{
"schemaVersion": 1,
"taskId": "T01",
"unitId": "M015/S01/T01",
"timestamp": 1775188976081,
"passed": true,
"discoverySource": "task-plan",
"checks": [
{
"command": "cd backend",
"exitCode": 0,
"durationMs": 11,
"verdict": "pass"
}
]
}

View file

@ -0,0 +1,78 @@
---
id: T02
parent: S01
milestone: M015
provides: []
requires: []
affects: []
key_files: []
key_decisions: ["Compose service name is 'chrysopedia-web' not 'chrysopedia-web-8096'"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "All verification checks passed: popular endpoint returns items array, search_log count > 0 after searches, empty query not logged, all slice-level import/route checks pass."
completed_at: 2026-04-03T04:07:03.459Z
blocker_discovered: false
---
# T02: Deployed search logging and popular searches endpoint to ub01, ran Alembic migration 013, verified end-to-end with real HTTP requests
> Deployed search logging and popular searches endpoint to ub01, ran Alembic migration 013, verified end-to-end with real HTTP requests
## What Happened
---
id: T02
parent: S01
milestone: M015
key_files:
- (none)
key_decisions:
- Compose service name is 'chrysopedia-web' not 'chrysopedia-web-8096'
duration: ""
verification_result: passed
completed_at: 2026-04-03T04:07:03.460Z
blocker_discovered: false
---
# T02: Deployed search logging and popular searches endpoint to ub01, ran Alembic migration 013, verified end-to-end with real HTTP requests
**Deployed search logging and popular searches endpoint to ub01, ran Alembic migration 013, verified end-to-end with real HTTP requests**
## What Happened
Pushed T01 commit to origin, pulled on ub01, rebuilt API and worker containers. Applied Alembic migration 013 creating the search_log table. Restarted nginx container for stale DNS. Verified three real searches logged correctly, empty queries excluded, and GET /search/popular returns valid cached JSON.
## Verification
All verification checks passed: popular endpoint returns items array, search_log count > 0 after searches, empty query not logged, all slice-level import/route checks pass.
## Verification Evidence
| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `curl -sf http://ub01:8096/api/v1/search/popular | python3 assert items` | 0 | ✅ pass | 1000ms |
| 2 | `ssh ub01 docker exec chrysopedia-db psql SELECT count FROM search_log` | 0 | ✅ pass | 1000ms |
| 3 | `cd backend && python -c from models import SearchLog` | 0 | ✅ pass | 1000ms |
| 4 | `cd backend && python -c from schemas import PopularSearchItem` | 0 | ✅ pass | 1000ms |
| 5 | `cd backend && python -c assert popular in routes` | 0 | ✅ pass | 1000ms |
## Deviations
Slice verification check 3 expected '/popular' but router returns '/search/popular' with prefix — adjusted assertion. Docker compose service name is 'chrysopedia-web' not 'chrysopedia-web-8096'.
## Known Issues
None.
## Files Created/Modified
None.
## Deviations
Slice verification check 3 expected '/popular' but router returns '/search/popular' with prefix — adjusted assertion. Docker compose service name is 'chrysopedia-web' not 'chrysopedia-web-8096'.
## Known Issues
None.