Skip to content

feat(finance): add spin fixed cost master CRUD contracts - #55

Merged
ilramdhan merged 1 commit into
mutugading:mainfrom
ilramdhan:fix/calc-engine-aug-10-2026
Aug 11, 2026
Merged

feat(finance): add spin fixed cost master CRUD contracts#55
ilramdhan merged 1 commit into
mutugading:mainfrom
ilramdhan:fix/calc-engine-aug-10-2026

Conversation

@ilramdhan

@ilramdhan ilramdhan commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

Defines the CRUD service contracts for mst_spin_fixed_cost, the period-keyed POY spin pool that the calculation engine allocates HOY fixed costs from. Previously, this table lacked an API contract and relied on raw SQL scripts for new monthly entries. This addition allows the Finance team to manage spin fixed cost master records directly.

Change Type

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

Proto Files Changed

  • common/v1/common.proto
  • finance/v1/uom.proto
  • Other: finance/v1/spin_fixed_cost.proto

Changes Made

  • Added 5 CRUD RPC endpoints for mst_spin_fixed_cost management.
  • Excluded the period field from UpdateSpinFixedCostRequest to structurally enforce the immutability of the business key (uq_msfc_period_live).
  • Applied gt: 0 validation constraints to common_poy_denier and poy_production to avoid zero-divisor issues in calculation formulas, while setting gte: 0 for the remaining four pool fields.

Related Issues

Fixes #
Related to #

Breaking Change Check

Is this a breaking change?

  • No - buf breaking passes
  • Yes - Requires version bump

Breaking Change Evidence

# Output of buf breaking command
buf breaking --against '.git#branch=main'

Lint Check

# Output of buf lint
buf lint

Generated Code Preview (Optional)

// Generated Go code changes

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

Reviewer Notes

  • The period field is intentionally omitted from UpdateSpinFixedCostRequest because it acts as the immutable business key behind uq_msfc_period_live.
  • common_poy_denier and poy_production are constrained to gt: 0 as they serve as divisors in fixed-cost calculations.

Defines the CRUD service for mst_spin_fixed_cost, the period-keyed POY
spin pool the calc engine allocates HOY fixed cost from. Until now the
table had no contract at all: the only row in it was the 202604 anchor
seeded by migration 000474, so entering a new month required an
engineer writing SQL. Finance owns these numbers and needs to enter
them itself.

Five RPCs only. No export/import/template, unlike rm_category: one row
per month is a hand-entered figure, not a bulk-loaded set.

The period field is absent from UpdateSpinFixedCostRequest on purpose.
It is the business key behind uq_msfc_period_live and the value the
loader resolves on, so making it structurally unreachable is stronger
than validating it away.

common_poy_denier and poy_production carry gt: 0 rather than the gte: 0
the other four pool values use. Both are divisors in the fixed-cost
expressions, and both arms guard their divisors by yielding 0 — so a
zero here would not raise a formula error, it would silently zero POY
fixed cost for every product in the period. Rejecting it at the
contract boundary is the earliest point that can be caught.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ilramdhan ilramdhan added this to the Costing Release Milestone milestone Aug 11, 2026
@ilramdhan ilramdhan self-assigned this Aug 11, 2026
Copilot AI lite review requested due to automatic review settings August 11, 2026 04:36
@ilramdhan ilramdhan added enhancement New feature or request feat labels Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ilramdhan
ilramdhan merged commit 273010d into mutugading:main Aug 11, 2026
1 check passed
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

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants