-
Notifications
You must be signed in to change notification settings - Fork 0
Implement persistent storage and the pressure algorithm using PostgreSQL database #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # .github/workflows/webhook_gateway_tests.yaml # webhook-gateway/webhook_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed up to database.go
, looks great so far! thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Some questions around testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements persistent storage and the pressure algorithm using PostgreSQL database. The changes introduce a comprehensive database layer for managing auth tokens, jobs, and flavors, with a sophisticated job-to-flavor assignment algorithm based on priority and pressure metrics.
- Adds PostgreSQL database integration with pgx driver and migrations
- Implements pressure-based job assignment algorithm for optimal resource allocation
- Converts tests from integration-only to unit tests with database mocking
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
webhook_gateway_rockcraft.yaml | New Rockcraft configuration for webhook-gateway container build |
webhook-gateway/webhook_test.go | Simplified tests by removing integration flag and converting fatal errors to skips |
internal/database/model.go | Database models for Flavor and Job entities with JSON/DB tags |
internal/database/migrations/0001_init.up.sql | Initial database schema with tables, indexes, and constraints |
internal/database/migrations/0001_init.down.sql | Migration rollback script for schema cleanup |
internal/database/migration.go | Database migration utilities using golang-migrate |
internal/database/database_test.go | Comprehensive test suite covering all database operations |
internal/database/database.go | Core database implementation with pressure algorithm and CRUD operations |
go.mod | Added PostgreSQL and migration dependencies |
.github/workflows/webhook_gateway_tests.yaml | Removed dedicated webhook gateway integration test workflow |
.github/workflows/tests.yaml | Enhanced with PostgreSQL and RabbitMQ services for comprehensive testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minor nit: we could provide just database connections in database.go
and add service layers on top (i.e. auth, flavor, pressure) to separate the code logically. But it looks good as is since there isn't too much code.
Yes, but the auth, flavor, and pressure are all just different SQL queries in this implementation, so they can’t be separated from the database logic. |
# Conflicts: # go.mod # go.sum
# Conflicts: # go.mod # go.sum
Overview
Implement persistent storage and the pressure algorithm using PostgreSQL database.
Rationale
Checklist
urgent
,trivial
,senior-review-required
,documentation
).