Skip to content

fix: give each catalog merge error its own class in both packages - #436

Draft
jat255 wants to merge 1 commit into
jat255/whhh-live-warehouse-rfrom
jat255/8kf5-catalog-merge-error-classes
Draft

jat255 wants to merge 1 commit into
jat255/whhh-live-warehouse-rfrom
jat255/8kf5-catalog-merge-error-classes

Conversation

@jat255

@jat255 jat255 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds an error class for each of the three ways a data dictionary can fail to match the warehouse catalog, in both packages. The shared catalog-merge fixture already names which error each failing case expects, and both test runners now check it, so an unrelated failure no longer passes those cases.

Stacked on #431.

Review notes

  • In Python the new classes subclass ValueError, so code that catches ValueError today still catches them. Like the existing catalog access errors, they are exported from commons._catalog but not from commons.
  • The fixture keeps its short slugs (ambiguous, claimed, ambiguous_column). Each runner maps a slug to its own class name.

Testing

Python: ruff, pyrefly and the full pytest suite pass. R: R CMD check passes with no errors, warnings or notes. It ran with _R_CHECK_FORCE_SUGGESTS_=false, because rsconnect is not installed locally. Both runners failed before the classes were added, and pass after.

For the R reviewer

The three cli_abort() calls in the dictionary merge in catalog.R now set a condition class: commons_catalog_ambiguous_table_error, commons_catalog_claimed_relation_error and commons_catalog_ambiguous_column_error. This follows the pattern of the classes in catalog-security.R. The messages and the inputs that cause an error are unchanged; the only difference is that the errors can now be caught by class. test-catalog-merge.R now checks the class with expect_error(class = ), and NEWS names the classes, because these errors shipped in 0.1.1.

Agent-written notes

kata: 8kf5 (milestone M10). The issue also asked for a check of the other shared fixtures for fields that no runner asserts. That audit found more, filed as kata 438r (definition-export error codes, which need production changes like this PR) and bgn3 (gaps that only one runner checks, test-only).

@jat255 jat255 added r Affects the R implementation py Affects the Python implementation tests Related to testing or the test suite needs-manual-review Agent-created work that needs a human review labels Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview root: https://posit-dev.github.io/commons/pr-436/

Python site preview: https://posit-dev.github.io/commons/pr-436/py/

Built from the latest commit on this branch. The R links in it point at the published R site, which no pull request rebuilds.

@jat255
jat255 force-pushed the jat255/whhh-live-warehouse-r branch from dce7070 to ed8e840 Compare October 21, 2026 22:02
@jat255
jat255 force-pushed the jat255/8kf5-catalog-merge-error-classes branch from 2528d72 to 2e33b0e Compare October 21, 2026 22:03
The catalog-merge fixture names an error slug for its three failing cases, but
both runners accepted any error, so an unrelated failure would pass. Each
refusal now has a class (an R condition class, and a ValueError subclass in
Python so existing handlers still catch it), and both runners map the slug to
the class they expect.
@jat255
jat255 force-pushed the jat255/8kf5-catalog-merge-error-classes branch from 2e33b0e to 97bc0e6 Compare October 22, 2026 02:46

This branch has not been deployed

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

Labels

needs-manual-review Agent-created work that needs a human review py Affects the Python implementation r Affects the R implementation tests Related to testing or the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant