Repository navigation
Conversation
Installing a provider never makes it the default: dispatch now serves a provider only when it is explicitly enabled (AITER_PLUGIN_ENABLE) or forced (AITER_PLUGIN_FORCE). This makes the ownership boundary concrete: AITER owns the op contract and execution rules, providers own their kernels and qualification evidence, frameworks and users own enablement. - document the ownership boundary in the module docstring - isolate invalid candidates returned by select(): fall back to native with reason "invalid-candidate" instead of raising AttributeError - document that entry points must target an instance or zero-arg factory - tests: installed-but-not-enabled is inert (select never called); non-candidate select() results fall back to native Co-Authored-By: Claude Code <[email protected]>
Dispatch read four environment variables per call and rebuilt a set and a frozenset each time, costing 2.49us of the hot path (measured). It also stored enabled providers in a frozenset, which destroyed the enable list order, so candidates were tried in alphabetical provider-name order instead of the configured preference order. Configuration is now an immutable snapshot built at first dispatch. Dispatch reads one reference per call, so a call always runs against exactly one generation; configure() and reload_config() build a new snapshot and swap the reference under the config lock, leaving the hot path lock-free. Measured cost of the gates drops to 0.048us. The eligible provider list is cached per (op, config generation), get-or-build, and a build race is benign. enabled is now an ordered tuple and the eligible list is built by walking it, so the enable list order is the preference order it was specified to be. Also: - configure(*, source, enable, disable): source is required provenance; enable replaces the previous framework default, disable unions with the user's. All keyword-only, since a required parameter cannot follow a defaulted one. - reload_config() re-reads the environment deliberately. Mid-process changes are not otherwise observed. - A reload producing an identical snapshot does not bump the generation; a no-op bump would flush the eligible cache and churn provider resources. - An empty environment value counts as unset, so AITER_PLUGIN_ENABLE="" falls through to the framework default rather than denying everything. test_provider_arbitration_is_deterministic asserted that alpha wins from "alpha, zebra" -- alphabetical order already produced that, so the test passed against the bug. It is replaced by a case whose enable order contradicts alphabetical order. Co-Authored-By: Claude Code <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
Part 1 of a series implementing the dispatch design behind RFC #7240. Each part
is reviewable on its own; together they close the RFC's first milestone, whose
bar is that hot-path cost is measured, not designed.
configure()/reload_config()Decision.config_sourcestatus,explain,decision_counts,on_decision)Stacks on #7086 — its two commits appear in this diff because the prototype
branch is not in this repository. Review the last commit only.
Both #7086 and #7123 are untouched.
What this changes
Configuration is snapshotted. Dispatch read four environment variables per
call and rebuilt a set and a frozenset each time. It now reads one immutable
snapshot reference, so a call always runs against exactly one generation.
configure()andreload_config()build a new snapshot and swap the referenceunder the config lock; the hot path stays lock-free. The eligible provider list
is cached per
(op, config generation), get-or-build, and a build race isbenign.
Measured, CPU-only, Xeon Platinum 8480C / Python 3.12.12, min of 9 x 200k:
The enable list order now decides. Enabled providers were kept in a
frozenset, which destroyed the order, so candidates were tried in alphabeticalprovider-name order rather than the configured preference order.
enabledis nowan ordered tuple and the eligible list is built by walking it.
test_provider_arbitration_is_deterministicasserted thatalphawins fromAITER_PLUGIN_ENABLE="alpha, zebra"— alphabetical order already produced that,so the test passed against the bug. It is replaced by a case whose enable order
contradicts alphabetical order.
New configuration API.
sourceis required provenance, so every route names an owner.enablereplaces the previous framework default;
disableunions with the user's, so aframework opt-out and a user opt-out never cancel each other. All parameters are
keyword-only — a required parameter cannot follow a defaulted one.
Behaviour changes worth noting in review
reload_config()re-reads deliberately. Two existing tests changed environment variables
mid-test and expected immediate effect; they now call
reload_config(). Thisis the intended semantics, not a workaround — a new test pins it from both
sides.
no-op bump would flush the eligible cache, spend a route-change scan per op,
and churn provider resources for nothing.
AITER_PLUGIN_ENABLE=""falls through to the framework default instead of denying everything. The way
to deny everything is
AITER_PLUGINS=0.Testing
pytest -q tests/test_plugin.py— 20 passed (12 existing, 8 added). CPU-only,no GPU required.
black --checkandruff checkclean.🤖 Generated with Claude Code