feat(profiles): unified emission Phase 1 — target-aware driver_key, __adapters__, Profile.emit()#46
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ence Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A target-scoped profile emitted with an explicit None (not _UNSET) bypassed
the unknown-target guard and silently returned {} — every dict driver_key
resolved via .get(None) to nothing. Drop the 'target is not None' carve-out
so explicit None fails closed unless None is a registered target, matching
the spec's emission safety contract. Found in final review.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What
Phase 1 (settings substrate) of the unified profile→kwargs emission design
(spec).
Generalizes the settings
Profileso a single profile can emit different SDKkwarg shapes per target (e.g. paramiko vs http vs boto). Additive and
fully output-back-compatible — bare-string
driver_keyspecs are byte-for-byteunchanged; target-scoped profiles fail closed.
This is the dependency-free foundation. Phases 2 (auth-client adapters +
TargetFamily+ rule-4 invariant) and 3 (transport wiring +_core/authdeletion) build on it and ship separately.
Changes
ParameterSpec.driver_key:str | None→str | dict[Hashable, str] | None.A bare string maps for every target; a dict scopes per target. Excluded from
the frozen-dataclass hash (
field(hash=False)) so dict-scoped specs stayhashable (stays in
__eq__).Profile._default_kwargs(target=None): now target-aware via the new_resolve_driver_keyhelper (None→None, str→all targets, dict→.get(target)).Adaptertype alias (Callable[[Profile, dict], dict], 2-arg compose) +_UNSETsentinel, exported frommountainash_settingsandmountainash_settings.profiles.Profile.__adapters__: per-target adapter map ({target: Adapter}). Thelegacy 1-arg
__adapter__(owns-pipeline) is retained, unchanged.Profile.emit(target=_UNSET, *, base=None): three-tier dispatch(
driver_keyrenames → per-target__adapters__2-arg → legacy__adapter__1-arg → merged), fail-closed targeting, shallow-copy of caller-owned
base.spec_invariants_for'stest_driver_keys_unique: rewritten to per-targetuniqueness (a dict
driver_keyis unhashable; the oldset()would crash oncea registry holds a scoped spec — which Phase 2's
AUTH_REGISTRYwill).Notes
emit()pseudocode conflated the new 2-argadapters with the legacy 1-arg
__adapter__; this implements the correctedsplit dispatch (also patched back into the spec).
Nonetarget on a target-scoped profile wasbypassing the unknown-target guard and silently emitting
{}. Fixed to failclosed unless
Noneis a registered target — matching the spec's emissionsafety contract. Covered by
test_targeted_profile_explicit_none_target_raises.Testing
hatch run test:test— 441 passed (8 new test classes intests/unit/profiles/test_emit.py; existing suite unchanged).hatch run ruff:check src tests— clean.Implemented via subagent-driven development from
docs/superpowers/plans/2026-06-12-unified-emission-phase1-settings.md(Codex-accepted plan); every task TDD'd and reviewed.
🤖 Generated with Claude Code