Skip to content

Fix PostgreSQL compatibility and user tracking consistency#70

Merged
nullure merged 2 commits intoCaviraOSS:mainfrom
ajitam:main
Nov 29, 2025
Merged

Fix PostgreSQL compatibility and user tracking consistency#70
nullure merged 2 commits intoCaviraOSS:mainfrom
ajitam:main

Conversation

@ajitam
Copy link
Copy Markdown
Contributor

@ajitam ajitam commented Nov 28, 2025

📋 Description

This PR provides additional PostgreSQL compatibility fixes that build upon #69. Without these fixes, pattern pushes
from the VSCode extension produce server errors when using PostgreSQL as the metadata backend.

Key Changes:

  • Update user_id handling to use "anonymous" instead of null for consistency with user tracking
  • Fix dashboard SQL queries to support both SQLite and PostgreSQL parameter syntax (? vs $1/$2)
  • Add schema-aware queries for PostgreSQL stats table
  • Fix datetime formatting for PostgreSQL (strftime → to_char/to_timestamp)

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Style/UI changes
  • ♻️ Code refactoring
  • ⚡ Performance improvements
  • 🧪 Test updates
  • 🔧 Build/CI changes

🧪 Testing

  • I have tested this change locally
  • VSCode extension pattern pushes work correctly with PostgreSQL backend
  • Dashboard endpoints return proper data with PostgreSQL
  • Backward compatibility with SQLite maintained

Testing Environment:

  • PostgreSQL backend with schema support
  • VSCode extension integration
  • Dashboard API endpoints verified

📱 Screenshots (if applicable)

N/A - Backend fixes only

🔍 Code Review Checklist

  • Code follows the project's coding standards
  • Self-review of the code has been performed
  • Code is properly commented, particularly in hard-to-understand areas
  • Changes generate no new warnings
  • Any dependent changes have been merged and published

📚 Related Issues

Related to #69 - This PR addresses PostgreSQL compatibility issues not covered in the initial user tracking
implementation. Without these fixes, the VSCode extension encounters server errors when performing pattern pushes
with PostgreSQL as the backend.

🚀 Deployment Notes

  • No migration required
  • Works with both SQLite and PostgreSQL backends
  • No breaking changes to existing functionality

📋 Additional Context

During testing of PR #69, discovered that:

  1. Dashboard queries were still using SQLite-specific syntax (? parameters, strftime)
  2. User ID handling inconsistency caused null constraint violations in PostgreSQL
  3. Stats table queries didn't respect PostgreSQL schema configuration

These fixes ensure full PostgreSQL compatibility across the codebase.

root and others added 2 commits November 28, 2025 22:07
- Update user_id handling to use "anonymous" instead of null for consistency with user tracking
- Fix dashboard SQL queries to support both SQLite and PostgreSQL parameter syntax (? vs $1/$2)
- Add schema-aware queries for PostgreSQL stats table
- Fix datetime formatting for PostgreSQL (strftime → to_char/to_timestamp)

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix opm CLI authentication header case (bearer → Bearer)
- Fix dashboard stats endpoint to use schema-qualified table names for PostgreSQL
- Update opm stats command to use correct endpoint (/dashboard/stats)
- Fix opm list --user command to use correct route (/users/:id/memories)
- Update CLI response parsing to handle both 'items' and 'memories' arrays

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@nullure nullure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nullure nullure merged commit 0b89d1b into CaviraOSS:main Nov 29, 2025
1 check passed
@ajitam
Copy link
Copy Markdown
Contributor Author

ajitam commented Nov 29, 2025

Just FYI - while PR was waiting I already pushed additional fix - 9dd2651

And it was merged together with the original fix. Sorry about that (also this fix was tested from my side)

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.

2 participants