Skip to content

feat: add Oracle Sync proto definitions with job management and data synchronization services#21

Merged
ilramdhan merged 1 commit intomutugading:mainfrom
ilramdhan:feat/formula-master-proto
Apr 17, 2026
Merged

feat: add Oracle Sync proto definitions with job management and data synchronization services#21
ilramdhan merged 1 commit intomutugading:mainfrom
ilramdhan:feat/formula-master-proto

Conversation

@ilramdhan
Copy link
Copy Markdown
Member

Description

This pull request introduces a new gRPC API definition for managing Oracle-to-PostgreSQL synchronization jobs in the finance.v1 package. 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

  • ✨ New service/message
  • ➕ Add field/RPC/enum value
  • 🔄 Modify validation
  • 📝 Documentation update
  • ⚠️ Deprecation
  • 🔧 Config/script changes

Proto Files Changed

  • finance/v1/oracle_sync.proto

Changes Made

The most important changes are:

API and Service Definition

  • Added a new OracleSyncService gRPC 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

  • Defined core entities: SyncJob (representing a sync job execution), SyncJobLog (logging each step of a job), and ItemConsStockPO (representing synced item consumption, stock, and PO records).
  • Introduced enums JobStatus and JobLogStatus to standardize job and log step states.

Requests and Responses

  • Added request/response messages for all major operations, including triggering a sync job, getting/cancelling a job, listing jobs, retrieving item consumption data, and listing available periods. Each response is wrapped with a standard BaseResponse and supports pagination where appropriate.

Pre-merge Checklist

  • I have read and followed RULES.md
  • buf format -w applied
  • buf lint passes
  • buf breaking passes
  • Comments document new messages/fields
  • REST mappings follow conventions
  • Validation rules are complete
  • Field numbers are logical

Impact Assessment

  • Backend code regeneration required
  • Frontend code regeneration required
  • OpenAPI spec regeneration required

@ilramdhan ilramdhan requested a review from Copilot April 17, 2026 06:14
@ilramdhan ilramdhan self-assigned this Apr 17, 2026
@ilramdhan ilramdhan added enhancement New feature or request feat labels Apr 17, 2026
@ilramdhan ilramdhan merged commit 94d38c5 into mutugading:main Apr 17, 2026
3 checks passed
Copy link
Copy Markdown

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 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 OracleSyncService with 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 using common.v1.BaseResponse and pagination.
  • Updated buf.lock to a newer buf.build/bufbuild/protovalidate dependency 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];
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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}$"
}];

Copilot uses AI. Check for mistakes.
Comment on lines +227 to +233
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;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
// 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];
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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]))?$"];

Copilot uses AI. Check for mistakes.
// Filter by status.
JobStatus status = 4;
// Filter by period (YYYYMM).
string period = 5 [(buf.validate.field).string.max_len = 6];
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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
}];

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants