feat(product-cost): Add Product and Cost Calculation services with RPCs#28
Merged
ilramdhan merged 7 commits intoMay 26, 2026
Merged
Conversation
Defines ProductService (7 RPCs: CRUD + Duplicate + ListByRequest) and ProductRequestService (9 RPCs: CRUD + Assign + Resolve + Reject + SearchExistingProducts) with full buf.validate annotations and gRPC-Gateway HTTP annotations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ateRoute + ListLinkedRequests
Defines 11 RPCs covering calc job lifecycle (trigger/get/list/chunks/products/cancel) and cost result access (get/breakdown/history/verify/approve) plus 6 enums and core entity messages (CalJob, CalJobChunk, CalJobProduct, CostResult, CostBreakdown, LevelBreakdown, CostRMDetail, FormulaEval, CostHistoryEntry). Renamed RMCostDetail to CostRMDetail to avoid collision with rm_cost.proto. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New internal RPC on CostCalcService that delegates to existing app.Service.ProcessChunk. No REST gateway path -- service-to-service only. Gated by finance.cost.caljob.trigger permission. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors Revise: POST /api/v1/finance/cost-product-requests/{id}/reopen.
Lets an admin move a terminal CLOSED request back to DRAFT to re-enter
the lifecycle.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…eriod default) GET /api/v1/finance/cost-results — lists active cost results across products for a period (empty period resolves to the latest present), with optional calc-type / status / product-search filters. Response carries resolved product code/name/uom so the UI shows no UUIDs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR significantly expands the shared proto API surface for Finance product costing (requests, routing, masters, ERP lookups, parameters, notifications, attachments, audit logs, and cost calculation) and extends IAM with workflow and company-mapping capabilities. It also updates Buf codegen to use local plugin binaries for improved reliability.
Changes:
- Added many new
finance.v1cost-related entities and CRUD/lookup/state-transition services (including a largeCostCalcServiceAPI). - Added IAM workflow template/instance services and user ↔ company-mapping assignment RPCs/fields.
- Switched
buf.gen.yamlfrom remote BSR plugins to localprotoc-gen-*binaries.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
buf.gen.yaml |
Switches Buf generation plugins from remote to local binaries. |
finance/v1/cost_attachment.proto |
Adds attachment entity + upload/list/download-url/delete RPCs for requests/comments. |
finance/v1/cost_audit_log.proto |
Adds read-only audit log listing API for cost-domain entities. |
finance/v1/cost_calc.proto |
Adds cost calculation job orchestration API, results, breakdowns, and internal worker RPC. |
finance/v1/cost_erp.proto |
Adds read-only paginated ERP replica lookup APIs (items/grades/shades). |
finance/v1/cost_notification.proto |
Adds in-app notification listing/unread-count/mark-read APIs. |
finance/v1/cost_paper_tube_type.proto |
Adds read-only lookup API for paper tube types. |
finance/v1/cost_product_master.proto |
Adds cost-system product master CRUD/list + ERP linkage update RPC. |
finance/v1/cost_product_parameter.proto |
Adds per-product parameter value upsert/batch upsert/delete + applicability APIs. |
finance/v1/cost_product_request.proto |
Adds cost product request entity, CRUD/list, and state-transition RPCs. |
finance/v1/cost_product_type.proto |
Adds CRUD/list API for cost product type master. |
finance/v1/cost_request_comment.proto |
Adds request comment thread CRUD + hide/unhide + edit-history APIs. |
finance/v1/cost_request_type.proto |
Adds read-only lookup API for request types. |
finance/v1/cost_rm_type.proto |
Adds CRUD/list API for cost RM type master. |
finance/v1/cost_route.proto |
Adds route head/graph APIs plus duplicate/link/create-from-product operations. |
finance/v1/cost_routing_rule.proto |
Adds CRUD/list API for routing rule engine (condition/action). |
finance/v1/parameter.proto |
Extends parameter entity and create/update requests with costing ownership/display fields. |
iam/v1/auth.proto |
Extends AuthUser with section/department identifiers. |
iam/v1/company_mapping.proto |
Adds company-mapping master CRUD/list API for org hierarchy mapping. |
iam/v1/user.proto |
Adds user company-mapping assignment RPCs and new user/master-detail fields. |
iam/v1/workflow.proto |
Adds workflow template CRUD/versioning + runtime workflow instance APIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| optional bool is_active = 4; | ||
| // Unlock account (optional). | ||
| optional bool unlock_account = 5; | ||
| // Employee level ID (optional, UUID; clears when omitted from request body). |
Comment on lines
+349
to
+359
| message ListWorkflowInstancesRequest { | ||
| string entity_kind = 1 [(buf.validate.field).string = { | ||
| in: [ | ||
| "", | ||
| "PRD_REQUEST", | ||
| "CST_PRODUCT", | ||
| "PARAM_FILL" | ||
| ] | ||
| }]; | ||
| string entity_id = 2; | ||
| string status = 3 [(buf.validate.field).string = { |
| max_len: 200 | ||
| }]; | ||
| string description = 3 [(buf.validate.field).string = {max_len: 1000}]; | ||
| repeated WorkflowTemplateStepInput steps = 4 [(buf.validate.field).repeated.min_items = 1]; |
Comment on lines
+33
to
+35
| // Exactly one of (request_id, comment_id) must be > 0. | ||
| int64 request_id = 1; | ||
| int64 comment_id = 2; |
Comment on lines
+89
to
+95
| // Value as string (decimals as text for precision). One of these must be set. | ||
| string value_numeric = 3; | ||
| string value_text = 4; | ||
| // value_flag is a real bool — we cannot distinguish "unset" from FALSE, so | ||
| // callers must use has_value_flag to opt in. | ||
| bool value_flag = 5; | ||
| bool has_value_flag = 6; |
|
|
||
| message UpsertProductParamValuesBatchRequest { | ||
| int64 product_sys_id = 1 [(buf.validate.field).int64.gt = 0]; | ||
| repeated UpsertProductParamValueRequest values = 2 [(buf.validate.field).repeated.min_items = 1]; |
Comment on lines
+108
to
+109
| // CalJob represents a calculation job batch. | ||
| message CalJob { |
| // Pagination params. | ||
| common.v1.PaginationRequest pagination = 1; | ||
| // Optional period filter (YYYYMM). | ||
| string period = 2; |
Comment on lines
+621
to
+622
| // Product sys ids to compute; at least one required. | ||
| repeated int64 product_ids = 5 [(buf.validate.field).repeated.min_items = 1]; |
| string uom_code = 22; | ||
| // Resolved UOM name (read-only, populated from mst_uom join). | ||
| string uom_name = 23; | ||
| // Responsible department (Engineering, Production, Finance, RND). Optional. |
This was
linked to
issues
May 25, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces several new proto files and updates the code generation setup for the finance service, adding major new API surfaces for cost management features. The most important changes are the introduction of proto definitions for cost product master data, ERP lookups, audit logging, notification management, file attachments, and related lookups, as well as switching code generation plugins from remote to local binaries for improved reliability.
Change Type
Proto Files Changed
finance/v1/cost_calc.protofinance/v1/cost_product_request.protofinance/v1/cost_attachment.protofinance/v1/cost_audit_log.protofinance/v1/cost_erp.protofinance/v1/cost_notification.protofinance/v1/cost_paper_tube_type.protofinance/v1/cost_product_master.protofinance/v1/cost_product_parameter.protofinance/v1/cost_product_type.protofinance/v1/cost_request_comment.protofinance/v1/cost_request_type.protofinance/v1/cost_rm_type.protofinance/v1/cost_route.protofinance/v1/cost_routing_rule.protofinance/v1/parameter.protofinance/v1/product.proto (deletion)finance/v1/product_request.proto (deletion)iam/v1/auth.proto/auth.protoiam/v1/auth.proto/company_mapping.protoiam/v1/auth.proto/user.protoiam/v1/auth.proto/workflow.protoChanges Made
Proto API Additions
cost_product_master.protodefining the CostProductMaster entity and a full CRUD+list API, supporting creation, update, ERP linkage, deactivation, and rich filtering for product master records.cost_erp.protoproviding read-only, paginated lookup APIs for ERP master data (items, grades, shades) to facilitate integration and autocomplete features.cost_audit_log.protointroducing an append-only audit log entity and a read-only API for querying audit events related to cost entities.cost_notification.protodefining entities and APIs for in-app notifications, unread counts, and marking notifications as read, supporting user notification workflows.cost_attachment.protoproviding file attachment support for requests and comments, including upload, listing, download URL generation, and deletion.cost_paper_tube_type.protofor listing paper tube type lookups used in product specifications.Build System Improvements
buf.gen.yamlto use local code generation plugins (protoc-gen-go,protoc-gen-go-grpc, etc.) instead of remote plugins, improving reliability and removing runtime dependency on the Buf Schema Registry.Pre-merge Checklist
buf format -wappliedbuf lintpassesbuf breakingpassesImpact Assessment