Repository navigation
feat(dpr): provider-only policy target — strict single-subscription routing (#351) - #352
Conversation
…outing (#351) Opt-in DPR card target '🛰 Только <provider>' (PROVIDER:<name>): RULE-SET goes strictly to a provider-only url-test group (use: [chosen provider]); other subscriptions never enter the policy route. Engine receives a SELECT placeholder; applyDprProviderTargets post-patch rewrites the rule, sets empty-fallback REJECT (no-DIRECT #284), removes the unreachable NAME select only when unreferenced. Fail-closed: missing provider/group/rule, Sub Mode OFF, AWL — explicit build errors, no silent fallback. Provider options live in the dialer target registry; project persists PROVIDER:<name>. Tests: tests/dpr-provider-target.cjs (12 node), browser UI regression, mihomo -t parse-only contracts on pinned 1.19.31/1.19.33. SELECT semantics, GLOBAL, MATCH,GLOBAL and no-DIRECT contracts unchanged.
…owns rebuild (#351) CI run 42482521853 deterministic/browser: policyCardDom emitted provider options without the refresh marker, so registry updates left duplicate/ stale unmanaged options. All provider options now carry data-dpr-provider; refreshPolicyProviderOptions rebuilds them consistently. Test predicate for Sub Mode OFF corrected (expects exactly one honest missing-subscription slot).
…icies (#351) Mutate the current proxy-groups array in place; add regression proving both policies keep independent providers and remove both unreferenced SELECT groups.
Independent review + sync checkpoint — 08.11.2026
Merge: requires separate owner GO; keep Draft. Related #351 and VPS umbrella #278. |
…llback (#351) Block bare/whitespace-only PROVIDER: targets before they can be normalized into pooled SELECT. Add Node and browser regressions, and clarify that Mihomo empty-fallback covers empty groups, not proven all-unhealthy no-leak behavior.
…#351) Fail-closed malformed provider targets must reset the previous YAML validation result; UI and copy controls must show the failed build. Add browser regression for ERROR and disabled copy.
Independent safety review #351/#352 — bounded follow-up (08.11.2026)Current PR HEAD: Review findings/fixes after sync:
Evidence: On latest SHA Independent runtime/egress STOP scope: Next owner decision only after final exact-SHA CI and independent risk review. |
Final independent-review handoff — 08.11.2026 — exact SHA VERIFIEDPR #352 HEAD Latest full mandatory CI is GREEN on exactly this head:
Review fixes: (1) multiple provider-only policies no longer resurrect obsolete SELECT groups ( Outstanding runtime proof — explicitly NOT TESTED: provider A has nodes but all are unhealthy while provider B is healthy: prove no user-plane fallback to B or host DIRECT, including IPv4/IPv6 and cold-start. See #284 scoped netns follow-up and existing Draft #338 test lab; no real VPS tests. Upstream Verdict: Code/CI READY FOR OWNER REVIEW; NO live no-leak E2E verdict, NO release/deploy GO. Merge requires a separate explicit owner GO; PR remains Draft. |
Preserve strict provider routing and current RU/EN Builder; integrate both UI and CI test suites without changing generated runtime.
Integration after merge #354 (08.11.2026)
Boundary: subsequent edits to |
…338 Preserve provider-only DPR implementation, i18n UI and rootless lab guard CI. Review and retest at resulting exact SHA before any merge.
Integration checkpoint after merged #338 — 2026-11-09PR #352 remains OPEN DRAFT; new HEAD A clean exact-diff transplant preserved six DPR files only:
Next: await exact-head CI; decide separately whether to merge #352. On merge, reconstruct #360 to contain only its own DPR scenario files and rerun exact-SHA CI. |
Independent exact-SHA CI completion checkpoint — 2026-11-09Read-only recheck of current Draft PR #352 (no new commit, no merge):
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3da32d06fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!Object.prototype.hasOwnProperty.call(providers, provider)) { | ||
| throw new Error('Provider-цель политики «' + name + '»: подписка «' + provider + '» отсутствует в proxy-providers — измените выбор цели или пересоберите с актуальными подписками'); |
There was a problem hiding this comment.
Bind strict policy targets to stable subscription identities
When two subscriptions share a hostname, the stored provider name does not reliably identify the selected subscription. The runtime's computeProviderName() assigns hostname-based names and positional deduplication suffixes, so selecting PROVIDER:subs.example.invalid for /account-a and then removing that URL or moving /account-b before it silently retargets the policy to /account-b. I reproduced both cases against this commit: the existence check passes and the patched group uses the other subscription instead of rejecting the missing selection. Preserve a stable source-to-target binding across registry refreshes and project roundtrips, or require explicit reselection when the source behind a provider name changes.
Useful? React with 👍 / 👎.
Preserve existing 5 lab-only changes and merged #352; integrate main's CONTRIBUTING.md unchanged. No runtime or production change.
Актуальный integration/evidence snapshot — 09.11.2026
3da32d06fee5d570fba27dd133a5d122d588700b; Generator CI #42556285912 6/6 SUCCESS, provenance #42556285900 SUCCESS.4098c81c2dcf9758d661251f921c419d31f4d4a2; локальная изолированная netns runtime-матрица на 1.19.31 и 1.19.33: PASS (healthy A/B, all-unhealthy A, empty A, cold start, recovery и selftest leak detector), CI #42665476970 6/6 SUCCESS. Этот runtime PASS относится к синтетическому#352 + #360дереву, а не к полевому VPS или независимому прогону одного только feat(dpr): provider-only policy target — strict single-subscription routing (#351) #352.mainсодержит только 5 lab/test-only файлов → отдельный owner GO для test(dpr): netns runtime-proof — provider-only DPR при all-unhealthy A и живом B (#355) #360. Без merge/stable/release/Pages/FIELD в рамках данного snapshot.Что реализовано
Opt-in цель DPR-карточки «🛰 Только <provider> (строго одна подписка)» (#351): домены выбранной политики направляются строго через один указанный HTTP provider — правило
RULE-SETведёт в provider-onlyurl-test-группуNAME-AUTOсuse: [<выбранный provider>]. Другие подписки в маршруте политики не участвуют вовсе;MATCH,GLOBAL, GLOBAL-группа, SELECT/GLOBAL/REJECT-семантика и no-DIRECT-контракт #284 не изменены.Closes требования issue #351 в объёме P1-slice (не претендует на полную VPS V3 parity из #278).
SOURCE-GROUNDED GAP (воспроизведён синтетически)
Базовое состояние (test 1
tests/dpr-provider-target.cjs): в Sub Mode ONNAME-AUTOпулит все proxy-providers подписок:Это документированная SELECT-семантика, не дефект; #351 добавляет строгую альтернативу, не меняя дефолт.
Дизайн (минимальный, в существующей архитектуре)
PROVIDER:<имя подписки>— схема проекта ({name, domains, target} strings) не менялась; старые проекты совместимы.dialerTargetsCache(точные имена движка, включая суффиксы дедупликации) только при Sub Mode ON; обновляются живо (input/change-диспетчер); исчезнувшая подписка отображается честно («подписка отсутствует — Build будет отклонён»), выбор не сбрасывается молча.NAME-AUTO+NAME+правило наNAME); пост-патчapplyDprProviderTargets(yaml, wanted)(маркеры DPT-START/END в index.html, тот же код в браузере и node-тестах) переписывает правило наNAME-AUTO, ставитuse:[provider]иempty-fallback: REJECT.proxy-providers;NAME-AUTOили RULE-SET-правило не найдено (контракт движка изменился);empty-fallback: REJECT; если узлы A существуют, но все unhealthy → в синтетической netns-лаборатории наблюдалась dial-ошибка/502 без egress через B/DIRECT (Mihomo 1.19.31/1.19.33, PR test(dpr): netns runtime-proof — provider-only DPR при all-unhealthy A и живом B (#355) #360), а не срабатываниеempty-fallback.NAMEselect-группа удаляется только при нулевых оставшихся ссылках (правила/члены групп/dialer-proxy); при наличии ссылок честно остаётся. Патч выполняется до Tiered/профиль-патчей; без PROVIDER-карт — байт-в-байт (OFF parity проверена).Тесты
tests/dpr-provider-target.cjs(node, 12 проверок): baseline-gap репродукция; строгоuse:[A], B отсутствует; mixed SELECT+PROVIDER; OFF byte-parity; 4 fail-closed; честное сохранение referenced select; слой-контракт (движок отвергает PROVIDER напрямую); GLOBAL untouched; отсутствие новых URL/токенов; hardening. Локально 12/12.tests/dpr-provider-target-browser.cjs(Playwright): UI-путь (опции реестра, выбор, Build VALID), проектный roundtripPROVIDER:<имя>, Sub Mode OFF (честное отображение + fail-closed), AWL fail-closed, живое обновление реестра; мониторинг pageerror + отсутствие не-CDN запросов.tests/dpr-provider-target-mihomo-compat.cjs(parse-onlymihomo -t, обе пиновые версии): baseline, provider-target, mixed PASS; negative integrity proof — dangling RULE-SET отвергается бинарём.CI
Обязательный прогон на pinned 1.19.31 и 1.19.33 — mihomo-compat job, оба PASS.
Per-check evidence на head
e7b63c5ea7fc66fe9e9b006534b030b419a3795f:tests/dpr-provider-target.cjs— 12 passed, 0 failed (deterministic/static+node);tests/dpr-provider-target-browser.cjs— 7 passed, 0 failed (deterministic/browser);tests/dpr-provider-target-mihomo-compat.cjs— 5 parse-only cases PASS на обеих пиновых версиях.История прогонов (честно): первый run 42482521853 на
3a5ff6a— deterministic/browser FAIL: 2 дефекта самой реализации (provider-опции карточек создавались без маркераdata-dpr-provider— refresh оставлял дубли/устаревшие опции; неверный тест-предикат). Исправлено вe7b63c5(«fix(dpr): mark all provider options with data-dpr-provider — refresh owns rebuild»); продуктовые job'ы (compat 1.19.31/1.19.33, static+node, owner UX) были зелёные уже на3a5ff6a. Итоговый PASS — наe7b63c5.Field / NOT TESTED (честные границы)
mihomo -t— не proof рантайм-отсутствия утечек: health/failover/manual override семантика provider-only группы покрыта контракт-тестами, но не рантайм-лабораторией на живом Mihomo (как в tiered-failover-runtime). UNCERTAIN: фактическое поведение при пустом provider (REJECT vs dial-failure) на pinned-версиях проверено только структурно (empty-fallback: REJECT— контракт движка P0: защитить VLESS/TUN клиентский egress от выхода с IP VPS; сохранить загрузку подписок #284, используемый всеми AUTO-группами).*.example.invalid, SYNTH-имена).main=e25b0e1a6c1e(SHA на момент подготовки, не постоянный).Merge только после отдельного owner GO.