Skip to content

refactor(runtime): own provider-device admission behind a typed capability - #2556

Merged
thymikee merged 1 commit into
t3code/daemon-package-extractionfrom
refactor/provider-device-admission
Sep 13, 2026
Merged

refactor(runtime): own provider-device admission behind a typed capability#2556
thymikee merged 1 commit into
t3code/daemon-package-extractionfrom
refactor/provider-device-admission

Conversation

@thymikee

@thymikee thymikee commented Sep 13, 2026

Copy link
Copy Markdown
Member

What

Gives the daemon its own typed capability for the one provider-runtime fact it decides on, so the daemon zone stops importing src/provider-device-runtime.ts from ten sites (#2541).

src/daemon/provider-device-admission.ts declares ProviderDeviceAdmission — one method, isActive(device) — defaults to the no-provider state every un-composed process already sees, and is installed by root composition at the site that already composes the provider request providers (src/daemon/server/daemon-runtime.ts). The predicate keeps its name, its per-call read, and the request-scoped ALS behaviour underneath it; the ten leaf call sites change only their import specifier.

Why a capability and not a re-export

A re-export would keep the same edge under a different filename. The seam is the point: the daemon names the fact it needs, root names where it comes from, and R76 now has exactly one daemon edge to that hub to classify (see the stacked gate PR).

Measured

before after
daemon production sites importing src/provider-device-runtime.ts 11 (10 leaves + the runtime composition) 1 (the composition only)
src/** production edges into that hub 12 pairs 2 pairs

The two remaining pairs are src/daemon/server/daemon-runtime.ts -> src/provider-device-runtime.ts (root composition, now classified in the R76 inventory) and src/core/interactors.ts -> src/provider-device-runtime.ts. src/core/interactors.ts keeps its edge: it also needs getProviderDeviceInteractor and sits below the daemon, so it cannot consume the daemon's seam. It is reached from the daemon only through the dynamic interactor lookup, which is now visible and classified with its own deepening issue (#2555).

Test seams

Nine daemon test files and the provider-scenario integration harness drive provider ownership through the root ambient scope. They now compose the admission the way daemon-runtime.ts does — one installProviderDeviceAdmission({ isActive: isActiveProviderDevice }) — instead of relying on the daemon reading root internals. Two vi.mock call sites retarget to the daemon module.

Validation

  • pnpm test:unit — 1,282 files, 9,872 tests passed
  • pnpm check:layering — OK (R76 inventory with the widened predicate on the stacked tip)
  • npx vitest run test/integration/provider-scenarios — 66 files, 209 tests passed
  • pnpm check:affected --run — all slices pass except mutation-model, whose scripts/mutation/ownership.test.ts "a kernel is owned by tests that reach it indirectly" failure reproduces identically on unmodified origin/main (3394d5b)

Part of #2541 (the src/core/interactors.ts edge and the interactor seam remain).

…ility

Ten daemon files imported isActiveProviderDevice from src/provider-device-runtime.ts,
so the daemon read provider runtime ownership mechanics directly from twelve sites
(ten daemon, one daemon runtime composition, one src/core).

The daemon now consumes a named capability: src/daemon/provider-device-admission.ts
declares ProviderDeviceAdmission with the one fact the daemon decides on, defaults to
the no-provider state every un-composed process already sees, and is installed by root
composition where the provider request providers are already composed. The ten leaf
call sites change only their import specifier; the predicate keeps its name, its
per-call read, and the request-scoped ALS behaviour underneath it.

src/core/interactors.ts keeps its edge: it also needs getProviderDeviceInteractor and
sits below the daemon, so it cannot consume the daemon's seam.

Part of #2541
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.52 MB 4.52 MB -119 B
Package (unpacked) 4.52 MB 4.52 MB -119 B
Package (download) 1.33 MB 1.33 MB -2 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.9 ms 26.9 ms -0.1 ms
CLI --help 74.3 ms 74.7 ms +0.4 ms

@thymikee

Copy link
Copy Markdown
Member Author

No actionable findings on 32266c4. The composed delegate preserves per-call request-scoped ownership, and the router-level provider test covers the affected behavior. The remaining interactor seam is explicitly deferred to #2555. Current checks pass and there are no conflicts; ready for human review, with #2548 first in the merge order.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 13, 2026
@thymikee
thymikee merged commit b790279 into main Sep 13, 2026
18 checks passed
@thymikee
thymikee deleted the refactor/provider-device-admission branch September 13, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant