mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #30] [MERGED] test: enforce SDK import boundary in-repo under swift test #31
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-swift-sdk#31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-swift-sdk/pull/30
Author: @mattmillerai
Created: 7/4/2026
Status: ✅ Merged
Merged: 7/5/2026
Merged by: @mattmillerai
Base:
main← Head:matt/be-2358-import-boundary-test📝 Commits (2)
98e37dbtest: enforce SDK import boundary in-repo under swift test252852etest(import-boundary): close import-parser evasion + false-positive gaps📊 Changes
2 files changed (+533 additions, -0 deletions)
View changed files
📝
README.md(+1 -0)➕
Tests/ComfySwiftSDKTests/ImportBoundaryTests.swift(+532 -0)📄 Description
ELI-5
The SDK is supposed to stay tiny and UI-free — it should only ever import
Foundation,CryptoKit, andos, and never a UI framework likeSwiftUI/SwiftData(orPhotos/Security). A single strayimport SwiftUIslipping into a source file would silently pull a whole UI runtime into the SDK and break the "reusable anywhere" promise. This adds a test that reads the SDK's own source files and fails the build if any forbidden import shows up — so the rule is enforced automatically on every PR.What this does
Adds
Tests/ComfySwiftSDKTests/ImportBoundaryTests.swift, a Swift Testing suite that:.swiftfile underSources/ComfySwiftSDK/(located via the#filePathanchor, climbing to the package root — no simulator, no DerivedData walk).SwiftUI,SwiftData,Photos, orSecurity(four denylist tests).{Foundation, CryptoKit, os}— catching future drift like an accidentalimport Combine/UIKit/Networkthe denylist would miss.The import parser is ported from the app-side enforcement and handles attributed imports (
@_implementationOnly/@_exported/@preconcurrency/@testable), scoped imports (import struct Foundation.Date), trailing;///comments, and theimportword boundary — comparing module names, never raw line text.Why
This enforcement previously lived (CI-skipped) in the app's simulator test host. Moving it here runs it under the package's existing
swift test --no-parallelCI, where the sources are definitionally present and no simulator/DerivedData machinery is needed. No workflow change is required — the existing test step picks it up automatically.Testing
swift test --no-parallelpasses (156 tests, 21 suites), including the 6 new boundary tests — current sources import onlyFoundation/CryptoKit/os.import SwiftUIto a source file failed both theSwiftUIdenylist test and the allowlist test, then reverted cleanly.Notes
Sources/.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.