refactor(platform): let optional platform families be absent
Summary
Families are declared in one partition and every consumer answers presence from one registry (packages/contracts/src/platform-module.ts). Required: apple, android. Optional: harmonyos, vega, linux, web. 32 files. No linked issue; no scope beyond this PR's review round.
PlatformModuleRegistry.get() on an absent optional family is the single "not installed" answer: UNSUPPORTED_PLATFORM, details.reason: 'plugin-not-installed', the package, its pluginInstallCommand, and a hint.
| Consumer | Change |
|---|---|
src/core/platform-plugin-registry.ts | registerPlatformPluginSet(plugins, reportAbsent) owns the absence reporter as one input for the set and rejects a duplicate before any state change. getPlugin existed; its absent-family answer is now that reporter's typed outcome, not a plain unsupported error. tryGetPlugin, registeredPlatforms unchanged |
src/core/interactors/register-builtins.ts | registerBuiltinPlatformPlugins(reportAbsent) composes the builtin set in one call, so no plugin carries an absence policy |
src/platform-runtime-gateway.ts | modules is a PlatformModuleRegistry; dropped the missing-module contract error and module.family !== family guard |
src/platform-runtime/request-providers.ts | platformGatedResolverApplies stays a non-throwing predicate |
packages/device-selection | composed-inventory-gateways.ts unchanged: unfiltered discovery already swallows a per-family failure, an explicit request propagates registry.get's outcome; tests pass coreVersion |
src/daemon-composition.ts, src/platform-runtime-claim-recovery.ts | pass coreVersion: readVersion() |
src/commands/provider-plugin-catalog.ts | delegates the release-channel rule to contracts/platform-module.ts; no new exports subpath |
Validation
pnpm check:affected --run --base origin/0.22 --head ca65654ec → exit 0, exactCommit: true (receipt .tmp/validation/run-BvMvAX/receipt.json): format, lint, typecheck, layering, fallow, build, integration-node (155 passed, 13 skipped), vitest-related (97 files, 441 tests), unit (2202 files, 21347 passed, 10 skipped).
CI owns the parked replay-* and authoritative smoke lanes. Hosted Mutants and tvOS Runner Build are unrelated (fixed in #4782). No packed build ships an absent family yet, so the outcome is proven by unit and integration fixtures.