Skip to content

feat(settings): Phase 2 — migrate to mountainash-settings.profiles + auth - #75

Merged
discreteds merged 6 commits into
developfrom
feat/profiles-migration
Apr 17, 2026
Merged

feat(settings): Phase 2 — migrate to mountainash-settings.profiles + auth#75
discreteds merged 6 commits into
developfrom
feat/profiles-migration

Conversation

@discreteds

Copy link
Copy Markdown
Member

Summary

Phase 2 of the profiles-promotion initiative: mountainash-data now consumes the descriptor/registry/auth primitives promoted to mountainash-settings in Phase 1 (shipped as v26.4.0) rather than maintaining its own copy.

ConnectionProfile shrinks to a thin subclass of mountainash_settings.profiles.DescriptorProfile that adds the database-flavored output methods only. A typed BackendDescriptor(ProfileDescriptor) subclass retains the database-specific fields (default_port, connection_string_scheme, ibis_dialect, rides_on). A DATABASES_REGISTRY = Registry("databases") replaces the module-level dict.

External API byte-identical — every previously-exported name from mountainash_data.core.settings still resolves from the same import path; DATABASES_REGISTRY is the only addition.

Spec mapping

What shipped

6 commits:

  1. f166679 refactor(settings): thin ConnectionProfile + DATABASES_REGISTRY wrapper
  2. 3b707d4 refactor(settings): rewire imports to mountainash-settings.profiles + auth (bundles T3+T4 — ProfileDescriptor raises TypeError on unknown kwargs, so T3 couldn't stand alone without typed BackendDescriptor)
  3. ca61558 chore(settings): add DATABASES_REGISTRY to public re-exports
  4. 0521ebb test(settings): switch to shared descriptor_invariants_for helper
  5. 050c5d2 test(settings): trim tests to data-specific cases; delete duplicates
  6. 3a14977 docs: update CLAUDE.md settings section for mountainash-settings promotion

Files touched

Rewritten:

  • src/mountainash_data/core/settings/profile.py — ~200 → ~90 lines. Keeps only to_driver_kwargs() / to_connection_string().
  • src/mountainash_data/core/settings/registry.py — wraps Registry("databases"); preserves REGISTRY as a _RegistryDictView(Mapping) for back-compat (inherits .get() via ABC).

New:

  • src/mountainash_data/core/settings/descriptor.pyBackendDescriptor(ProfileDescriptor) with 4 typed database-specific fields.
  • src/mountainash_data/core/settings/auth/ — compatibility shim re-exporting from mountainash_settings.auth (not in original plan; preserves ~18 test imports of from mountainash_data.core.settings.auth import X. Can be deleted once no downstream uses the deep path).

Mechanical rewrites:

  • 12 per-backend settings files — import swap only (.descriptor/.authmountainash_settings.profiles/.auth).
  • 7 adapter files — method rename (_default_driver_kwargs_default_kwargs, _auth_to_driver_kwargs_auth_kwargs) per upstream API.

Tests:

  • test_auth.py + test_auth_dispatch.py deleted (coverage now in mountainash-settings).
  • test_descriptor.py / test_profile.py / test_registry.py trimmed to database-specific behaviour.
  • test_descriptors_invariants.py now uses shared descriptor_invariants_for(DATABASES_REGISTRY) helper — 108 parametric cases (12 backends × 9 invariants).

Deviations from plan (pragmatic)

  1. T3+T4 bundledProfileDescriptor raises TypeError (not AttributeError) on unknown kwargs, so backends couldn't instantiate their descriptors without the typed subclass.
  2. auth/ compatibility shim — not in plan, added to preserve ~18 test imports without rewriting them. Small, limited surface.
  3. Registry test seams (_snapshot_for_tests, _reset_for_tests as module-level wrappers) — delegates to upstream Registry instance methods.

All three cleared in final code review as well-bounded and principled.

Test plan

  • hatch run test:test tests/test_unit/ — 427 passed, 5 skipped, 0 failures
  • Final code review approved
  • Reviewer: spot-check __all__ preservation against origin/develop
  • Reviewer: confirm adapter method rename is consistent across all 7 files

Dependency

Requires mountainash-settings >= 26.4.0 (released). Sibling-path dep in hatch.toml is unchanged.

🤖 Generated with Claude Code

discreteds and others added 6 commits April 17, 2026 14:00
Replace the fat local ConnectionProfile/registry/descriptor/auth stack with
thin wrappers over mountainash_settings.profiles primitives. Deletes the local
descriptor.py (BackendDescriptor, ParameterSpec, MISSING) and the entire auth/
sub-package; those now live in the upstream mountainash-settings library.
Introduces DATABASES_REGISTRY (Registry instance) and updates register/
get_descriptor/get_settings_class to delegate to it. Adds a _RegistryDictView
backwards-compat alias for existing REGISTRY imports. Intentionally breaks
imports across the 12 per-backend files — Task 3 fixes them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… auth

- Adapter files: `from mountainash_data.core.settings.auth import` →
  `from mountainash_settings.auth import`; rename `_default_driver_kwargs()`
  → `_default_kwargs()` and `_auth_to_driver_kwargs()` → `_auth_kwargs()`
  across 7 adapter files.
- Create `settings/descriptor.py` with typed `BackendDescriptor` subclass
  (extends `ProfileDescriptor` with `default_port`, `connection_string_scheme`,
  `ibis_dialect`, `rides_on` fields) so per-backend files keep typed field access.
- Per-backend files: import now routes through `.descriptor` → `mountainash_settings.profiles`.
- `settings/auth/` compatibility shim package: re-exports all auth primitives
  from `mountainash_settings.auth` so existing `from mountainash_data.core.settings.auth
  import X` call sites continue to work.
- `registry.py`: expose `_snapshot_for_tests` / `_reset_for_tests` module-level
  wrappers delegating to `DATABASES_REGISTRY`.
- `settings/__init__.py`: auth re-exports now pull from `mountainash_settings.auth`
  directly.

Result: 234 passed, 1 skipped (test_adapter_replaces_pipeline_output uses old
`_default_driver_kwargs()` name in test adapter — Task 7 territory).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove test_auth.py and test_auth_dispatch.py (coverage moved to
mountainash-settings). Rewrite descriptor/profile/registry tests to
cover only data-specific behaviour (BackendDescriptor fields,
to_driver_kwargs(), to_connection_string(), DATABASES_REGISTRY wrapper).
Fixes 1 failing test that called the removed _default_driver_kwargs().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…otion

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Apr 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.33333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.48%. Comparing base (f83c195) to head (3a14977).
⚠️ Report is 8 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/mountainash_data/core/settings/registry.py 71.87% 8 Missing and 1 partial ⚠️
src/mountainash_data/core/settings/auth/base.py 0.00% 1 Missing ⚠️
...rc/mountainash_data/core/settings/auth/dispatch.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #75      +/-   ##
===========================================
- Coverage    58.24%   54.48%   -3.77%     
===========================================
  Files           61       52       -9     
  Lines         2867     2641     -226     
  Branches       308      289      -19     
===========================================
- Hits          1670     1439     -231     
- Misses        1085     1093       +8     
+ Partials       112      109       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@discreteds
discreteds merged commit 6d9ec94 into develop Apr 17, 2026
5 of 6 checks passed
@discreteds
discreteds deleted the feat/profiles-migration branch April 17, 2026 04:23
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.

1 participant