Repository navigation
Enforce routing policy on every dispatch and fix separate-mode discovery - #12
Merged
Merged
Conversation
added 4 commits
November 30, 2026 20:03
- Add migration v69 with a revision-triggered policy store for the discovery exposure mode, per-provider-model enablement, and metadata overrides. - Carry an immutable policy snapshot into each request through routing facts; an unreadable store fails the request closed instead of ignoring a disable. - Exclude disabled provider-model pairs in eligibility and project either consolidated or provider-qualified discovery ids. - Add the /routing/policy admin page and audited /admin/routing mutations with revert-by-delete; keep models.expose_mode parseable but inert. - Update the migration, route, module, and schema censuses, the runtime manifests, the architecture docs, and the changelog. - Verified with fmt, strict clippy, no-default check and clippy, both serial suites, the locked release build, release docs, and the tooling suite.
- Add the M001 closure record with the requirement-to-evidence matrix, the invariant, failure, migration, and security reviews, and four low findings. - Mark the milestone conditionally closed: end-to-end discovery, process restart, and revision-read timing remain named evidence gaps. - Update the roadmap milestone table and the registry subsystem and recently-closed rows to cite the closure and implementation 7f961dc.
- Read the catalog pair as (model_id, provider_id) in the discovery projection and the admin datalists, so separate mode advertises the provider-qualified ids the catalog holds instead of only virtual aliases. - Resolve one policy snapshot per request on chat, streaming, compact, and embeddings; share that Arc with the selector dispatch and the concrete routing facts, and refuse a selector pin the snapshot disables. - Show the stored input-token override, the effective upstream limit, and its source tag on the metadata page; report a row the catalog does not know as orphaned. - Correct the deep-dive sentence that claimed a repeated save writes no audit row, and record the two-guard enforcement and one-snapshot rule. - Add the acceptance evidence M001 claimed but did not execute: trigger matrix, failed-audit rollback, same-Arc identity, typed failure mapping, secret-free Debug, concurrent readers, candidate reason code, admin refusals for every mutation class, and a selection-boundary tooling guard. - Close routing policy and capacity Milestone 4 with the discovery, restart, and revision-read evidence M001 named as gaps. - Verified with fmt, strict clippy, no-default check and clippy, both serial suites, the focused routing targets, the locked release build, release docs, the tooling suite, and an isolated-home end-to-end run.
- Sort the imports and drop the redundant parentheses in the selection boundary test so it satisfies ruff format --check and ruff check, the two check-job steps the first CI run failed on. - Verified with ruff format --check, ruff check, pyright, and the full tooling suite (270 passed, 1 skipped).
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 this changes
M001 added the operator routing policy store, but an independent audit at
69247df7found the policy did not actually hold everywhere. This is the corrective pass, Milestone 4 of the routing policy and capacity subsystem.Fixed
(provider_id, model_id)while the producer emits(model_id, provider_id), so every real pair was dropped and only virtual aliases survived. The admin datalists were swapped the same way./v1/responses/compactnever captured the snapshot, so a configured disable did not apply and an unreadable store did not fail closed.input_tokenswas accepted and stored but never rendered, and no override showed what it departed from.Enforcement now
One immutable snapshot per request, resolved once during admission and shared by the selector dispatch and the concrete routing facts on chat, streaming, compact, and embeddings. Policy absence still inherits; an unreadable store fails every surface closed with
RoutingPolicyUnavailable(503). No schema change, no new configuration key, no wire change.Evidence
test result:lines, zero failures), locked release build.routing_policy12,routing_domain16,routing_fail_closed6,catalog_refresh7,on_prem_admin_ui15,gateway_audit2,routing_policy_enforcement5,embeddings_api4 (+1 ignored live qualification).RoutingPolicyServicereference underrust/src/routing/.demo-model, audited mode change, separatedemo-model/demo, audited disable to[]with chat 503, stop/start still[]and 503, re-enable restores the pair.Plan records
plans/implementation/routing-policy-capacity/004-policy-enforcement-and-projection-correction.mdplans/closure/routing-policy-capacity/004-status.md(Status: closed)Notes for review
GET /v1/modelsp50 0.4 ms over 200 loopback requests. The correction adds a snapshot read only to compact.