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 state:modified check for exports #10565

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

aliceliu
Copy link
Contributor

@aliceliu aliceliu commented Aug 13, 2024

Resolves #10138

Problem

Saved queries always show up as modified in CI because of the check old_export.config.schema_name == new_export.config.schema_name (old schema is prod schema and new schema is CI schema).

Solution

Add unrendered_config to exports and compare the unrendered config instead of the config

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.

@cla-bot cla-bot bot added the cla:yes label Aug 13, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @aliceliu and the rest of your teammates on Graphite Graphite

@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from 0163e47 to debaf76 Compare August 13, 2024 22:44
@aliceliu aliceliu marked this pull request as ready for review August 13, 2024 22:46
@aliceliu aliceliu requested a review from a team as a code owner August 13, 2024 22:46
@github-actions github-actions bot added the community This PR is from a community member label Aug 13, 2024
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.86%. Comparing base (bba020f) to head (a95fa4f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10565      +/-   ##
==========================================
- Coverage   88.91%   88.86%   -0.05%     
==========================================
  Files         180      180              
  Lines       22755    22760       +5     
==========================================
- Hits        20232    20226       -6     
- Misses       2523     2534      +11     
Flag Coverage Δ
integration 86.10% <100.00%> (-0.12%) ⬇️
unit 62.33% <16.66%> (-0.01%) ⬇️

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

Components Coverage Δ
Unit Tests 62.33% <16.66%> (-0.01%) ⬇️
Integration Tests 86.10% <100.00%> (-0.12%) ⬇️

@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from debaf76 to fea309b Compare August 13, 2024 23:00
Copy link
Contributor

@gshank gshank left a comment

Choose a reason for hiding this comment

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

I think the changes are fine, but we need an update to the schemas: https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/artifacts/README.md#updating-schemasgetdbtcom. I'll approve this but it would be best to get the schema updated fairly soon.

To skip the failure in checking schemas, you add the "artifact_minor_update" label.

@aliceliu
Copy link
Contributor Author

dbt-labs/schemas.getdbt.com#50 is the PR for the schema change

@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from fea309b to bed29b3 Compare August 21, 2024 23:51
@aliceliu aliceliu added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Aug 22, 2024
@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from bed29b3 to 340c5a4 Compare August 22, 2024 17:25
@aliceliu aliceliu requested a review from a team as a code owner August 22, 2024 17:25
@aliceliu aliceliu requested review from heysweet and removed request for a team August 22, 2024 17:25
@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from 340c5a4 to 78bd04f Compare August 23, 2024 18:17
@aliceliu aliceliu force-pushed the 08-13-fix_state_modified_check_for_exports branch from 78bd04f to a95fa4f Compare August 23, 2024 18:21
and old_export.config.schema_name == new_export.config.schema_name
and old_export.config.alias == new_export.config.alias
):
if not (old_export.name == new_export.name):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The check is out of date, the newest one show 100% coverage https://github.com/dbt-labs/dbt-core/pull/10565/checks?check_run_id=29180771199

keys = ["export_as", "schema", "alias"]
for key in keys:
if old_export.unrendered_config.get(key) != new_export.unrendered_config.get(key):
return False
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here

@peterallenwebb peterallenwebb merged commit 3c55806 into main Aug 23, 2024
65 of 67 checks passed
@peterallenwebb peterallenwebb deleted the 08-13-fix_state_modified_check_for_exports branch August 23, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking cla:yes community This PR is from a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] saved queries are always selected as "modified", they should not be
4 participants