Skip to content

feat: add sync status API endpoints for monitoring - #29

Merged
neuromechanist merged 3 commits into
developfrom
feature/issue-27-sync-status-api
Jan 15, 2026
Merged

neuromechanist merged 3 commits into
developfrom
feature/issue-27-sync-status-api

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Add API endpoints for monitoring knowledge sync status, enabling status pages and health checks.

New Endpoints

Endpoint Method Auth Description
/sync/status GET No Full sync status with counts, scheduler info, health
/sync/trigger POST API Key Manual sync trigger
/sync/health GET No Simple health check (200 OK / 503 unhealthy)

Example Response (GET /sync/status)

{
  "github": {
    "total_items": 1516,
    "issues": 233,
    "prs": 1283,
    "open_items": 29,
    "repos": {
      "hed-standard/hed-specification": {"items": 587, "last_sync": "2026-01-14T..."}
    }
  },
  "papers": {...},
  "scheduler": {
    "enabled": true,
    "running": true,
    "github_cron": "0 2 * * *",
    "next_github_sync": "2026-01-15T02:00:00Z"
  },
  "health": {
    "healthy": true,
    "github_age_hours": 23.5
  }
}

Also Included

  • Added OSC domains to CORS origins for status page integration
  • Tests for all sync endpoints (9 new tests)

Test Plan

  • All 429 tests pass
  • New sync endpoint tests pass
  • Manual test on backend server

Closes #27

Add /sync/status, /sync/trigger, and /sync/health endpoints:
- GET /sync/status: Full sync status with GitHub/papers counts, scheduler info, health
- POST /sync/trigger: Manual sync trigger (requires API key)
- GET /sync/health: Simple health check for monitoring (returns 503 if unhealthy)

Also:
- Add OSC domains to CORS origins for status page integration
- Add tests for all sync endpoints

Closes #27
Tests now work regardless of auth configuration by:
- Using BYOK headers to bypass server auth
- Testing validation behavior rather than specific auth responses
- Accepting multiple valid status codes based on environment
- Add RequireAdminAuth dependency (BYOK bypass not allowed for admin endpoints)
- Remove database_path from public /sync/status response
- Update health check to treat new installations as healthy (grace period)
- Fix tests to use @pytest.mark.usefixtures for db isolation
@neuromechanist
neuromechanist merged commit 76eafd4 into develop Jan 15, 2026
@neuromechanist
neuromechanist deleted the feature/issue-27-sync-status-api branch January 15, 2026 06:10
neuromechanist added a commit that referenced this pull request Jan 15, 2026
- 0.3.0: Knowledge sources database (PR #26)
- 0.3.1: Sync status API endpoints (PR #29)
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.

1 participant