feat: add Oracle Sync proto definitions with job management and data synchronization services#21
Conversation
…synchronization services
There was a problem hiding this comment.
Pull request overview
This PR introduces a new finance.v1 gRPC/HTTP API surface for managing Oracle→PostgreSQL sync jobs and for querying synced item consumption/stock/PO data.
Changes:
- Added
OracleSyncServicewith RPCs to trigger, inspect, list, and cancel sync jobs, plus endpoints to list synced records and available periods. - Added new domain messages/enums (
SyncJob,SyncJobLog,ItemConsStockPO,JobStatus,JobLogStatus) along with request/response wrappers usingcommon.v1.BaseResponseand pagination. - Updated
buf.lockto a newerbuf.build/bufbuild/protovalidatedependency revision.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| finance/v1/oracle_sync.proto | Adds the Oracle sync job management + synced data query API (messages, enums, service + HTTP mappings). |
| buf.lock | Bumps protovalidate dependency used by (buf.validate.*) rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lte: 100 | ||
| }]; | ||
| // Filter by period (YYYYMM). | ||
| string period = 3 [(buf.validate.field).string.max_len = 6]; |
There was a problem hiding this comment.
period is documented as YYYYMM but the request validation only caps length at 6. If the backend expects strict YYYYMM filtering, add format validation (digits-only, exactly 6 when non-empty) so clients get consistent errors instead of silent no-match results.
| string period = 3 [(buf.validate.field).string.max_len = 6]; | |
| string period = 3 [(buf.validate.field).string = { | |
| ignore_empty: true | |
| len: 6 | |
| pattern: "^[0-9]{6}$" | |
| }]; |
| message ListSyncJobsResponse { | ||
| // Standard response envelope. | ||
| common.v1.BaseResponse base = 1; | ||
| // List of sync jobs. | ||
| repeated SyncJob data = 2; | ||
| // Pagination metadata. | ||
| common.v1.PaginationResponse pagination = 3; |
There was a problem hiding this comment.
SyncJob includes repeated SyncJobLog logs, and ListSyncJobsResponse returns repeated SyncJob, which means the list endpoint can inadvertently include full execution logs for every job (potentially very large payloads). Consider splitting into a summary message for list responses (without logs) and reserving logs for GetSyncJob, or add a dedicated ListSyncJobLogs RPC with pagination/limits.
| // TriggerSyncRequest initiates an Oracle-to-PostgreSQL sync job. | ||
| message TriggerSyncRequest { | ||
| // Period to sync (YYYYMM format). If empty, auto-resolved based on current date. | ||
| string period = 1 [(buf.validate.field).string.max_len = 6]; |
There was a problem hiding this comment.
period is documented as YYYYMM (or empty), but the validation only enforces max_len = 6, so values like "abc" or "2026" will pass. Consider validating the format when provided (e.g., digits-only YYYYMM) while still allowing empty for auto-resolve.
| string period = 1 [(buf.validate.field).string.max_len = 6]; | |
| string period = 1 [(buf.validate.field).string.pattern = "^(\\d{4}(0[1-9]|1[0-2]))?$"]; |
| // Filter by status. | ||
| JobStatus status = 4; | ||
| // Filter by period (YYYYMM). | ||
| string period = 5 [(buf.validate.field).string.max_len = 6]; |
There was a problem hiding this comment.
period is described as YYYYMM but only has max_len = 6; invalid values (non-digits / wrong length) will pass validation. Suggest adding a stricter validation (e.g., digits-only, exactly 6 when non-empty) to keep filtering behavior consistent across clients.
| string period = 5 [(buf.validate.field).string.max_len = 6]; | |
| string period = 5 [(buf.validate.field).string = { | |
| len: 6 | |
| pattern: "^[0-9]{6}$" | |
| ignore_empty: true | |
| }]; |
Description
This pull request introduces a new gRPC API definition for managing Oracle-to-PostgreSQL synchronization jobs in the
finance.v1package. It establishes the message types, enums, requests, responses, and service methods necessary to trigger, monitor, and manage sync jobs, as well as to query synced item consumption and stock data.Change Type
Proto Files Changed
finance/v1/oracle_sync.protoChanges Made
The most important changes are:
API and Service Definition
OracleSyncServicegRPC service with endpoints to trigger sync jobs, retrieve job details and logs, list jobs, cancel jobs, fetch synced item consumption/stock/PO data, and list available sync periods.Data Model and Entities
SyncJob(representing a sync job execution),SyncJobLog(logging each step of a job), andItemConsStockPO(representing synced item consumption, stock, and PO records).JobStatusandJobLogStatusto standardize job and log step states.Requests and Responses
BaseResponseand supports pagination where appropriate.Pre-merge Checklist
buf format -wappliedbuf lintpassesbuf breakingpassesImpact Assessment