fix(reconcile): honor a product's stated behavior on create and match feature-name case on apply - #1890
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 32106206559Coverage increased (+0.01%) to 48.782%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Review: honor behavior on create, match feature-name case on apply (RFC 0001 Rule 2) Verified on this branch: Both claims hold. Case normalization is now one shared function I also checked whether the same raw-case-on-apply gap remains for price names. It does not bite, because the billing service lowercases price names server-side on create and update (billing/product/service.go:456 and :518), unlike features. So leaving prices untouched is correct. Verdict: approve with nits. Nit:
|
df70845 to
75aa967
Compare
1be71eb to
f60571f
Compare
|
Follow-up on the nit. Agreed, and left as is on purpose. This PR makes the diff and the apply agree on feature-name case, which removes the symmetric fork risk. The residual case, a legacy or externally created mixed-case feature row, needs the server to canonicalize feature names on store and on lookup. That is a server change outside this reconcile PR, so it is a follow-up, not part of this change. |
|
Re-review (head 75aa967) The head moved only because of the rebase onto #1889. #1890's own patch is byte-for-byte identical to the previous review, so nothing in this PR's content changed. Build, tests, and lint are all green. Re-confirmed: feature-name case is normalized by one shared The residual mixed-case feature fork is still open and needs a server-side feature-name canonicalization ( Verdict: approve with nits. |
… feature-name case on apply
f60571f to
3cd15ce
Compare
75aa967 to
6f72be1
Compare
What
Two ways the BillingProduct file's stated intent was not what got applied:
Behavior on create.
Service.Createforcedbehavior = creditswhenevercredit_amount > 0, ignoring the behavior the file set. Now an explicit behavior is honored; only an omitted behavior on a credit product falls back tocredits(the server's create-time default). The reconciler's diff mirrors the same rule, so a file that names a behavior the product was not created with fails the plan instead of being silently overridden.Feature name case. The diff compared feature names lowercased and trimmed, but the apply sent them raw. Since the server looks features up by name, a case difference read as "no change" yet could fork a duplicate feature on a co-occurring update. Both sides now use one
normalizeFeatureNamehelper.Why
RFC 0001 Rule 2: the file is the desired state. The applied result must match what the file stated, with no silent override and no duplicate created behind a "no change" plan.
Testing
TestService_Createcases: an explicit behavior is honored on a credit product, and an omitted behavior defaults to credits.billing/...andinternal/reconcilepass.Stack
Stacked on
fix/reconcile-permission-spicedb-grammar.