Repository navigation
Conversation
…one server routes and SSD cache factory Add ProviderCore tests that need no model weights, no GPU work, no network beyond loopback and no writes under the home folder. Add three internal test seams to the background auto-update cycle: the updater, the launch baseline reader and the restart. Production passes none of them, so production behavior does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project d-inference with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
Two test files in the target had the same name, so the build failed with multiple producers for one object file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project eigen-homepages-darkbloom with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-landing with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-console-ui-dev with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
…space Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ripted launchctl Add two task-local test seams to LaunchctlControl: a launchctl runner and the home folder for agent paths. Production never binds them, so it still spawns /bin/launchctl and uses the real home folder. A task-local value is visible only to the test task that binds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in master through 1693685 and the updated coverage report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WatchdogAgent still reads the real home folder, so the comment no longer says "agent paths". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launchd child test, the daemon install test and the low-memory preflight test call `runForeground` and `launchDaemon` with the real home folder and the real launchctl. If a guard regressed, they could drain and stop a live provider on a developer Mac. The launchctl and home folder test seams come from #1296, which this branch does not have. The three tests move to a follow-up PR on #1296's branch, where they bind both seams. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Catch LaunchAgentError cases by pattern, share the auto-update cycle call, stop a model-load test when its waiter never parks, and name the suite and the weight-hash recorder after what they cover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Found 5 test failures on Blacksmith runners: Failures
|
…s-coverage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Consolidated into #1253 at cf08e55. Update recovery, loading, bookkeeping, standalone admission/drain, SSD factory, LaunchAgent and enclave-error objectives from f1e1748 are preserved. Lifecycle assertions now retain current master removal confirmation and error-37 rejection using virtual polling time. Closing this superseded stack PR; its source branch remains available. Final combined validation and human approval are tracked in #1253. Nothing has been merged into master. |
* test(provider): consolidate Swift coverage and lifecycle suites Combine #1253, #1273, #1275, #1292, #1293, #1294, #1295, #1296, #1303 and #1307 into one reviewable provider coverage change. Preserve coverage reporting and every CLI, fan, benchmark, serve-loop, update, model-loading and lifecycle test objective. Co-authored-by: David Tai <dtaipublic@gmail.com> * test(provider): isolate diagnostics and preserve launchd removal checks Adapt the consolidated lifecycle suite to confirmed launchd removal, supply synthetic report diagnostics, and characterize weighted coverage summaries. Document the combined test groups and safe local coverage workflow. The independent refactor pass preserves all source-stack test objectives. * docs: prepare required fixtures in provider coverage recipe --------- Co-authored-by: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com>
Summary
This PR adds 157
ProviderCoreTeststests for coverage gaps inProviderCore. The tests need no model weights, no GPU work, no network beyond 127.0.0.1, no launchd change, no Keychain or Secure Enclave write and no write under the home folder. They cover:ProviderLoop,LaunchAgentinstall, stop and restart against a scripted launchctl,PersistentEnclaveKey.The tests cover 800 more provider lines than the base (73,250 to 74,050 covered lines).
Merge after #1253 and #1273. This PR is based on
ci/provider-coverage-scope.Linked issue
None.
What the tests check
Tests/ProviderCoreTests/Update/AutoUpdateCycleTests.swift(14 tests). Each test uses a realProviderLoop, a temp install root (UpdateRecoveryFixture) and the loopbackMockCoordinator:auto_updateis true.Tests/ProviderCoreTests/Service/LaunchAgentLifecycleTests.swift(26 tests) andLaunchAgentPathsAndErrorsTests.swift(7 tests):RunAtLoad,KeepAlive,ExitTimeOut, log path, the full argv with config, models and local endpoint), then enables, bootstraps and kickstarts the service.kickstartIfLoadedand uninstall.notInstalled.Tests/ProviderCoreTests/KVCacheSSD/SSDPrefixCacheFactoryTests.swift(17 tests). Each test uses a temp root and an in-memory key:makerefusal reports exactly one reason: missing hash, unsupported plan, key unavailable, unsafe path, epoch unavailable.Tests/ProviderCoreTests/ProviderLoop/(50 tests; helpers inModelLoadingTestSupport.swift):ModelLoadRefusalTests:ensureModelLoadedchecks for shutdown and for a missing or unadvertised model (404). It also covers waits on the same model's load or unload, the load gate, the slot cap (503), memory refusals recorded fordoctor, the final admission check and the before-load hook. A changed Qwen4 footprint stops the load. After each failure, the test checks that the load holds nothing.ModelSlotBookkeepingTests: unload paths, warm state and weight-hash records.ModelLoadEvictionAndAdmissionTests: eviction, fast admission, the activation reserve push order, load error status codes and VLM detection.Tests/ProviderCoreTests/Server/(40 tests):StandaloneServerDrainTests: lifecycle drain outcomes (drained, timed out, forced, shared, replaced),drainAndStop, and start and stop (concurrent stop, a second start,/healthwhile draining).StandaloneServerModelAdmissionTests: catalog filter, config clamps, 404 and 429 error envelopes, tokenizer resolution and/tokenize,/metricssamples, slot reservations, LRU eviction, memory headroom gates, the fleet KV budget and weight-hash trimming.Tests/ProviderCoreTests/Security/PersistentEnclaveKeyErrorTests.swift(3 tests): the exact text of every error case.Production change to review
Two small test seams. Production does not use them, so production behavior does not change.
ProviderLoop+AutoUpdate.swift:performAutoUpdateCheckwasprivateand is nowinternal. It takes three optional trailing parameters: the updater, the launch-baseline reader and the restart. It returns its outcome (@discardableResult).prepareInstalledCandidateRestarttakes the baseline reader as a closure with the same default, so the baseline is still read only after the lease check. The production caller (startAutoUpdateMonitor) passes none of these.LaunchctlControl.swift: two@TaskLocalvalues,runnerForTestingandhomeDirectoryForTesting.LaunchAgent.plistPath()andlogPath()now read the home folder throughLaunchctlControl.homeDirectory(). With no task-local bound (production), the code spawns/bin/launchctland uses the real home folder as before. A task-local value is visible only to the task that binds it, so parallel tests cannot see each other's values. This follows the existing@TaskLocalpattern inLocalRequestCancellation.Coverage
Before: run 36780084216 (head of #1273). After: run 36818862397 (this PR, head
5b144441), artifactprovider-coverage.darkbloom)ProviderBenchmarkProviderLoop+AutoUpdate.swiftService/LaunchAgent.swiftService/LaunchctlControl.swiftKVCacheSSD/SSDPrefixCacheFactory.swiftSecurity/PersistentEnclaveKey.swiftSecurity/PersistentEnclaveKey+ECIES.swiftServer/StandaloneServer.swiftServer/StandaloneServer+Drain.swiftProviderLoop+ModelLoading.swiftNot tested and why
PersistentEnclaveKeyload, create, sign, delete and the ECIES extension: every path calls the real Secure Enclave or the Keychain, and the private initializer needs a realSecKey. Only the error text is tested.ProviderLoop.ensureModelLoadedandStandaloneServer.ensureModelLoadedafter the weights load: it needs a real model container, and the post-load KV headroom checks measure the real machine memory, so the results would depend on the runner.SSDPrefixCacheFactory.stopWholeRootMaintenance()reads the process environment, so a test would act on the real cache root. The key-load failure branch ofmakeneeds the Keychain.commitFailedanddrainTimedOutoutcomes: the cycle gives no hook between stage and commit, and the drain deadline is 120 seconds.Test plan
make docs-impact-check BASE=origin/masterandmake docs-checkComponents touched
Protocol / interface changes
Documentation impact
Diagrams
Behavior (what is tested):
flowchart LR subgraph Before T1[tests] -.no test.-> U1["auto-update cycle"] T1 -.no test.-> L1["LaunchAgent install / stop / restart"] T1 -.no test.-> F1["SSD cache factory make()"] end subgraph After T2[AutoUpdateCycleTests] --> U2["ProviderLoop.performAutoUpdateCheck"] U2 <-->|"http 127.0.0.1"| M2[MockCoordinator release] U2 --> R2["temp install root: stage, commit, candidate"] T3[LaunchAgentLifecycleTests] --> L2["LaunchAgent"] --> S3["scripted launchctl + temp home"] T4[SSDPrefixCacheFactoryTests] --> F2["make() on a temp root, in-memory key"] T5["ModelLoad / StandaloneServer tests"] --> E5["refusals, drains, eviction, admission"] end classDef old fill:#f5d5d5,stroke:#8a1c1c,color:#1a1a1a classDef new fill:#d5ecd5,stroke:#1c6b1c,color:#1a1a1a class U1,L1,F1 old class U2,L2,F2,E5,R2,S3 newCode (the seams):
flowchart TD subgraph Before A1["performAutoUpdateCheck (private)"] --> B1["SelfUpdater for the running install"] A1 --> C1["LaunchAgent.launchSnapshot()"] A1 --> D1["ProcessLifecycle.restartAfterUpdate()"] E1["LaunchctlControl.runThrowing"] --> P1["/bin/launchctl"] H1["LaunchAgent.plistPath()"] --> K1["real home folder"] end subgraph After A2["performAutoUpdateCheck (internal)"] --> Q2{"argument passed?"} Q2 -->|"no, production"| B2["same updater, snapshot and restart as before"] Q2 -->|"yes, tests"| T2["temp updater, fixed snapshot, recorded restart"] E2["LaunchctlControl.runThrowing"] --> Q3{"runnerForTesting bound?"} Q3 -->|"no, production"| P2["/bin/launchctl"] Q3 -->|"yes, test task"| S2["scripted output"] H2["LaunchAgent.plistPath()"] --> Q4{"homeDirectoryForTesting bound?"} Q4 -->|"no, production"| K2["real home folder"] Q4 -->|"yes, test task"| K3["temp folder"] end classDef prod fill:#dde6f5,stroke:#1c3d8a,color:#1a1a1a classDef test fill:#f5ecd5,stroke:#8a6a1c,color:#1a1a1a class B1,C1,D1,P1,K1,B2,P2,K2 prod class T2,S2,K3 testNotes for reviewers
BenchmarkingSPI import. Two follow-up commits fix these.🤖 Generated with Claude Code
Refactor Pass
A dedicated refactor subagent reviewed the diff against the
AGENTS.mdstructure, clean-code and refactor rules. Outcome: one test-only commit, aef4240 (6 files, +55 / −113), plus a signed merge of the refactored base #1273 (a1ff283).ModelLoadEvictionAndAdmissionTests.swift: the type name now matches the file name.LaunchAgentLifecycleTests.swift(9 places) andLaunchAgentPathsAndErrorsTests.swift(1 place): direct pattern catches, such ascatch LaunchAgentError.bootstrapFailed(let detail), replacecatch let error as … { guard case … }. A wrong error case still fails the test.AutoUpdateCycleTests.swift: a privaterunAutoUpdateCycle(...)helper replaces 8 copies of the sameperformAutoUpdateCheckcall. Each test still passes its own restart closure.ModelLoadRefusalTests.swift:try #require(parked)replaces#expect(parked)in 9 places. A waiter that never parks now fails at that line and can no longer hang.StandaloneServerModelAdmissionTests.swift:AdmissionCallRecorderis nowWeightHashCallRecorder, because it records only weight-hash calls.Validation on the final tree:
swift build --build-tests, thenswift test --filteron the PR's suites, passes (157 tests in 15 suites).git diff --check,make docs-impact-check BASE=ci/provider-coverage-scopeandmake docs-check(330 OK) also pass.For the author:
performAutoUpdateCheckinjection,LaunchctlControl.runnerForTestingandhomeDirectoryForTesting) stay. The real paths call launchd and wait 5 minutes.StandaloneServerDrainTeststests wait with sleeps (200 ms, 200 ms, 50 ms). They do not prove that the join or wait path ran, and the same file uses#expect(draining)after its polls.scripts/stage-test-metallib.shlooks only for*PackageTests.xctest. Swift 6.4 builds one bundle per target (ProviderCoreTests.xctest), so the script stops with "test runner bundle not found".Port to master, merge f1e1748 (follow-up): merged the ported #1273 (542c8fc), which carries master. The merge was clean. The three production files and the test folders are unchanged on master, and the test seams compile. A clean
swift build --build-testspasses, and the 15 suites pass (157 tests, with the metallib copied by hand until #1346 lands).docs-impact-checkpasses, anddocs-checkshows only master's known failure.