refactor(breaking): rename breaking module + dual-vocabulary change-category aliasing#1424
Conversation
…ategory aliasing M4 (OSS half) of the change-category vocabulary migration. Opens the dual-vocabulary aliasing window: wire enums stay legacy (breaking/non_breaking/partial_breaking/unknown); the v2 vocabulary (model_wide/column/additive) is accepted on input and emitted opt-in via the `Accept-Vocabulary: v2` response header. - Rename recce/util/breaking.py -> recce/util/change_classifier.py; breaking.py kept as a deprecated re-export shim (removed next release). - Add CHANGE_CATEGORY_ALIASES + normalize_change_category() + to_v2_change_category() (in models/types.py to avoid a circular import, re-exported from change_classifier). - Defensive Pydantic field validators normalize v2 input to legacy. - Opt-in Accept-Vocabulary: v2 output on /api/info and /api/cll. - CI lint (scripts/check_wire_enum_literals.sh + workflow) blocks NEW legacy wire-enum literals under js/packages/ui/src/; allowlist marker // wire-enum-ok. Resolves DRC-3553 (OSS portion). Cloud-side is a separate repo/PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: even-wei <evenwei@infuseai.io>
Codecov Report❌ Patch coverage is
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Add an explicit top-level permissions block scoped to contents:read on the new Wire-Enum Lint workflow. The job only checks out the repo and runs a read-only diff script, so the default broad GITHUB_TOKEN scope is unneeded. Resolves the CodeQL "Workflow does not contain permissions" alert flagged on this PR and matches the repo convention (tests-python.yaml, address-dependabot.yaml). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: even-wei <evenwei@infuseai.io>
…-window-oss-cloud-python
Code Review: PR #1424SHA The Issues
Notes
Resolve Issues 1–2 (or accept Issue 2 as a tracked follow-up) for GO. |
gcko
left a comment
There was a problem hiding this comment.
Claude Code Review: NO-GO — 2 issues (v2 /api/cll exclude_none divergence; untested v2 output paths). See review comment.
…r v2 output paths Address PR #1424 review feedback (gcko): - /api/cll v2 branch no longer passes exclude_none=True to model_dump(); the manual serialization now matches the default response_model shape, so the ONLY difference between modes is the change_category labels - add endpoint tests for /api/info and /api/cll v2 branches, including shape-parity assertions, plus unit tests for wants_v2_vocabulary and translate_merged_lineage_to_v2 - rename test_parse_change_category_accepts_both_vocabularies -> test_normalize_change_category_accepts_both_vocabularies (the test exercises normalize_change_category, not parse_change_category) - scope normalize_change_category docstring: the unrecognized-label passthrough benefits direct callers only; ChangeCategory Literal fields still reject unknown labels at model boundaries Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: even-wei <evenwei@infuseai.io>
|
@gcko Thanks for the review — all four findings addressed in Issue 1 — v2 Issue 2 — untested v2 output paths: Fixed. Added:
Note 1 — misleading test name: Fixed. Renamed to Note 2 — forward-compat docstring overpromise ( Verification: |
Code Review: PR #1424SHA All four prior findings resolved. Verified the new commit
Verification: 62 tests pass ( |
gcko
left a comment
There was a problem hiding this comment.
Claude Code Review: GO (incremental). All prior findings resolved. See review comment.
PR checklist
What type of PR is this?
refactor / feature (backwards-compatible)
What this PR does / why we need it
M4 (OSS half) of the change-category vocabulary migration. Opens the dual-vocabulary aliasing window so Recce Cloud and OSS can roll over from the legacy vocabulary (
breaking/non_breaking/partial_breaking/unknown) to v2 (model_wide/column/additive) independently over one release window.recce/util/breaking.py→recce/util/change_classifier.py;recce/util/breaking.pyremains a deprecated re-export shim (removed next release).CHANGE_CATEGORY_ALIASES+normalize_change_category()(accepts either vocab, returns canonical legacy value) +to_v2_change_category().field_validator(mode="before")onNodeChange.categoryandCllNode.change_categorynormalize v2 input to legacy (forward-compat).Accept-Vocabulary: v2output on/api/infoand/api/cll(default path unchanged).scripts/check_wire_enum_literals.sh+.github/workflows/wire-enum-lint.yaml) fails PRs adding NEW legacy wire-enum literals underjs/packages/ui/src/; allowlist via inline marker// wire-enum-ok.Note on issue AC#1: the
parse_change_category("breaking")example is pseudo-code — the real function diffs SQL. The intent is realized by the stringnormalize_change_category(); the new test asserts the four equivalences against it.Which issue(s) this PR fixes
Resolves DRC-3553 (OSS portion). Cloud-side (recce-cloud-infra) is a separate PR.
Special notes for your reviewer
recce/models/types.py(notchange_classifier.py) to avoid a circular import; re-exported fromchange_classifier.tests/util/test_breaking.py,tests/adapter/dbt_adapter/test_dbt_cll.py,tests/test_merged_lineage.py,tests/util/test_cll_cache.py).Does this PR introduce a user-facing change?
Opt-in
Accept-Vocabulary: v2response header and a dual-vocabulary aliasing window for change categories. The legacy vocabulary (breaking/non_breaking/partial_breaking) is DEPRECATED and will be REMOVED next release; migrate to v2 (model_wide/column/additive). Both vocabularies are accepted on input during the window.recce.util.breakingis deprecated; import fromrecce.util.change_classifier.