Skip to content

Complete the hoist inside kernel: Completion imports, platform-bridge retags, affinity dispatch (D1/D2) #6

Description

@coenttb

Problem

Full-tier run 30615499446 at cf4875c fails on every platform leg with four kernel-owned defect classes (adjudicated dispositions from the 2026-07-31 migration-completeness audit: D1 — the unified vocabulary attaches on Windows too, no os-gating; D2 — the affinity kind-switch lives kernel-side only; platform apply surfaces are deleted by their owners):

  1. Completion → Event visibility. Sources/Kernel Completion/Kernel.Completion.Submission.Opcode.swift:101:43: 'Event' is not a member type (+ Equatable/Hashable synthesis failures at 34:17). Kernel.Event.Interest moved into the Kernel Event target at the hoist; Kernel Completion declares no dependency on it.
  2. Kqueue ID retag. Sources/Kernel Event/Kernel.Event.Source+Kqueue.swift:66/76: cannot convert 'Kernel.Event.ID' (Tagged<POSIX.Kernel.Event, UInt>) to 'Darwin.Kernel.Event.ID' (Tagged<Darwin.Kernel.Event, UInt>) — the re-anchored Darwin.Kernel.Event.Queue is a distinct nominal ID space.
  3. Bare mechanism references. Kernel.File.Clone+CrossPlatform.swift:75/134 'Clonefile', :145/211 'Copyfile' not in scope on macOS branches; the Linux branches' bare Ficlone/CopyRange are the same class. Post-re-anchoring homes: Darwin.Kernel.File.Clone.{Clonefile,Copyfile} (swift-darwin-standard, Darwin Kernel Standard/Darwin.Kernel.File.Clone.swift:195/198) and Linux.Kernel.File.Clone.{Ficlone,CopyRange} (swift-linux-standard, Linux Kernel File Standard/Linux.Kernel.File.Clone.swift:85/132).
  4. Affinity dispatch. Kernel.Thread.Affinity+Policy.swift:63 calls Linux.Thread.Affinity.apply(affinity) and :75 calls Windows.Kernel.Thread.Affinity.apply(affinity) — both platform surfaces are deleted by their owners per D2 (Delete the ISO-vocabulary-typed thread-affinity apply surface (hoist completion, D2) swift-linux#4, Split Windows.Kernel.File and Windows.Kernel.Thread into distinct policy namespaces (posix#1 mirror) swift-windows#2); kernel's new vocabulary can never satisfy them.

Proposed outcome

  • Kernel Completion adds a dependency on Kernel Event (acyclic) and the Opcode file imports it; Equatable/Hashable synthesis compiles on all POSIX legs.
  • The kqueue backend converts at the bridge boundary in both directions with typed-index retagging (.retag): every Kernel.Kqueue.Event construction passes Darwin.Kernel.Event.ID, every poll translation returns kernel's Kernel.Event.ID. No public vocabulary signature changes.
  • Kernel.File.Clone+CrossPlatform.swift fully qualifies the platform mechanisms (Darwin.Kernel.File.Clone.Clonefile/.Copyfile; Linux.Kernel.File.Clone.Ficlone/.CopyRange) with per-file platform imports following the realized precedent in Kernel.Event.Source+Kqueue.swift.
  • Kernel.Thread.Affinity+Policy.swift performs the kind-switch itself on every platform: .coresLinux.Kernel.Thread.Affinity.setMask(cores:) / Windows.32.Kernel.Thread.Affinity.setMask(cores:); .numaNode → resolve node→cpus via the platform System.Topology.NUMA.discover() surface then setMask(cores:), .invalidNode on lookup failure — the exact bodies of the two deleted platform apply functions, relocated behind kernel's own typed-throw error mapping. Add the platform product/target dependencies these branches need; update the stale dispatch commentary in Sources/Kernel Thread/exports.swift:19.
  • Typed-throws discipline unchanged throughout (per-operation leaf errors; no try? on typed-throwing callees).
  • Observable: push-triggered full-tier CI at the landing head green on macOS/iOS/tvOS/watchOS/visionOS, Ubuntu 6.3 release, and Windows 6.3 debug (assertions leg unweakened), docs leg passing — the ruling's required fresh-build proof that no platform-L2 mechanism signature requires a unified vocabulary type. Residual nightly-only redness attributable centrally, named in a closing comment.

Sequencing

Wave 2. Depends on swift-foundations/swift-linux#4 and swift-foundations/swift-windows#2 on their mains. Companion: #5's residual (see its amendment comment) lands in the same push or immediately after; both close before swift-iso/swift-iso-9945#65 starts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions