Skip to content

[Bug fix] MRR type updates, deterministic line item indices, validation tests and streamlit link fixes#43

Open
fivetran-avinash wants to merge 5 commits intomainfrom
bugfix/validation-tests-and-streamlit-links
Open

[Bug fix] MRR type updates, deterministic line item indices, validation tests and streamlit link fixes#43
fivetran-avinash wants to merge 5 commits intomainfrom
bugfix/validation-tests-and-streamlit-links

Conversation

@fivetran-avinash
Copy link
Contributor

PR Overview

Package version introduced in this PR:

  • 1.3.1

This PR addresses the following Issue/Feature(s):

  • GA-1014633, GA-1010090

Summary of changes:

  • MRR type was being misclassified due to rounding issues, made line item indices deterministic, updated validation tests, fixed streamlit links

Submission Checklist

  • [NA] Alignment meeting with the reviewer (if needed)
    • [NA] Timeline and validation requirements discussed
  • Provide validation details:
    • Validation Steps: Check for unintentional effects (e.g., add/run consistency & integrity tests)
    • Testing Instructions: Confirm the change addresses the issue(s)
    • [NA] Focus Areas: Complex logic or queries that need extra attention
  • [NA] Merge any relevant open PRs into this PR

Changelog

  • Draft changelog for PR
  • Final changelog for release review

@fivetran-avinash fivetran-avinash self-assigned this Jan 31, 2026
Copy link
Collaborator

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

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

A few comments, questions, suggestions before approving.

) }}

{% set exclude_cols = var('consistency_test_exclude_metrics', []) %}
{% set exclude_cols = ['daily_charges', 'daily_credits', 'daily_discounts', 'daily_net_change', 'daily_taxes', 'rolling_account_balance', 'rolling_charge_balance', 'rolling_credit_balance', 'rolling_discount_balance', 'rolling_tax_balance'] + var('consistency_test_exclude_metrics', []) %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we actually want to always exclude these? These seem like important columns to check in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved these tests over to a new consistency test designed to compare amounts. I missed some the first time around but applied them again now.

) }}

{% set exclude_cols = var('consistency_test_exclude_metrics', []) %}
{% set exclude_cols = ['current_month_mrr', 'previous_month_mrr'] + var('consistency_test_exclude_metrics', []) %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment about if we really want to exclude these columns in future releases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a separate consistency test to compare the amounts. Called this out more explicitly in the changelog.

Comment on lines +56 to +66
select
*,
case when current_month_mrr > previous_month_mrr then 'expansion'
when current_month_mrr < previous_month_mrr then 'contraction'
when current_month_mrr = previous_month_mrr then 'unchanged'
case when round(cast(current_month_mrr as {{ dbt.type_numeric() }}), 2) > round(cast(previous_month_mrr as {{ dbt.type_numeric() }}), 2) then 'expansion'
when round(cast(current_month_mrr as {{ dbt.type_numeric() }}), 2) < round(cast(previous_month_mrr as {{ dbt.type_numeric() }}), 2) then 'contraction'
when round(cast(current_month_mrr as {{ dbt.type_numeric() }}), 2) = round(cast(previous_month_mrr as {{ dbt.type_numeric() }}), 2) then 'unchanged'
when previous_month_mrr is null then 'new'
when (current_month_mrr = 0.0 or current_month_mrr is null)
and (previous_month_mrr != 0.0)
then 'churned'
when (previous_month_mrr = 0.0 and current_month_mrr > 0.0
and account_month_number >= 3)
when (previous_month_mrr = 0.0 and current_month_mrr > 0.0
and account_month_number >= 3)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it instead be more accurate to change the casts to float we apply in the staging model to be numeric in order to ensure consistent results as opposed to adjusting these case statements downstream.

In this case, numeric would be a more accurate representation of the field(s) and we should apply that at the staging layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree changing numeric to float is probably the right approach at the staging layer. But that would increase the scope of this issue as all Recurly amounts are designed as floats and need to be updated across the model, so I opted for the band-aid. Should I add these in now or file a separate issue for future scoping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants