Skip to content

feat(annotations): REST endpoints for relationships and sync queue#29

Merged
patchmemory merged 2 commits intomainfrom
pr/annotations-rest-endpoints
Feb 3, 2026
Merged

feat(annotations): REST endpoints for relationships and sync queue#29
patchmemory merged 2 commits intomainfrom
pr/annotations-rest-endpoints

Conversation

@patchmemory
Copy link
Owner

Summary

Implements Phase 02 REST endpoints for the annotations story (task:annotations/rest-endpoints).

Changes

New Endpoints

Relationships:

  • POST /api/relationships - Create relationship between entities
  • GET /api/relationships?file_id=<id> - List relationships for entity
  • DELETE /api/relationships/<id> - Delete relationship

Sync Queue:

  • POST /api/sync - Enqueue sync item for background processing
  • GET /api/sync/queue - List unprocessed sync queue items
  • POST /api/sync/<id>/mark-processed - Mark sync item as processed

Implementation

  • Created scidk/web/routes/api_annotations.py blueprint with 6 endpoints
  • Registered blueprint in scidk/web/routes/__init__.py
  • Extended tests/test_annotations_rest_endpoints.py with 10 new test functions
  • All endpoints use existing SQLite CRUD from scidk/core/annotations_sqlite.py

Test Results

143 passed (all non-E2E tests)

New tests:

  • test_create_relationship_success
  • test_create_relationship_missing_fields
  • test_list_relationships_success
  • test_list_relationships_missing_file_id
  • test_delete_relationship_success
  • test_enqueue_sync_success
  • test_enqueue_sync_missing_fields
  • test_list_sync_queue
  • test_mark_sync_processed_success
  • test_privacy_guardrails_documented

Privacy Guardrails

Privacy guardrails are documented in test suite for future implementation:

  1. Authentication - Only authenticated users can access
  2. Authorization - Users can only access their own data
  3. Rate limiting - Prevent abuse
  4. Input validation - Sanitize all inputs
  5. Audit logging - Track all relationship changes

Acceptance Criteria

✅ Endpoints work
✅ Tests pass
✅ Privacy guardrails noted

Task Info

  • Task ID: task:annotations/rest-endpoints
  • Story: annotations-page
  • Phase: phase-02-rest-endpoints
  • RICE Score: 3.1
  • Estimate: 0.5d

Related

  • Depends on: task:annotations/relationships-and-sync-queue (Done)
  • Story: dev/stories/annotations-page/story.md
  • Phase: dev/stories/annotations-page/phases/phase-02-rest-endpoints.md

🤖 Generated with Claude Code

patchmemory and others added 2 commits February 3, 2026 11:30
…c queue

Implements Phase 02 REST endpoints for annotations story:
- POST /api/relationships - create relationship between entities
- GET /api/relationships?file_id= - list relationships for entity
- DELETE /api/relationships/<id> - delete relationship
- POST /api/sync - enqueue sync item for background processing
- GET /api/sync/queue - list unprocessed sync queue items
- POST /api/sync/<id>/mark-processed - mark sync item as processed

Implementation:
- Created api_annotations.py blueprint with comprehensive endpoints
- Registered blueprint in routes/__init__.py
- Extended test_annotations_rest_endpoints.py with 10 new tests
- All tests pass (143 passed)

Privacy guardrails documented for future implementation:
- Authentication and authorization
- Rate limiting
- Input validation and sanitization
- Audit logging

Task: task:annotations/rest-endpoints
DoD: ✅ endpoints work; tests pass; privacy guardrails noted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@patchmemory patchmemory merged commit 51cde4e into main Feb 3, 2026
2 checks passed
@patchmemory patchmemory deleted the pr/annotations-rest-endpoints branch February 3, 2026 20:35
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