feat(finance): add spin fixed cost master CRUD contracts - #55
Merged
Merged
Conversation
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>
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
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
Proto Files Changed
common/v1/common.protofinance/v1/uom.protofinance/v1/spin_fixed_cost.protoChanges Made
mst_spin_fixed_costmanagement.periodfield fromUpdateSpinFixedCostRequestto structurally enforce the immutability of the business key (uq_msfc_period_live).gt: 0validation constraints tocommon_poy_denierandpoy_productionto avoid zero-divisor issues in calculation formulas, while settinggte: 0for the remaining four pool fields.Related Issues
Fixes #
Related to #
Breaking Change Check
Is this a breaking change?
buf breakingpassesBreaking Change Evidence
Lint Check
# Output of buf lint buf lintGenerated Code Preview (Optional)
// Generated Go code changesPre-merge Checklist
buf format -wappliedbuf lintpassesbuf breakingpassesImpact Assessment
Reviewer Notes
periodfield is intentionally omitted fromUpdateSpinFixedCostRequestbecause it acts as the immutable business key behinduq_msfc_period_live.common_poy_denierandpoy_productionare constrained togt: 0as they serve as divisors in fixed-cost calculations.