Skip to content

Add new vetdis co-op excode to exemption views, and configure CI to run unit tests#1053

Merged
jeancochrane merged 4 commits into
masterfrom
jeancochrane/add-coop-dv3-exemption-code-to-views
Jun 29, 2026
Merged

Add new vetdis co-op excode to exemption views, and configure CI to run unit tests#1053
jeancochrane merged 4 commits into
masterfrom
jeancochrane/add-coop-dv3-exemption-code-to-views

Conversation

@jeancochrane

@jeancochrane jeancochrane commented Jun 22, 2026

Copy link
Copy Markdown
Member

This PR fixes two small issues I noticed this morning:

  1. The not-null test on default.vw_pin_exe_long.exemption_type has started failing due to the presence of a valid exemption with excode C-DV3, indicating the co-op version of exe_vet_dis_ge70. This excode wasn't in the reference file our stakeholder sent over to us, but it seems legit, so I'm adding it as an acceptable excode to the default.vw_pin_exe_long view definition, which should resolve the failing test. If you'd prefer I confirm this with our stakeholder before proceeding, I'm happy to do that, too.
  2. Our build-and-test-dbt CI workflow is not running unit tests, due to resource selection logic that only selects resources with the type test and not unit_test. This is visible when you run a specific unit test defined on default.vw_pin_exe_long: In Ensure views are consistent with active PINs in iasworld.pardat #1042 we edited that view to add a dependency on iasworld.pardat, but did not add the corresponding table definition to the default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates unit test, causing the test to fail. This test should have failed on CI, but per the workflow logs, it did not run.

Here is a command showing that default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates fails on the main branch:

$ dbt test --select default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates
...
17:11:00  Completed with 1 error, 0 partial successes, and 0 warnings:
17:11:00
17:11:00    Compilation Error in unit_test default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates (models/default/schema/default.vw_pin_exe_long.yml)
  Unit_Test 'unit_test.ccao_data_athena.default.vw_pin_exe_long.default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates' (models/default/schema/default.vw_pin_exe_long.yml) depends on a source named 'iasworld.pardat' which was not found

I also folded in one other change for a small issue that was annoying me: We now lint YAML files using a pre-commit hook, rather than super-linter. This makes it a lot easier to debug YAML linting failures, which I was running into while fixing our selector logic.

Testing

Testing the fix for issue 1 above (missing co-op excode) is easy, since you can confirm that the version of build-and-test-dbt that ran as part of this PR is passing below (logs here).

Testing the fix for issue 2 (unit tests not running on CI) is harder, because we have no automated tests for it. To do so, I checked to confirm that the default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates test did not run as part of the build-and-test-dbt workflow that ran when #1042 got merged, which introduced the error that breaks that unit test; I then confirmed that this test is now running as part of the build-and-test-dbt workflow runs on this PR (logs here).

I also ran some local QC on the selector itself to confirm that the changes I made to the selectors that CI uses are correct, in that they are now returning unit tests, and unit tests are the only new tests they are returning:

Click to expand local QC commands
# Switch to the main branch; make edit to `default.vw_pin_exe_long` so that it counts
# as "new or modified" (not shown here)
$ git checkout master

# On the main branch: Run the data test selectors and confirm they exclude unit tests
# (neither command emits output)
$ dbt list --quiet --selector select_data_test_non_iasworld | grep unit_test
$ dbt list --quiet --selector select_data_test_new_or_modified_non_iasworld --defer --state master-cache | grep unit_test

# On the main branch: Record the number of results each selector returns
$ dbt list --quiet --selector select_data_test_non_iasworld | wc -l
352
$ dbt list --quiet --selector select_data_test_new_or_modified_non_iasworld --defer --state master-cache | wc -l
3

# Switch to bugfix branch
$ git checkout jeancochrane/add-coop-dv3-exemption-code-to-views

# On the bugfix branch: Run the data test selectors and confirm they exclude unit tests
$ dbt list --quiet --selector select_data_test_non_iasworld | grep unit_test
unit_test:ccao_data_athena.default_vw_pin_address_filters_extra_spaces_from_maildat
unit_test:ccao_data_athena.default_vw_pin_address_filters_invalid_pins
unit_test:ccao_data_athena.default_vw_pin_appeal_class_strips_non_alphanumerics
unit_test:ccao_data_athena.default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates
unit_test:ccao_data_athena.default_vw_pin_exempt_class_strips_non_alphanumerics
unit_test:ccao_data_athena.default_vw_pin_exempt_filters_invalid_pins
unit_test:ccao_data_athena.default_vw_pin_universe_class_strips_non_alphanumerics
unit_test:ccao_data_athena.default_vw_pin_universe_filters_invalid_pins
unit_test:ccao_data_athena.default_vw_pin_value_mailed_class_strips_non_alphanumerics
unit_test:ccao_data_athena.default_vw_pin_value_stage_name_matches_procname
unit_test:ccao_data_athena.location_crosswalk_year_fill_should_create_proper_fill_and_data_years
unit_test:ccao_data_athena.location_vw_pin10_location_fill_should_fill_missing_years
unit_test:ccao_data_athena.proximity_crosswalk_year_fill_should_create_proper_fill_and_data_years
unit_test:ccao_data_athena.proximity_vw_pin10_proximity_fill_should_fill_missing_years
unit_test:ccao_data_athena.sale_vw_outlier_produces_correct_outliers_and_reasons

$ dbt list --quiet --selector select_data_test_new_or_modified_non_iasworld --defer --state master-cache | grep unit_test
unit_test:ccao_data_athena.default_vw_pin_exe_long_ranks_and_selects_properly_among_duplicates

# On the bugfix branch: Record the number of results each selector returns,
# confirm it is the main branch number plus the new tests we grepped above
$ dbt list --quiet --selector select_data_test_non_iasworld | wc -l
367
$ dbt list --quiet --selector select_data_test_new_or_modified_non_iasworld --defer --state master-cache | wc -l
4

@jeancochrane jeancochrane changed the title Add co-op version of exe_vet_dis_ge70 excode to exemption views Add new vetdis co-op excode to exemption views, and configure CI to run unit tests Jun 22, 2026
Comment thread dbt/selectors.yml
# selected can run because it has an argument that references a model
# that _is_ selected.
indirect_selection: cautious
- method: resource_type

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Newer versions of yamllint were complaining about the indentation in this file, so I fixed it.

Comment thread dbt/selectors.yml
Comment on lines +26 to +30
- union:
- method: resource_type
value: test
- method: resource_type
value: unit_test

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is one of two functional changes to this file: Adding unit tests to the list of resource types that the selector will catch.

Comment thread dbt/selectors.yml
Comment on lines +42 to +46
- union:
- method: resource_type
value: test
- method: resource_type
value: unit_test

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the second of two functional changes to this file, same as above.

@jeancochrane jeancochrane marked this pull request as ready for review June 22, 2026 18:26
@jeancochrane jeancochrane requested a review from a team as a code owner June 22, 2026 18:26
@jeancochrane jeancochrane requested a review from wrridgeway June 22, 2026 18:26

@wrridgeway wrridgeway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this looks great. I had no idea we were missing unit tests 🤦

Comment on lines +30 to +32
WHEN
det.excode IN ('DV3', 'C-DV3', 'DV3-M', 'DV-3')
THEN 'exe_vet_dis_ge70'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We've already seen this code for other levels of this exemption, so I don't think we need to confirm with valuations.

@jeancochrane jeancochrane merged commit 0043638 into master Jun 29, 2026
8 checks passed
@jeancochrane jeancochrane deleted the jeancochrane/add-coop-dv3-exemption-code-to-views branch June 29, 2026 15:12
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