Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular import #11137

Merged
merged 3 commits into from
Dec 19, 2024
Merged

Fix circular import #11137

merged 3 commits into from
Dec 19, 2024

Conversation

dradetsky
Copy link
Contributor

@dradetsky dradetsky commented Dec 11, 2024

resolves #11142

Problem

There was a circular import which required duplicating a method in core/dbt/config/profile.py. This was both ugly and an impediment to improving that method if required (as in #11108).

Solution

Fix the circular import and remove the duplication

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.86%. Comparing base (6621015) to head (f89980b).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11137      +/-   ##
==========================================
- Coverage   88.91%   88.86%   -0.06%     
==========================================
  Files         183      186       +3     
  Lines       23937    23971      +34     
==========================================
+ Hits        21284    21302      +18     
- Misses       2653     2669      +16     
Flag Coverage Δ
integration 86.17% <100.00%> (-0.12%) ⬇️
unit 61.97% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 61.97% <100.00%> (+0.02%) ⬆️
Integration Tests 86.17% <100.00%> (-0.12%) ⬇️

@dradetsky
Copy link
Contributor Author

wow, I didn't know I fixed an issue! good job me!

@dradetsky
Copy link
Contributor Author

The one check CI is uhappy with is code coverage, here: https://github.com/dbt-labs/dbt-core/pull/11137/checks?check_run_id=34330125418

86.17% (-0.12%) compared to 6621015

So probably what's happened here is that we've added 1 line of imports (which is not considered covered even if it is actually exercised by tests), and then removed ~10 lines of bugs & duplication. These removed lines were covered, and thus coverage has gone down (it's also possible that we're accidentally counting changelog lines as uncovered code, but this is less likely).

Anyway, the moral of the story is that code coverage is not an ultra-precise measure of code quality. We could add a few lines of no-ops to an otherwise-covered function to "fix" this, but I don't recommend this.

@graciegoheen graciegoheen added the ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering label Dec 19, 2024
Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks for adding this @dradetsky !!

@ChenyuLInx ChenyuLInx merged commit 95c090b into dbt-labs:main Dec 19, 2024
58 of 59 checks passed
emmyoop added a commit that referenced this pull request Dec 23, 2024
peterallenwebb pushed a commit that referenced this pull request Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes community This PR is from a community member ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tech debt] Remove duplicated definition of default_profiles_dir (without adding circular dependency)
4 participants