Skip to content

Conversation

weiiwang01
Copy link
Collaborator

Overview

Implement persistent storage and the pressure algorithm using PostgreSQL database.

Rationale

Checklist

  • The PR is tagged with appropriate label (urgent, trivial, senior-review-required, documentation).

@weiiwang01 weiiwang01 marked this pull request as ready for review October 6, 2025 06:16
Copy link
Member

@yanksyoon yanksyoon left a 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!

Copy link
Collaborator

@cbartz cbartz left a 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.

@cbartz cbartz requested a review from Copilot October 6, 2025 10:27
Copy link
Contributor

@Copilot Copilot AI left a 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.

Copy link
Member

@yanksyoon yanksyoon left a 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.

@weiiwang01
Copy link
Collaborator Author

database.go

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.

@weiiwang01 weiiwang01 merged commit ff0b0cc into main Oct 23, 2025
10 checks passed
@weiiwang01 weiiwang01 deleted the database branch October 23, 2025 08:30
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.

3 participants