Skip to content

Use SystemPath for PluginConfig#23

Open
chrisgeo wants to merge 1 commit into
mainfrom
feat/chaos-1458-plugin-config
Open

Use SystemPath for PluginConfig#23
chrisgeo wants to merge 1 commit into
mainfrom
feat/chaos-1458-plugin-config

Conversation

@chrisgeo

@chrisgeo chrisgeo commented May 8, 2026

Copy link
Copy Markdown

Summary

Converts PluginConfig.init from URL to SystemPackage.FilePath, following the established migration pattern (apple#1480, apple#1518).

Changes

  • PluginConfig.init?(configURL: URL) throwsinit?(configPath: FilePath) throws
  • DefaultPluginFactory.findConfigURLfindConfigPath (return type URL?FilePath?)
  • Both internal call sites updated (DefaultPluginFactory, AppBundlePluginFactory)
  • configPath.extension (FilePath, String?) replaces configURL.pathExtension

Optional handling

FilePath.extension returns String? while URL.pathExtension returns String. The switch configPath.extension arms (case "toml", case "json") only match the non-nil cases; nil falls through to default: return nil. Safe by construction — and the nil case is unreachable in practice since findConfigPath only returns paths for config.toml or config.json.

Out of scope (deliberately)

  • findConfigPath still takes directory: URL (not FilePath). The directory comes from FileManager.contentsOfDirectory which produces URL, and broader PluginFactory conversion is tracked separately as CHAOS-1464. The bridge from URL → FilePath happens at the return point only.
  • Plugin.binaryURL: URL and Plugin.resourceURL: URL? unchanged — they're passed directly to Process.executableURL (Foundation requires URL).

Wire format

PluginConfig is Codable but is only ever decoded from on-disk TOML/JSON config files (read-only). Plugin (which embeds PluginConfig) is encoded for XPC, but Plugin's stored properties are unchanged by this PR. No wire-format break.

Context

Test plan

  • swift test --filter PluginConfigTest — 4/4 tests pass
  • swift test --filter ContainerPluginTests — 28/28 tests pass (5 suites)
  • swift-format strict lint clean

@linear

linear Bot commented May 8, 2026

Copy link
Copy Markdown

CHAOS-1458

@chrisgeo chrisgeo force-pushed the feat/chaos-1458-plugin-config branch 2 times, most recently from 83e1062 to 07c10a8 Compare May 13, 2026 01:11
Convert PluginConfig.init from URL to FilePath, following the migration
pattern from apple#1480 (HostDNSResolver), apple#1518 (PacketFilter), and
discussion apple#1481.

- PluginConfig.init?(configURL: URL) → init?(configPath: FilePath)
- DefaultPluginFactory.findConfigURL → findConfigPath (returns FilePath?)
- Both internal call sites (DefaultPluginFactory, AppBundlePluginFactory)
  updated; bridge from URL to FilePath stays at the directory boundary
  since broader PluginFactory conversion is tracked separately.
- Tests updated to derive FilePath from temp URL.
@chrisgeo chrisgeo force-pushed the feat/chaos-1458-plugin-config branch from 07c10a8 to 3bdfaab Compare May 24, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant