Transit branch T-2377/mcp-project-creation commits 0; working tree reviewed files 23 touched

Pre-push review: T-2377 MCP project creation

Local working-tree review against merge base 3c2c6c8; no new commits, push or publication.

At a glance

  • 1823 macOS unit tests passed; 0 failed, 0 skipped.
  • 1291 simulator tests passed: 1270 units + 21 UI; 0 failed, 0 skipped.
  • Preserved source-literal guard passes real source, positive fixture and four negative fixtures.
  • Ownership guard, strict SwiftLint (364 files) and git diff --check pass.
  • Exact personal pre-push-review workflow completed; publication explicitly omitted.

Verdict

Ready to push after committing

Four requested review roles found no remaining issues. One documentation wording finding was corrected. Native xcresult evidence confirms 1823 macOS unit tests and 1291 simulator tests passed, with no failures or skipped tests; CLI source guard and strict lint also pass. Changes remain local and uncommitted. The registry has no Xcode JUnit/coverage runner; no coverage is inferred.

Review findings

1 raised · 1 fixed · 0 skipped

Jump to findings →

Tests

Pass rate: n/a

New tests: 8

Diff coverage: n/a

Jump to tests →

Commits

Three-level explanation

An MCP client can now create a Transit project before adding its tasks. It supplies a name and a color, plus an optional description and repository. Transit checks those values, saves the project, and returns its ID and details. The client can use that ID in its next create_task call.

The Mac's current Xcode toolchain also needs a newer dependency and clearer concurrency declarations. These changes allow the app and its existing actor-based tests to compile with Swift 6.4.

The core tool inventory and dispatcher now expose create_project. The handler validates required/optional string types and whole-string six-digit ASCII hex colors, then delegates trimmed-name validation, case-insensitive duplicate detection and persistence to ProjectService. A shared metadata formatter keeps get_projects and creation results aligned; discovery still enriches projects with milestones.

The dependency update changes only AsyncAlgorithms to 1.1.3. CounterStore and CounterSnapshot explicitly opt out of the application's MainActor default and use checked Sendable. Two existing test actors move their protocol conformances into empty extensions to avoid a Swift 6.4 declaration-order diagnostic. Their methods and state remain unchanged. A source-literal guard now runs as CLI preflight for lint/test commands, while the runtime description test remains cross-platform; app test runners do not open host checkout paths.

Creation remains a synchronous MainActor service operation, so local uniqueness validation and saving have no suspension window. Storage fallback rejects the new mutation through the existing gate. Invalid optional values, including JSON null, are rejected rather than silently discarded. Color validation checks the full regex range to reject trailing newlines; the stored color's case and prefix are preserved. Optional repository values retain the existing free-form service contract.

The response includes a persisted UUID usable by create_task. Tests cover schema discovery, validation, duplicate/read failure, metadata parity, persistence and project-to-task integration. Save-failure cleanup remains covered by the shared persistence helper rather than a new handler-specific failure seam.

The compatibility change preserves production CloudKitCounterStore's MainActor isolation and existing allocator serialization, retries and compare-and-swap behavior. Normal-order compiler reproduction and Xcode MCP build-for-testing validate the conformance-placement workaround; final runtime outcomes are recorded in implementation.md. No publication or deployment is included.

Important changes — detailed

MCP schema exposes core project creation

Transit/Transit/MCP/MCPToolDefinitions.swift

Why it matters. Clients can create a project before creating its tasks.

What to look at. createProject and core tool inventory

Takeaway. Use the existing core inventory so discovery and mutation gating stay consistent.
Rationale. Public API contract specifies required name/colorHex and optional description/gitRepo.

Handler validates and persists through ProjectService

Transit/Transit/MCP/MCPToolHandler.swift

Why it matters. Reject malformed input and duplicates while returning persisted metadata and a reusable UUID.

What to look at. handleCreateProject; projectMetadataDict

Takeaway. Whole-string range checks reject trailing-newline regex matches. Share metadata formatting between creation and discovery.
Rationale. Reuse existing uniqueness and failed-save cleanup; preserve unrelated model edits.

Behavioral tests cover creation through subsequent task creation

Transit/TransitTests/MCPCreateProjectTests.swift

Why it matters. Contract, rejection, persistence, metadata parity and UUID-to-task integration are exercised.

What to look at. MCPCreateProjectTests

Takeaway. Verify a returned identifier by using it in the next real service operation.
Rationale. Canonical task requires created ID and metadata for subsequent task creation.

Counter boundaries support Swift 6.4 without changing actor executors

Transit/Transit/Services/DisplayIDAllocator.swift

Why it matters. Resolves verified baseline isolation failures and declaration-order diagnostics.

What to look at. CounterSnapshot; CounterStore; fixture conformance extensions

Takeaway. Use checked Sendable for immutable transfer values and explicit isolation for nested protocols.
Rationale. User explicitly requested Xcode 27 support; exact compiler probes verified the order-dependent workaround.

Host-source invariants run as CLI preflight

tests/validation/create_task_project_schema_guard.py

Why it matters. Both app test runners blocked opening a host source file; all assertions remain checked.

What to look at. validate; Makefile test-create-task-project-schema-guard

Takeaway. Keep repository-file assertions outside app-runtime sandboxes.
Rationale. Samples identified the blocking source read; lint and all Make test targets invoke the preserved guard.

One dependency pin removes Swift 6.4 sending-result failure

Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Why it matters. Both platform builds and complete tests pass without dependency-cache patches.

What to look at. swift-async-algorithms 1.1.3

Takeaway. Fix a verified dependency compatibility failure with the smallest released pin change.
Rationale. Keep other dependencies, toolchain and deployment targets unchanged.

Key decisions

MCP schema exposes core project creation

Public API contract specifies required name/colorHex and optional description/gitRepo.

Handler validates and persists through ProjectService

Reuse existing uniqueness and failed-save cleanup; preserve unrelated model edits.

Behavioral tests cover creation through subsequent task creation

Canonical task requires created ID and metadata for subsequent task creation.

Counter boundaries support Swift 6.4 without changing actor executors

User explicitly requested Xcode 27 support; exact compiler probes verified the order-dependent workaround.

Host-source invariants run as CLI preflight

Samples identified the blocking source read; lint and all Make test targets invoke the preserved guard.

One dependency pin removes Swift 6.4 sending-result failure

Keep other dependencies, toolchain and deployment targets unchanged.

Review findings

SeverityAreaFindingResolution
minorspecs/mcp-project-creation/explanation.mdCreation save-failure handling was described as rollback, but insertOrDelete deletes the inserted model and preserves unrelated edits.Changed wording to cleanup in the explanation and final implementation material.

Tests

Source: local run at 2026-10-02T08:35:14.522291+00:00 · snapshot 3c2c6c8de5f4b677934e50ea1d8a6e4b0337c900 (dirty working tree)

Baseline: none

Execution: not run · JUnit: none · Coverage: none · Baseline: absent

Coverage scope: every test in the repository

No test results

The test runner could not be detected.

New and removed tests

Derived by declaration name, from the diff (no baseline run).

Blast radius

Files that import a changed file on the left, changed files in the centre, files a changed file imports on the right. Snapshot working-tree against base 3c2c6c8de5f4b677934e50ea1d8a6e4b0337c900.

addedmodifieddeletedrenamedunchangedcollapsed package group or +N more⚑N test files with an edge to the node

Per-file diffs

23 files: 12 code · 10 docs · 1 other. Click to expand.

Code (12)

Makefile Modified +10 / -4
diff --git a/Makefile b/Makefileindex b8ba0e7..a899e55 100644--- a/Makefile+++ b/Makefile@@ -65,8 +65,14 @@ SWIFTLINT_CACHE = .swiftlint-cache test-model-container-ownership-guard: 	bash tests/validation/test_model_container_ownership_guard.sh +# App test runners cannot reliably read host checkout files. Keep source-literal+# validation in the repository process before linting or launching tests.+.PHONY: test-create-task-project-schema-guard+test-create-task-project-schema-guard:+	python3 tests/validation/create_task_project_schema_guard.py+ .PHONY: lint-lint: test-model-container-ownership-guard+lint: test-model-container-ownership-guard test-create-task-project-schema-guard 	swiftlint lint --strict --cache-path $(SWIFTLINT_CACHE)  .PHONY: lint-fix@@ -137,7 +143,7 @@ build: build-ios build-macos  # Testing .PHONY: test-quick-test-quick: prepare-cache-dirs+test-quick: prepare-cache-dirs test-create-task-project-schema-guard 	$(PIPEFAIL) $(XCODEBUILD_ENV) xcodebuild test \ 		-project $(PROJECT) \ 		-scheme $(SCHEME) \@@ -148,7 +154,7 @@ test-quick: prepare-cache-dirs 		$(PIPE_PRETTY)  .PHONY: test-test: prepare-cache-dirs+test: prepare-cache-dirs test-create-task-project-schema-guard 	$(PIPEFAIL) $(XCODEBUILD_ENV) xcodebuild test \ 		-project $(PROJECT) \ 		-scheme $(SCHEME) \@@ -160,7 +166,7 @@ test: prepare-cache-dirs 		$(PIPE_PRETTY)  .PHONY: test-ui-test-ui: prepare-cache-dirs+test-ui: prepare-cache-dirs test-create-task-project-schema-guard 	$(PIPEFAIL) $(XCODEBUILD_ENV) xcodebuild test \ 		-project $(PROJECT) \ 		-scheme $(SCHEME) \
Transit/Transit/MCP/MCPToolDefinitions.swift Modified +16 / -1
diff --git a/Transit/Transit/MCP/MCPToolDefinitions.swift b/Transit/Transit/MCP/MCPToolDefinitions.swiftindex 2e3404f..500df1c 100644--- a/Transit/Transit/MCP/MCPToolDefinitions.swift+++ b/Transit/Transit/MCP/MCPToolDefinitions.swift@@ -4,7 +4,7 @@  nonisolated enum MCPToolDefinitions {     static let coreTools: [MCPToolDefinition] = [-        createTask, updateTaskStatus, queryTasks, addComment, getProjects,+        createTask, updateTaskStatus, queryTasks, addComment, getProjects, createProject,         createMilestone, queryMilestones, updateMilestone, deleteMilestone, updateTask     ] @@ -151,6 +151,21 @@ nonisolated enum MCPToolDefinitions {             required: ["content", "authorName"]         )     )++    static let createProject = MCPToolDefinition(+        name: "create_project",+        description: "Create a project. Returns projectId and metadata for subsequent task creation.",+        inputSchema: .object(+            properties: [+                "name": .string("Project name (required; trimmed, non-empty, case-insensitively unique)"),+                "colorHex": .string("Project color (required; six hexadecimal digits, optionally prefixed by #)"),+                "description": .string("Project description (optional, defaults to an empty string)"),+                "gitRepo": .string("Git repository URL or path (optional, free-form)")+            ],+            required: ["name", "colorHex"]+        )+    )+     static let getProjects = MCPToolDefinition(         name: "get_projects",         description: "List all projects with metadata. Returns an array of project objects sorted by name.",
Transit/Transit/MCP/MCPToolHandler.swift Modified +51 / -6
diff --git a/Transit/Transit/MCP/MCPToolHandler.swift b/Transit/Transit/MCP/MCPToolHandler.swiftindex ead2402..5e0c3b3 100644--- a/Transit/Transit/MCP/MCPToolHandler.swift+++ b/Transit/Transit/MCP/MCPToolHandler.swift@@ -293,6 +293,8 @@ final class MCPToolHandler {             result = handleQueryTasks(arguments)         case "add_comment":             result = handleAddComment(arguments)+        case "create_project":+            result = handleCreateProject(arguments)         case "get_projects":             result = handleGetProjects()         case "create_milestone":@@ -1186,6 +1188,54 @@ extension MCPToolHandler {  extension MCPToolHandler { +    private func handleCreateProject(_ args: [String: Any]) -> MCPToolResult {+        let name: String+        switch requiredString(args, key: "name") {+        case .success(let value): name = value+        case .failure(.message(let message)): return errorResult(message)+        }+        let colorHex: String+        switch requiredString(args, key: "colorHex") {+        case .success(let value): colorHex = value+        case .failure(.message(let message)): return errorResult(message)+        }+        // Compare the whole range: regex $ can also match before a final newline.+        guard let range = colorHex.range(of: "^#?[0-9A-Fa-f]{6}$", options: .regularExpression),+              range == colorHex.startIndex..<colorHex.endIndex else {+            return errorResult("Invalid colorHex: expected six hexadecimal digits, optionally prefixed by #")+        }+        for key in ["description", "gitRepo"] {+            if let raw = args[key], !(raw is String) {+                return errorResult("\(key) must be a string")+            }+        }+        do {+            let project = try projectService.createProject(+                name: name,+                description: args["description"] as? String ?? "",+                gitRepo: args["gitRepo"] as? String,+                colorHex: colorHex+            )+            return textResult(IntentHelpers.encodeJSON(projectMetadataDict(project)))+        } catch ProjectMutationError.invalidName {+            return errorResult("Project name must not be empty or whitespace-only")+        } catch ProjectMutationError.duplicateName(let name) {+            return errorResult("A project named \"\(name)\" already exists")+        } catch {+            return errorResult("Failed to create project: \(error)")+        }+    }++    private func projectMetadataDict(_ project: Project) -> [String: Any] {+        var dict: [String: Any] = [+            "projectId": project.id.uuidString, "name": project.name,+            "description": project.projectDescription, "colorHex": project.colorHex,+            "activeTaskCount": projectService.activeTaskCount(for: project)+        ]+        if let gitRepo = project.gitRepo { dict["gitRepo"] = gitRepo }+        return dict+    }+     private func handleGetProjects() -> MCPToolResult {         let projects: [Project]         do {@@ -1195,12 +1245,7 @@ extension MCPToolHandler {         }         var results: [[String: Any]] = []         for project in projects {-            var dict: [String: Any] = [-                "projectId": project.id.uuidString, "name": project.name,-                "description": project.projectDescription, "colorHex": project.colorHex,-                "activeTaskCount": projectService.activeTaskCount(for: project)-            ]-            if let gitRepo = project.gitRepo { dict["gitRepo"] = gitRepo }+            var dict = projectMetadataDict(project)              let milestones: [Milestone]             do {
Transit/Transit/Services/DisplayIDAllocator.swift Modified +3 / -3
diff --git a/Transit/Transit/Services/DisplayIDAllocator.swift b/Transit/Transit/Services/DisplayIDAllocator.swiftindex f762840..5c0b34c 100644--- a/Transit/Transit/Services/DisplayIDAllocator.swift+++ b/Transit/Transit/Services/DisplayIDAllocator.swift@@ -8,7 +8,7 @@ import SwiftData final class DisplayIDAllocator: @unchecked Sendable {      /// Snapshot of the counter state used for optimistic locking.-    struct CounterSnapshot {+    nonisolated struct CounterSnapshot: Sendable {         let nextDisplayID: Int         let changeTag: String?     }@@ -28,8 +28,8 @@ final class DisplayIDAllocator: @unchecked Sendable {         case usedIDLookupFailed(description: String)     } -    /// Abstracts the counter persistence so tests can inject an in-memory store.-    protocol CounterStore {+    /// Sendable counter persistence independent of MainActor, allowing actor-backed stores.+    nonisolated protocol CounterStore: Sendable {         func loadCounter() async throws -> CounterSnapshot         func saveCounter(nextDisplayID: Int, expectedChangeTag: String?) async throws     }
Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swift Modified +2 / -45
diff --git a/Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swift b/Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swiftindex bd9844f..d066e96 100644--- a/Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swift+++ b/Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swift@@ -28,51 +28,8 @@ struct CreateTaskProjectRequiredSchemaTests {         )     } -    /// Guards against drift between `inputParameterDescription` (which the tests-    /// inspect) and the `@Parameter(description:)` literal that App Intents-    /// actually uses. The macro requires a string literal, so both copies must-    /// be updated together — this test reads the source file and asserts the-    /// `@Parameter(description:)` block contains the same constraint phrase.-    @Test func intentParameterDescriptionMatchesStaticLiteral() throws {-        let sourcePath = Self.createTaskIntentSourcePath()-        let source = try String(contentsOf: sourcePath, encoding: .utf8)--        // Locate the @Parameter(...) block following the `title: "Input JSON"` marker-        // to scope the assertion to the input parameter (not unrelated text).-        guard let parameterRange = source.range(of: "title: \"Input JSON\"") else {-            Issue.record("Could not locate @Parameter(title: \"Input JSON\") in source")-            return-        }-        let parameterTail = source[parameterRange.upperBound...]-        guard let closing = parameterTail.range(of: "var input: String") else {-            Issue.record("Could not locate end of @Parameter block in source")-            return-        }-        let parameterBlock = String(parameterTail[..<closing.lowerBound])--        #expect(-            parameterBlock.lowercased().contains("at least one"),-            "@Parameter(description:) literal must state that at least one project identifier is required"-        )-        #expect(-            !parameterBlock.contains("Optional: \"projectId\""),-            "@Parameter(description:) literal still marks projectId as optional"-        )-    }--    private static func createTaskIntentSourcePath() -> URL {-        // #filePath points at this test file:-        //   .../Transit/TransitTests/CreateTaskProjectRequiredSchemaTests.swift-        // The intent lives at:-        //   .../Transit/Transit/Intents/CreateTaskIntent.swift-        let testFile = URL(fileURLWithPath: #filePath)-        return testFile-            .deletingLastPathComponent()        // TransitTests/-            .deletingLastPathComponent()        // Transit/ (project root)-            .appendingPathComponent("Transit")-            .appendingPathComponent("Intents")-            .appendingPathComponent("CreateTaskIntent.swift")-    }+    // Literal-drift validation runs in tests/validation/create_task_project_schema_guard.py.+    // App test runners must not synchronously open paths into the host checkout.      // MARK: - MCP create_task Tool Schema 
Transit/TransitTests/MCPFallbackStorageRejectionTests.swift Modified +1 / -0
diff --git a/Transit/TransitTests/MCPFallbackStorageRejectionTests.swift b/Transit/TransitTests/MCPFallbackStorageRejectionTests.swiftindex 5fee034..c77e1b5 100644--- a/Transit/TransitTests/MCPFallbackStorageRejectionTests.swift+++ b/Transit/TransitTests/MCPFallbackStorageRejectionTests.swift@@ -72,6 +72,7 @@ struct MCPFallbackStorageRejectionTests {     /// Read-only tools are deliberately absent — see `readToolsStillWork`.     private static func mutatingCalls() -> [(tool: String, args: [String: Any])] {         [+            ("create_project", ["name": "Doomed Project", "colorHex": "#123456"]),             ("create_task", ["name": "Doomed", "type": "bug", "project": "Fallback Project"]),             ("update_task_status", ["displayId": 1, "status": "in-progress"]),             ("update_task", ["displayId": 1, "priority": "high"]),
Transit/TransitTests/MCPMaintenanceHandlerTests.swift Modified +2 / -2
diff --git a/Transit/TransitTests/MCPMaintenanceHandlerTests.swift b/Transit/TransitTests/MCPMaintenanceHandlerTests.swiftindex b0aa0c8..499aef8 100644--- a/Transit/TransitTests/MCPMaintenanceHandlerTests.swift+++ b/Transit/TransitTests/MCPMaintenanceHandlerTests.swift@@ -21,7 +21,7 @@ struct MCPMaintenanceHandlerTests {         #expect(!names.contains("reassign_duplicate_display_ids"))         // Core tools still present.         #expect(names.contains("create_task"))-        #expect(names.count == 10)+        #expect(names.count == 11)     }      @Test func toolsListWithMaintenanceOnIncludesBothMaintenanceTools() async throws {@@ -33,7 +33,7 @@ struct MCPMaintenanceHandlerTests {          #expect(names.contains("scan_duplicate_display_ids"))         #expect(names.contains("reassign_duplicate_display_ids"))-        #expect(names.count == 12)+        #expect(names.count == 13)     }      @Test func toggleFlipReflectsImmediatelyInToolsList() async throws {
Transit/TransitTests/MCPMilestoneToolTests.swift Modified +1 / -1
diff --git a/Transit/TransitTests/MCPMilestoneToolTests.swift b/Transit/TransitTests/MCPMilestoneToolTests.swiftindex b7d429c..1782659 100644--- a/Transit/TransitTests/MCPMilestoneToolTests.swift+++ b/Transit/TransitTests/MCPMilestoneToolTests.swift@@ -26,7 +26,7 @@ struct MCPMilestoneToolTests {         #expect(names.contains("update_milestone"))         #expect(names.contains("delete_milestone"))         #expect(names.contains("update_task"))-        #expect(tools.count == 10)+        #expect(tools.count == 11)     }      // MARK: - create_milestone
Transit/TransitTests/MCPToolHandlerTests.swift Modified +1 / -1
diff --git a/Transit/TransitTests/MCPToolHandlerTests.swift b/Transit/TransitTests/MCPToolHandlerTests.swiftindex f988cbc..2eeb878 100644--- a/Transit/TransitTests/MCPToolHandlerTests.swift+++ b/Transit/TransitTests/MCPToolHandlerTests.swift@@ -43,7 +43,7 @@ struct MCPToolHandlerTests {         let result = try #require(json["result"] as? [String: Any])         let tools = try #require(result["tools"] as? [[String: Any]]) -        #expect(tools.count == 10)+        #expect(tools.count == 11)         let names = tools.compactMap { $0["name"] as? String }         #expect(names.contains("create_task"))         #expect(names.contains("update_task_status"))
Transit/TransitTests/TestModelContainer.swift Modified +7 / -2
diff --git a/Transit/TransitTests/TestModelContainer.swift b/Transit/TransitTests/TestModelContainer.swiftindex 725276d..a380989 100644--- a/Transit/TransitTests/TestModelContainer.swift+++ b/Transit/TransitTests/TestModelContainer.swift@@ -52,7 +52,7 @@ struct TestModelContainer {  /// An in-memory implementation of `DisplayIDAllocator.CounterStore` for tests. /// Supports queuing save outcomes to simulate conflicts and failures.-actor InMemoryCounterStore: DisplayIDAllocator.CounterStore {+actor InMemoryCounterStore {     enum SaveOutcome {         case success         case conflict@@ -130,7 +130,7 @@ actor InMemoryCounterStore: DisplayIDAllocator.CounterStore { /// Concurrency regressions use this to commit peer-context changes while an /// allocation is suspended, without relying on scheduler timing. A timeout /// makes changed counter-call sequences fail instead of wedging the test suite.-actor AllocationGatedCounterStore: DisplayIDAllocator.CounterStore {+actor AllocationGatedCounterStore {     private var nextDisplayID: Int     private var changeTag = 0     private var loadCount = 0@@ -183,3 +183,8 @@ actor AllocationGatedCounterStore: DisplayIDAllocator.CounterStore {         changeTag += 1     } }++// Swift 6.4 can reject inferred nonisolated modifiers when clients are checked+// before these actor declarations. Separate conformances avoid that order dependency.+extension InMemoryCounterStore: DisplayIDAllocator.CounterStore {}+extension AllocationGatedCounterStore: DisplayIDAllocator.CounterStore {}
Transit/TransitTests/MCPCreateProjectTests.swift Added +154 / -0
diff --git a/Transit/TransitTests/MCPCreateProjectTests.swift b/Transit/TransitTests/MCPCreateProjectTests.swiftnew file mode 100644index 0000000..f53dec3--- /dev/null+++ b/Transit/TransitTests/MCPCreateProjectTests.swift@@ -0,0 +1,154 @@+#if os(macOS)+import Foundation+import SwiftData+import Testing+@testable import Transit++@MainActor @Suite(.serialized)+struct MCPCreateProjectTests {+    private struct FetchFailure: Error {}++    private struct FailingFetcher: ModelFetching {+        func fetch<T: PersistentModel>(_ descriptor: FetchDescriptor<T>) throws -> [T] {+            throw FetchFailure()+        }+    }++    @Test func schemaIsDiscoverable() async throws {+        let env = try MCPTestHelpers.makeEnv()+        let response = await env.handler.handle(MCPTestHelpers.request(method: "tools/list"))+        let data = try JSONEncoder().encode(try #require(response))+        let json = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])+        let result = try #require(json["result"] as? [String: Any])+        let tools = try #require(result["tools"] as? [[String: Any]])+        let tool = try #require(tools.first { $0["name"] as? String == "create_project" })+        let schema = try #require(tool["inputSchema"] as? [String: Any])+        #expect(Set(try #require(schema["required"] as? [String])) == ["name", "colorHex"])+        let properties = try #require(schema["properties"] as? [String: [String: Any]])+        for key in ["name", "colorHex", "description", "gitRepo"] {+            #expect(properties[key]?["type"] as? String == "string")+        }+    }++    @Test func createsProjectWithMetadataAndUsableIdentifier() async throws {+        let env = try MCPTestHelpers.makeEnv()+        let description = "Line one\nLine two \\n"+        let repo = "git@example.com:team/project.git"+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: [+                "name": "  New Project\n", "colorHex": "#aB12ef", "description": description, "gitRepo": repo+            ]+        ))+        #expect(try !MCPTestHelpers.isError(response))+        let result = try MCPTestHelpers.decodeResult(response)+        let projectId = try #require(result["projectId"] as? String)+        #expect(UUID(uuidString: projectId) != nil)+        #expect(result["name"] as? String == "New Project")+        #expect(result["description"] as? String == description)+        #expect(result["gitRepo"] as? String == repo)+        #expect(result["colorHex"] as? String == "#aB12ef")+        #expect(result["activeTaskCount"] as? Int == 0)+        let persisted = try #require(env.context.fetch(FetchDescriptor<Project>()).first)+        #expect(persisted.id.uuidString == projectId)+        #expect(persisted.projectDescription == description)+        let listed = await env.handler.handle(MCPTestHelpers.toolCallRequest(tool: "get_projects", arguments: [:]))+        let projects = try MCPTestHelpers.decodeArrayResult(listed)+        #expect(projects.count == 1)+        #expect(NSDictionary(dictionary: try #require(projects.first)) == NSDictionary(dictionary: result))+        let taskResponse = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_task", arguments: ["name": "First task", "type": "feature", "projectId": projectId]+        ))+        #expect(try !MCPTestHelpers.isError(taskResponse))+        let task = try #require(env.context.fetch(FetchDescriptor<TransitTask>()).first)+        #expect(task.project?.id == persisted.id)+    }++    @Test func optionalFieldsCanBeOmittedOrEmpty() async throws {+        let env = try MCPTestHelpers.makeEnv()+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: ["name": "Minimal", "colorHex": "000000"]+        ))+        let result = try MCPTestHelpers.decodeResult(response)+        #expect(result["description"] as? String == "")+        #expect(result["gitRepo"] == nil)+        let empty = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project",+            arguments: ["name": "Empty", "colorHex": "#FFFFFF", "description": "", "gitRepo": ""]+        ))+        #expect(try MCPTestHelpers.decodeResult(empty)["gitRepo"] as? String == "")+    }++    @Test func rejectsMissingAndMalformedFieldsWithoutInsertion() async throws {+        let invalidValues: [Any] = [42, true, NSNull(), [], ["key": "value"]]+        for key in ["name", "colorHex", "description", "gitRepo"] {+            for value in invalidValues {+                let env = try MCPTestHelpers.makeEnv()+                var args: [String: Any] = ["name": "New", "colorHex": "#123ABC"]+                args[key] = value+                let response = await env.handler.handle(+                    MCPTestHelpers.toolCallRequest(tool: "create_project", arguments: args)+                )+                #expect(try MCPTestHelpers.isError(response))+                #expect(try MCPTestHelpers.errorText(response) == "\(key) must be a string")+                #expect(try env.context.fetch(FetchDescriptor<Project>()).isEmpty)+            }+        }+        for key in ["name", "colorHex"] {+            let env = try MCPTestHelpers.makeEnv()+            var args: [String: Any] = ["name": "New", "colorHex": "#123ABC"]+            args.removeValue(forKey: key)+            let response = await env.handler.handle(+                MCPTestHelpers.toolCallRequest(tool: "create_project", arguments: args)+            )+            #expect(try MCPTestHelpers.errorText(response) == "Missing required argument: \(key)")+            #expect(try env.context.fetch(FetchDescriptor<Project>()).isEmpty)+        }+    }++    @Test(arguments: ["", " \n\t", "#ABC", "#12345G", "#12345678", "#123456\n", "#123456\r\n", "#123456", " #123456"])+    func rejectsInvalidColors(color: String) async throws {+        let env = try MCPTestHelpers.makeEnv()+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: ["name": "New", "colorHex": color]+        ))+        #expect(try MCPTestHelpers.isError(response))+        #expect(try env.context.fetch(FetchDescriptor<Project>()).isEmpty)+    }++    @Test(arguments: ["", " \n\t"])+    func rejectsBlankNames(name: String) async throws {+        let env = try MCPTestHelpers.makeEnv()+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: ["name": name, "colorHex": "#123456"]+        ))+        #expect(try MCPTestHelpers.isError(response))+        #expect(try env.context.fetch(FetchDescriptor<Project>()).isEmpty)+    }++    @Test func rejectsDuplicateNameAndPreservesExistingProject() async throws {+        let env = try MCPTestHelpers.makeEnv()+        let existing = try env.projectService.createProject(+            name: "Existing", description: "Original", gitRepo: nil, colorHex: "#123456"+        )+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: ["name": "  eXISTING\n", "colorHex": "#ABCDEF"]+        ))+        #expect(try MCPTestHelpers.isError(response))+        #expect(try MCPTestHelpers.errorText(response).contains("already exists"))+        let projects = try env.context.fetch(FetchDescriptor<Project>())+        #expect(projects.count == 1)+        #expect(projects.first?.id == existing.id)+        #expect(existing.projectDescription == "Original")+    }++    @Test func failedUniquenessReadDoesNotCreateProject() async throws {+        let env = try MCPTestHelpers.makeEnv(projectFetcher: FailingFetcher())+        let response = await env.handler.handle(MCPTestHelpers.toolCallRequest(+            tool: "create_project", arguments: ["name": "New", "colorHex": "#ABCDEF"]+        ))+        #expect(try MCPTestHelpers.isError(response))+        #expect(try MCPTestHelpers.errorText(response).contains("Failed to create project"))+        #expect(try env.context.fetch(FetchDescriptor<Project>()).isEmpty)+    }+}+#endif
tests/validation/create_task_project_schema_guard.py Added +33 / -0
diff --git a/tests/validation/create_task_project_schema_guard.py b/tests/validation/create_task_project_schema_guard.pynew file mode 100644index 0000000..c105986--- /dev/null+++ b/tests/validation/create_task_project_schema_guard.py@@ -0,0 +1,33 @@+"""Preserve CreateTaskIntent's source-literal invariant outside app runtimes."""+from pathlib import Path+import sys+++def validate(source: str) -> None:+    marker = 'title: "Input JSON"'+    start = source.find(marker)+    if start < 0:+        raise ValueError('Could not locate @Parameter(title: "Input JSON") in source')+    end = source.find('var input: String', start)+    if end < 0:+        raise ValueError('Could not locate end of @Parameter block in source')+    parameter_block = source[start + len(marker):end]+    if 'at least one' not in parameter_block.lower():+        raise ValueError('@Parameter(description:) must require at least one project identifier')+    if 'Optional: "projectId"' in parameter_block:+        raise ValueError('@Parameter(description:) still marks projectId as optional')+++def main() -> int:+    source_path = Path(__file__).resolve().parents[2] / 'Transit/Transit/Intents/CreateTaskIntent.swift'+    try:+        validate(source_path.read_text(encoding='utf-8'))+    except (OSError, ValueError) as error:+        print(f'CreateTaskIntent schema guard failed: {error}', file=sys.stderr)+        return 1+    print('CreateTaskIntent source-literal schema guard passed.')+    return 0+++if __name__ == '__main__':+    sys.exit(main())

Docs (10)

CLAUDE.md Modified +11 / -5
diff --git a/CLAUDE.md b/CLAUDE.mdindex 0cc44c8..79241b1 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -8,7 +8,7 @@ Transit is a native Apple task tracker (iOS 26 / iPadOS 26 / macOS 26) for a sin  ## Tech Stack -- **Swift 6.2**, **SwiftUI**, targeting **iOS/iPadOS/macOS 26 exclusively** — no backwards compatibility+- **Swift 6.4** (Xcode 27), **SwiftUI**, targeting **iOS/iPadOS/macOS 26 exclusively** — no backwards compatibility - **`SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor`** — every type is `@MainActor` by default (see gotchas below) - **SwiftData** with **CloudKit** (private database) for cross-device sync - **App Intents** framework for CLI/automation integration via Shortcuts@@ -18,7 +18,9 @@ Transit is a native Apple task tracker (iOS 26 / iPadOS 26 / macOS 26) for a sin  ## Build and Test Commands -Use the Makefile for all development tasks:+Use the Makefile for lint and routine development checks. If build/test invocation issues occur, use the configured Xcode MCP workflow on the same checkout and destination before changing code or build settings: XcodeOpenWorkspace, XcodeSwitchScheme, XcodeSwitchRunDestination, BuildProject, and RunAllTests (or GetTestList plus RunSomeTests). Inspect GetBuildLog to distinguish source errors from invocation/environment problems.++Makefile commands:  ```bash make build        # Build for both iOS and macOS@@ -133,9 +135,9 @@ Shared intent infrastructure lives in `Intents/Shared/`: entities (`ProjectEntit  ### MCP Server (macOS only) -HTTP-based JSON-RPC 2.0 server using **Hummingbird**, gated behind `#if os(macOS)`. Configured via `MCPSettings` (UserDefaults-backed toggle and port). Exposes 10 tools:+HTTP-based JSON-RPC 2.0 server using **Hummingbird**, gated behind `#if os(macOS)`. Configured via `MCPSettings` (UserDefaults-backed toggle and port). Exposes 11 tools: -`create_task`, `update_task_status`, `query_tasks`, `update_task`, `add_comment`, `get_projects`, `create_milestone`, `query_milestones`, `update_milestone`, `delete_milestone`+`create_task`, `update_task_status`, `query_tasks`, `update_task`, `add_comment`, `get_projects`, `create_project`, `create_milestone`, `query_milestones`, `update_milestone`, `delete_milestone`  Key implementation files: - `MCP/MCPServer.swift` — Hummingbird router, lifecycle management@@ -176,8 +178,10 @@ Frosted Panels theme with four options: Follow System (default), Universal, Ligh  Services follow a consistent pattern: mutate in memory, then `save()`, rolling back on failure via `modelContext.safeRollback()` (extension in `Extensions/ModelContext+SafeRollback.swift`). For creation operations, the object is deleted on save failure instead of rolling back, because `safeRollback()` does not re-fault `@Model` properties reliably (see T-452). -### Swift 6 Default MainActor Isolation+### Swift 6.4 Default MainActor Isolation +- Actor-backed counter stores use a `nonisolated` Sendable protocol and a `nonisolated` Sendable snapshot so the protocol does not inherit MainActor isolation under Swift 6.4.+- Shared test counter actors declare their protocol conformances in extensions to avoid Swift 6.4 inferring and rejecting nonisolated actor modifiers when clients are checked first. Keep the fixtures as actors. - Every type is `@MainActor` by default. `@Model` classes are the exception — they follow standard isolation. - `Codable` conformance on enums triggers `@MainActor` isolation. Avoid `Codable` on pure data enums unless needed. - Color extensions using `UIColor`/`NSColor` become `@MainActor` isolated. Use `Color.resolve(in: EnvironmentValues())` instead.@@ -222,3 +226,5 @@ Services follow a consistent pattern: mutate in memory, then `save()`, rolling b - `docs/transit-design-doc.md` — full design document with data model, UI specs, intent schemas - `docs/transit-ui-mockup.jsx` — React-based interactive mockup (reference only, not production) - `docs/agent-notes/` — implementation notes on architecture, constraints, and patterns++Host source-literal checks belong in `tests/validation/` and run through lint/test preflight. App test processes must not synchronously read the host checkout; GUI-launched test runners can block on host-file access.
README.md Modified +5 / -5
diff --git a/README.md b/README.mdindex c3c299c..f725af1 100644--- a/README.md+++ b/README.md@@ -16,7 +16,7 @@ Transit sits alongside the existing tool ecosystem: [Orbit](https://github.com/A - **Reports** — generate summary reports of completed/abandoned tasks by date range - **Cross-device sync** via CloudKit private database - **CLI automation** through App Intents — create tasks, update statuses, manage milestones, add comments, generate reports-- **MCP server** (macOS) — HTTP JSON-RPC server for AI agent integration with 10 tools+- **MCP server** (macOS) — HTTP JSON-RPC server for AI agent integration with 11 tools - **Agent handoff statuses** (Ready for Implementation, Ready for Review) for AI/human workflow integration - **Adaptive layout**: width-based multi-column Kanban on iPhone/iPad/Mac, with a segmented single-column fallback only when one column fits - **Drag and drop** between columns to change task status@@ -26,8 +26,8 @@ Transit sits alongside the existing tool ecosystem: [Orbit](https://github.com/A ## Requirements  - iOS 26 / iPadOS 26 / macOS 26-- Xcode 26-- Swift 6.2+- Xcode 27+- Swift 6.4  No backwards compatibility — this targets the latest Apple platforms exclusively. @@ -64,9 +64,9 @@ All intents accept a JSON string input and return a JSON string response, includ  ## MCP Server (macOS) -Transit includes a built-in MCP server on macOS for AI agent integration. Enable it in Settings and configure the port (default: 3141). The server exposes 10 tools over HTTP JSON-RPC 2.0:+Transit includes a built-in MCP server on macOS for AI agent integration. Enable it in Settings and configure the port (default: 3141). The server exposes 11 tools over HTTP JSON-RPC 2.0: -`create_task`, `update_task_status`, `query_tasks`, `update_task`, `add_comment`, `get_projects`, `create_milestone`, `query_milestones`, `update_milestone`, `delete_milestone`+`create_task`, `update_task_status`, `query_tasks`, `update_task`, `add_comment`, `get_projects`, `create_project`, `create_milestone`, `query_milestones`, `update_milestone`, `delete_milestone`  ## Documentation 
docs/agent-notes/mcp-server.md Modified +14 / -0
diff --git a/docs/agent-notes/mcp-server.md b/docs/agent-notes/mcp-server.mdindex 94f315b..1897929 100644--- a/docs/agent-notes/mcp-server.md+++ b/docs/agent-notes/mcp-server.md@@ -43,6 +43,8 @@ Key challenge: Hummingbird runs on SwiftNIO event loops (nonisolated), but servi  | Tool | Description | |------|-------------|+| `create_project` | Create a project (name and colorHex required; description and gitRepo optional). Returns projectId and project metadata for subsequent create_task calls. |+| `get_projects` | List projects with metadata and milestone summaries. | | `create_task` | Create a new task (name and type required; at least one of project / projectId required to identify the project; description, metadata, and priority optional — priority defaults to medium, invalid priority rejects with no task created) | | `update_task_status` | Change task status (by displayId or taskId) | | `update_task` | Update a task's mutable fields — any combination of `name`, `description`, `type`, `priority`, `metadata`, and milestone assignment (`milestone` / `milestoneDisplayId` / `clearMilestone`) — in a single atomic call. Priority is non-clearable: omit to leave unchanged. Identify task by displayId or taskId. |@@ -167,3 +169,15 @@ MCPToolHandler, App Intents, and IntentHelpers all delegate to these methods rat - **Always validate enum filter values in query handlers.** When a handler accepts `status`, `not_status`, or `type` as filter parameters, validate each value against the enum's `allCases` before using them. Invalid values must return `isError: true` with a message listing valid options — never silently filter to empty results. Helper: `validateEnumFilter(_:key:type:)` in `MCPToolHandler` — generic over any `RawRepresentable & CaseIterable` enum with `String` raw values (T-732). - **Reuse IntentHelpers instead of implementing private handler-local helpers.** `IntentHelpers` provides shared utilities for metadata extraction, JSON parsing, task/milestone resolution, and error mapping. Don't duplicate this logic in MCPToolHandler — use the shared version to ensure consistent behavior across MCP and App Intent paths (T-723). - **`update_task` distinguishes "omit" from "clear".** Omitting a field leaves the stored value untouched; passing `description: ""` or whitespace-only clears the description, and passing `metadata: {}` clears all metadata. An identifier-only request (no mutating field) is a no-op echo — the task is returned without a save. Both `update_task` and `UpdateTaskIntent` route through `TaskUpdateValidator` + `IntentHelpers.taskUpdateResponseDict`, so success payloads are equivalent across surfaces (enforced by `UpdateTaskAllFieldsParityTests`).++## Project creation++`create_project` accepts required `name` and `colorHex` strings. Names are trimmed and must be non-empty and unique under the same case-insensitive policy as UI creation. Colors must contain exactly six ASCII hexadecimal digits, optionally prefixed by `#`; case and prefix are preserved. Optional `description` defaults to `""`; `gitRepo` is omitted when absent. Both optional fields must be strings when present (JSON null is rejected). Their contents pass through unchanged, and gitRepo remains free-form like the UI field.++Example `tools/call` params:++```json+{"name":"create_project","arguments":{"name":"Agent Work","colorHex":"007AFF","description":"Tasks created through MCP","gitRepo":"git@example.com:team/project.git"}}+```++Success returns a JSON object inside `content[0].text` with `projectId` (UUID), `name`, `description`, `colorHex`, `activeTaskCount: 0`, and `gitRepo` when supplied. Pass the returned `projectId` to `create_task` as its projectId argument. `get_projects` includes the new project immediately. Invalid fields, duplicate names, and storage failures return `isError: true`. Creation uses ProjectService's insert/save cleanup and is blocked while fallback storage is active.
specs/OVERVIEW.md Modified +13 / -0
diff --git a/specs/OVERVIEW.md b/specs/OVERVIEW.mdindex b4ff86a..29b1b70 100644--- a/specs/OVERVIEW.md+++ b/specs/OVERVIEW.md@@ -33,6 +33,7 @@ | [Update Task All Fields](#update-task-all-fields) | 2026-05-22 | Done | Extend update_task MCP tool and App Intent to update name, description, type, and metadata | | [Search Empty State](#search-empty-state) | 2026-05-31 | Done | Show ContentUnavailableView.search empty state when dashboard text search has no matches | | [Task Priority](#task-priority) | 2026-06-06 | Done | Add a low/medium/high priority field with board glyph, filter, and MCP/Intent support |+| [MCP Project Creation](#mcp-project-creation) | 2026-10-02 | Ready for Review | Create projects through MCP with validation and reusable project metadata |  --- @@ -313,3 +314,15 @@ Add a low/medium/high priority field (default medium) to tasks, shown as a board - [implementation.md](task-priority/implementation.md) - [requirements.md](task-priority/requirements.md) - [tasks.md](task-priority/tasks.md)++## MCP Project Creation++Create projects through MCP with validation and a returned UUID for task creation (T-2377).++- [requirements.md](mcp-project-creation/requirements.md)+- [design.md](mcp-project-creation/design.md)+- [decision_log.md](mcp-project-creation/decision_log.md)+- [tasks.md](mcp-project-creation/tasks.md)+- [implementation.md](mcp-project-creation/implementation.md)+- [explanation.md](mcp-project-creation/explanation.md)+- [pre-push-review.html](mcp-project-creation/pre-push-review.html)
specs/mcp-project-creation/decision_log.md Added +31 / -0
diff --git a/specs/mcp-project-creation/decision_log.md b/specs/mcp-project-creation/decision_log.mdnew file mode 100644index 0000000..7863355--- /dev/null+++ b/specs/mcp-project-creation/decision_log.md@@ -0,0 +1,31 @@+# Decisions — T-2377++| Decision | Rationale |+|---|---|+| Full spec route | The new MCP tool creates a public API contract. |+| Proceed through spec and implementation | The delegated request explicitly authorises scoped implementation in an isolated branch; no additional permission is needed for reversible local work. |+| Require name and colorHex; default description to empty | These correspond to the project model and UI's optional description/repository fields; explicit color avoids an invented default. |+| Require six-digit RRGGBB or #RRGGBB; preserve case | Matches UI color output and existing prefixed project colors and rejects malformed colors rather than letting the UI silently render a fallback. |+| gitRepo stays free-form | Existing project UI/service imposes no URL restriction; paths and SSH remotes remain usable. |+| Share project metadata formatting | Keep creation and discovery consistent without changing milestone fetching. |++| Recovery decision | Rationale |+|---|---|+| Keep Xcode 27 blockers outside T-2377 | Clean baseline reproduces dependency and actor-fixture failures; correcting them expands scope. |+| Use two independent subagent peer perspectives | External Codex/Kiro MCP peers are unavailable; personal peer-review-validator explicitly allows fallback. |+| Leave In Progress pending compatible validation | Historical initial blocker; superseded by the passing macOS unit suite and subsequent Xcode MCP simulator validation below. |++| Xcode 27 scope decision | Rationale |+|---|---|+| Support Xcode 27 / Swift 6.4 | User explicitly expanded scope to fix the verified baseline blockers; earlier out-of-scope decision is superseded. |+| Pin released AsyncAlgorithms 1.1.3 | Resolver selected this revision; unpatched macOS tests and both builds pass. It removes the rejected generic takeSending helper while keeping other pins unchanged. |+| Make counter protocol/snapshot nonisolated and Sendable | Actor implementations need a contract independent of MainActor; immutable snapshots cross executors safely. |+| Keep deployment minimum at 26 | The toolchain update does not require dropping existing supported OS versions. |++| Xcode MCP/compiler recovery | Rationale |+|---|---|+| Use configured Xcode MCP bridge after user approval | The user requested MCP when make test invocation failed; approval for the bridge caller and worktree was explicitly granted. No global permissions/settings changed by implementation. |+| Move shared fixture actor conformances into extensions | Exact compiler reproduction fails in normal file order and passes with fixtures first. Empty extensions avoid the Swift 6.4 inference/validation interaction while preserving actor executors, state, checked Sendable and API names. Protocol-removal, nesting and local-refinement experiments failed and were reverted. |+| Keep host-source guard macOS-only | Simulator sample proved the existing synchronous #filePath source read blocks the main thread. Runtime description checks still run on iOS, and macOS retains source-literal drift coverage. The canceled run was finalized before a fresh suite started. This temporary approach was superseded by CLI migration after the same source-read stall was sampled on macOS. |+| Migrate source-literal guard into CLI validation | Both GUI app test runners block while opening host source paths. Preserve every assertion in repository validation and run it through lint/test preflight; runtime intent-description checks remain cross-platform. Final macOS suite passes 1823 tests plus the passing CLI guard, with no skipped app tests. |+| Run exact pre-push-review skill locally | Explicit user request after completion; review working-tree changes because no new commits exist. Publication/push remain unauthorised. |
specs/mcp-project-creation/design.md Added +23 / -0
diff --git a/specs/mcp-project-creation/design.md b/specs/mcp-project-creation/design.mdnew file mode 100644index 0000000..58d298b--- /dev/null+++ b/specs/mcp-project-creation/design.md@@ -0,0 +1,23 @@+# MCP Project Creation Design++Register `MCPToolDefinitions.createProject` in coreTools and dispatch `create_project` from MCPToolHandler. Required schema fields are name and colorHex; description and gitRepo are optional strings. Color is required so clients explicitly select the persisted project color without a platform-dependent UI default.++Validate both required strings with the existing requiredString helper. Require colorHex to match `^#?[0-9A-Fa-f]{6}$` with a whole-string match; preserve letter case. Reject present non-string optional fields, including null, before calling ProjectService.createProject. Description and gitRepo contents pass through unchanged, including literal escapes and newlines. The service trims names, checks existing locale-stable case-insensitive uniqueness, inserts, saves, and deletes the inserted model on save failure. Map invalidName and duplicateName to actionable errors; report underlying storage errors as creation failure.++Return a JSON object inside the existing MCP text-result envelope, matching get_projects project metadata fields. New projects have zero active tasks and no milestones. Reuse one project metadata formatter for get_projects and create_project so response shapes stay consistent. Do not fetch milestones after creation: a failed follow-up fetch must not report a saved creation as failed.++The existing derived mutatingToolNames set automatically blocks this new tool in fallback storage. Tests cover schema discovery, validation/atomic rejection, duplicate lookup failure, returned metadata, subsequent task creation, discovery, and fallback rejection. Existing ProjectServiceTests cover successful persistence and ModelContextSaveHelpersTests cover failed-save cleanup; no new service injection hook is needed.++## Risks and verification++MCP fields establish a public contract. Lock required fields and response shape with tests. Preserve existing get_projects milestone behavior via its regression suite. Keep changes behind macOS guards and verify both platform builds.++## Xcode 27 compatibility++Use the released AsyncAlgorithms 1.1.3 revision `9d349bcc328ac3c31ce40e746b5882742a0d1272` in Package.resolved; retain all other dependency pins. This release removes the generic takeSending helper rejected by Swift 6.4. Avoid application concurrency-mode downgrades or dependency-cache modifications.++Declare DisplayIDAllocator.CounterSnapshot as nonisolated and Sendable, with its existing immutable Int/String? values. Declare its async CounterStore protocol nonisolated and Sendable, allowing independent actor implementations instead of inheriting the app's default MainActor isolation. Production CloudKitCounterStore remains MainActor isolated; allocator gate, retries, and compare-and-swap semantics remain unchanged. Existing actor-backed allocation/concurrency tests verify the behavior. The shared fixture actors declare their conformances in empty extensions, avoiding Swift 6.4 declaration-order inference errors without changing their executors or state.++Document Xcode 27 / Swift 6.4 as the development toolchain; keep the iOS/macOS minimum deployment versions at 26. Validate make lint, make build, make test-quick, and the full simulator unit/UI suite. Use Xcode MCP for build/test invocation issues, as requested by the user.++Host-source literal-drift assertions run in CLI validation before lint and test commands. Runtime description checks remain cross-platform; app test runners never synchronously open host source paths.
specs/mcp-project-creation/explanation.md Added +21 / -0
diff --git a/specs/mcp-project-creation/explanation.md b/specs/mcp-project-creation/explanation.mdnew file mode 100644index 0000000..57d17c5--- /dev/null+++ b/specs/mcp-project-creation/explanation.md@@ -0,0 +1,21 @@+# T-2377 change explanation++## Beginner level++An MCP client can now create a Transit project before adding its tasks. It supplies a name and a color, plus an optional description and repository. Transit checks those values, saves the project, and returns its ID and details. The client can use that ID in its next create_task call.++The Mac's current Xcode toolchain also needs a newer dependency and clearer concurrency declarations. These changes allow the app and its existing actor-based tests to compile with Swift 6.4.++## Intermediate level++The core tool inventory and dispatcher now expose create_project. The handler validates required/optional string types and whole-string six-digit ASCII hex colors, then delegates trimmed-name validation, case-insensitive duplicate detection and persistence to ProjectService. A shared metadata formatter keeps get_projects and creation results aligned; discovery still enriches projects with milestones.++The dependency update changes only AsyncAlgorithms to 1.1.3. CounterStore and CounterSnapshot explicitly opt out of the application's MainActor default and use checked Sendable. Two existing test actors move their protocol conformances into empty extensions to avoid a Swift 6.4 declaration-order diagnostic. Their methods and state remain unchanged. A source-literal guard now runs as CLI preflight for lint/test commands, while the runtime description test remains cross-platform; app test runners do not open host checkout paths.++## Expert level++Creation remains a synchronous MainActor service operation, so local uniqueness validation and saving have no suspension window. Storage fallback rejects the new mutation through the existing gate. Invalid optional values, including JSON null, are rejected rather than silently discarded. Color validation checks the full regex range to reject trailing newlines; the stored color's case and prefix are preserved. Optional repository values retain the existing free-form service contract.++The response includes a persisted UUID usable by create_task. Tests cover schema discovery, validation, duplicate/read failure, metadata parity, persistence and project-to-task integration. Save-failure cleanup remains covered by the shared persistence helper rather than a new handler-specific failure seam.++The compatibility change preserves production CloudKitCounterStore's MainActor isolation and existing allocator serialization, retries and compare-and-swap behavior. Normal-order compiler reproduction and Xcode MCP build-for-testing validate the conformance-placement workaround; final runtime outcomes are recorded in implementation.md. No publication or deployment is included.
specs/mcp-project-creation/implementation.md Added +72 / -0
diff --git a/specs/mcp-project-creation/implementation.md b/specs/mcp-project-creation/implementation.mdnew file mode 100644index 0000000..a7d27df--- /dev/null+++ b/specs/mcp-project-creation/implementation.md@@ -0,0 +1,72 @@+# T-2377 implementation and validation++Branch: `T-2377/mcp-project-creation`, based on `origin/main` merge base `3c2c6c8`. Isolated checkout: `/Users/arjen/Documents/Codex/2026-10-02/task-2/transit`. Changes remain uncommitted. No push, publication, merge, deployment or global toolchain change. Original checkout's unrelated `.kiro/` remains untouched.++## Implemented++- Core create_project schema/dispatch: required name/colorHex; optional description/gitRepo; strict strings and whole-string ASCII hex validation; ProjectService-backed trimmed-name uniqueness and persistence; UUID and project metadata usable by create_task.+- Shared metadata formatting with get_projects, preserving milestone enrichment; fallback storage mutation rejection.+- Contract/rejection/persistence/metadata/project-to-task tests, updated inventory tests; README, CLAUDE, MCP docs and feature spec.+- User-authorised Xcode 27 / Swift 6.4 support: only AsyncAlgorithms pin changes to released 1.1.3 (`9d349bcc328ac3c31ce40e746b5882742a0d1272`). Other pins and deployment targets are unchanged; no dependency-cache patches remain.+- CounterSnapshot is nonisolated and checked Sendable; async CounterStore is nonisolated and Sendable. Production CloudKitCounterStore retains MainActor isolation. Two shared counter actors move identical conformances to empty extensions; bodies, executors, allocation gate, retries and compare-and-swap behavior stay unchanged.+- Host source-literal assertion migrates from an app unit test to `tests/validation/create_task_project_schema_guard.py`, preserving marker/constraint/negative assertions. It runs before lint, test-quick, test and test-ui. Cross-platform runtime intent-description checks remain. This supersedes the temporary macOS-only source guard, because GUI-launched macOS tests also block on host-file opening.++## Final verification++| Check | Result |+|---|---|+| make lint | Passed ownership guard, source-literal guard and strict SwiftLint: 364 files, zero violations. `.codex-cache/t2377/final-lint.log`. |+| CLI source guard fixtures | Valid fixture passes; missing marker, missing end, missing project constraint and optional project identifier all reject. |+| git diff --check | Passed. |+| Xcode MCP iOS BuildProject, buildForTesting=true | Passed with conformance-extension fix; 21.291s, no errors. `.codex-cache/t2377/mcp-extension-conformance-build.json`. |+| Xcode MCP full iOS simulator unit/UI run | Fresh xcresult **1291 total, 1291 passed, 0 failed, 0 skipped**: 1270 unit tests and 21 UI tests. `.codex-cache/t2377/final-ios-xcresult-summary.json`; bundle `/var/folders/11/v0tnfm294kd9c6zll_ncmpkh0000gn/T/ActionArtifacts/default/RunAllTests/Test-Transit-2026.10.02_17-55-17-+1000.xcresult`. |+| Final Xcode MCP macOS BuildProject, buildForTesting=true | Passed after CLI guard migration; 16.183s, no errors. `.codex-cache/t2377/mcp-build-cli-guard-mac.json`. |+| Final Xcode MCP macOS full TransitTests selection | Fresh xcresult **1823 total, 1823 passed, 0 failed, 0 skipped**, including MCPCreateProjectTests and actor allocation/cancellation/gating suites. `.codex-cache/t2377/final-mac-xcresult-summary.json`; bundle `/var/folders/11/v0tnfm294kd9c6zll_ncmpkh0000gn/T/ActionArtifacts/default/RunSomeTests/Test-Transit-2026.10.02_18-20-15-+1000.xcresult`. The former 1824th source guard is now a separately passing CLI assertion, not a skipped app test. |+| Earlier make build | Passed both iOS/macOS with final production code and AsyncAlgorithms 1.1.3. `.codex-cache/t2377/xcode27-build.log`. |+| Earlier make test-quick XCBEAUTIFY= | Passed 1824 macOS tests before source-guard migration, 0 failed/skipped. `.codex-cache/t2377/xcode27-fixture-raw.log`. |+| Earlier make test / raw retry | Failed iOS test compilation on inferred nonisolated actor modifiers; corrected by final conformance extensions and superseded by passing MCP run. Separate make test-ui was not run; full MCP simulator suite included all 21 UI tests. |++MCP discovery counts retain cross-platform/no-result and dynamic-parameter entries. Its iOS summary included an old canceled source-test state. The fresh per-run xcresult and console are authoritative; both final bundles report Passed without failures.++## Recovery evidence++Clean baseline 3c2c6c8 reproduced AsyncAlgorithms 1.1.1's sending-result compiler error and original actor protocol-conformance failures. Temporary ignored-cache diagnostics were restored. Final source-controlled pin/isolation changes fix them without downgrading the toolchain.++Exact swift-frontend full-module reproduction fails in normal source order and passes fixture-first. Final empty conformance extensions also pass normal-order reproduction. Removing protocol isolation, aliasing, nesting or refining the protocol did not fix it; all experiments were reverted. `.codex-cache/t2377/final-full-typecheck.log` records the successful reproduction.++Both GUI-launched simulator and macOS test processes later blocked in Foundation source-file opening at CreateTaskProjectRequiredSchemaTests.intentParameterDescriptionMatchesStaticLiteral. Samples: `.codex-cache/t2377/ios-unit-stall-sample.txt` and `mac-unit-stall-sample.txt`. No debugger was attached. Confirmed stalls were stopped through Xcode MCP before replacements ran. Initial simulator xcresult finalized: 408 total, 83 passed, 325 canceled; every failure was Testing was canceled. The assertion now runs in the CLI process, and final app suites pass. No assertions were relaxed.++User explicitly approved the configured xcrun mcpbridge caller/worktree; tools were accessed through a local stdio client because they were not surfaced in this task. Package resolution was performed once for that workspace. Only this task's Xcode workspace/destinations were used; no physical deployment.++## Reviews and workflow++Personal `/Users/arjen/.codex/skills/transit/SKILL.md` routed the feature through requirements/design/tasks. Repository CLAUDE.md was read; no AGENTS.md or checkout .agents/skills existed. The separate peer-review-validator allowed independent subagent fallback because external peers were unavailable. Design/code/simplification/architecture reviews found no remaining feature or concurrency issues; final compiler workaround and platform guard were reviewed independently.++The user additionally requested the exact personal pre-push-review skill after implementation. Its four-role review is complete: reuse, quality and efficiency found no actionable issues; spec/documentation review found one minor rollback-versus-cleanup wording issue, now corrected. Validation snapshot/restore ran make lint successfully and touched no tracked files or new untracked paths. The Swift ecosystem registry detects only root Package.swift projects, so its JUnit/coverage recipe does not detect this Xcode repository; runner not detected is recorded explicitly. Native Xcode results above remain the verification evidence. The bundled renderer generated `pre-push-review.html` with the complete working-tree diff, blast-radius diagram, explanations, important changes and resolved finding. Renderer reported 0 failed/errored structured tests (no JUnit data); native per-run counts above are separately explicit. Phase 8 publication was omitted because the user expressly withheld publication authorisation. No unpushed commits exist; it reviews the working tree and untracked feature files against the merge base. Publication is explicitly not authorised. All implementation/review tasks are complete. T-2377 is ready for human review; no remaining code findings or implementation blockers.++## Three-level implementation explanation+++## Beginner level++An MCP client can now create a Transit project before adding its tasks. It supplies a name and a color, plus an optional description and repository. Transit checks those values, saves the project, and returns its ID and details. The client can use that ID in its next create_task call.++The Mac's current Xcode toolchain also needs a newer dependency and clearer concurrency declarations. These changes allow the app and its existing actor-based tests to compile with Swift 6.4.++## Intermediate level++The core tool inventory and dispatcher now expose create_project. The handler validates required/optional string types and whole-string six-digit ASCII hex colors, then delegates trimmed-name validation, case-insensitive duplicate detection and persistence to ProjectService. A shared metadata formatter keeps get_projects and creation results aligned; discovery still enriches projects with milestones.++The dependency update changes only AsyncAlgorithms to 1.1.3. CounterStore and CounterSnapshot explicitly opt out of the application's MainActor default and use checked Sendable. Two existing test actors move their protocol conformances into empty extensions to avoid a Swift 6.4 declaration-order diagnostic. Their methods and state remain unchanged. A source-literal guard now runs as CLI preflight for lint/test commands, while the runtime description test remains cross-platform; app test runners do not open host checkout paths.++## Expert level++Creation remains a synchronous MainActor service operation, so local uniqueness validation and saving have no suspension window. Storage fallback rejects the new mutation through the existing gate. Invalid optional values, including JSON null, are rejected rather than silently discarded. Color validation checks the full regex range to reject trailing newlines; the stored color's case and prefix are preserved. Optional repository values retain the existing free-form service contract.++The response includes a persisted UUID usable by create_task. Tests cover schema discovery, validation, duplicate/read failure, metadata parity, persistence and project-to-task integration. Save-failure cleanup remains covered by the shared persistence helper rather than a new handler-specific failure seam.++The compatibility change preserves production CloudKitCounterStore's MainActor isolation and existing allocator serialization, retries and compare-and-swap behavior. Normal-order compiler reproduction and Xcode MCP build-for-testing validate the conformance-placement workaround; final runtime outcomes are recorded in implementation.md. No publication or deployment is included.++## Completeness assessment++Fully implemented: create_project contract, validation, persistence, reusable metadata, fallback gate, behavioral coverage, docs and user-authorised Xcode 27 compatibility. Full final macOS and simulator suites and CLI guard pass. No implementation requirement is partially implemented or missing. Structured JUnit/coverage is unavailable from the supplied pre-push runner registry for this native Xcode project; this review does not infer coverage. Publication remains explicitly outside the authorised scope.
specs/mcp-project-creation/requirements.md Added +44 / -0
diff --git a/specs/mcp-project-creation/requirements.md b/specs/mcp-project-creation/requirements.mdnew file mode 100644index 0000000..2c788e7--- /dev/null+++ b/specs/mcp-project-creation/requirements.md@@ -0,0 +1,44 @@+# MCP Project Creation — T-2377++MCP clients need a way to create a project before adding its tasks. This feature exposes project creation through the existing local MCP endpoint and returns the identity clients need for subsequent operations.++### 1. MCP contract++**User Story:** As an MCP client, I want to create projects with explicit fields, so that I can establish projects without the app UI.++**Acceptance Criteria:**++1. <a name="1.1"></a>WHEN a client lists MCP tools, Transit SHALL expose `create_project` as a core tool.  +2. <a name="1.2"></a>WHEN creating a project, Transit SHALL require a string `name` and a string `colorHex` in `RRGGBB` or `#RRGGBB` format (ASCII hex, case insensitive).  +3. <a name="1.3"></a>WHEN optional `description` or `gitRepo` is supplied, Transit SHALL require strings, preserving their contents. Omitted description defaults to an empty string; omitted gitRepo is absent.  ++### 2. Rejection and persistence++**User Story:** As an MCP client, I want rejected requests to leave no new project, so that failures do not create partial data.++**Acceptance Criteria:**++1. <a name="2.1"></a>WHEN the trimmed name is empty or conflicts case-insensitively with an existing project, Transit SHALL return an explicit tool error without creating a project.  +2. <a name="2.2"></a>WHEN validation or storage fails, Transit SHALL return an MCP tool error; fallback storage SHALL reject creation under the existing mutation policy.  ++### 3. Project metadata and reuse++**User Story:** As an MCP client, I want the stored project metadata and UUID, so that I can create its tasks and discover it again.++**Acceptance Criteria:**++1. <a name="3.1"></a>WHEN creation succeeds, Transit SHALL return `projectId`, stored `name`, `description`, `colorHex`, `activeTaskCount` (zero), and `gitRepo` when supplied.  +2. <a name="3.2"></a>WHEN clients use the returned projectId with `create_task`, Transit SHALL create the task in that project; `get_projects` SHALL include the created project.  ++### 4. Xcode 27 compatibility++**User Story:** As a developer, I want Transit to build and test with Xcode 27 / Swift 6.4, so that I can implement and validate projects on the current toolchain.++**Acceptance Criteria:**++1. <a name="4.1"></a>Transit SHALL build for macOS and iOS Simulator using Xcode 27 / Swift 6.4 with source-controlled dependency resolution and no cache patches.  +2. <a name="4.2"></a>Transit SHALL execute its macOS unit tests and iOS Simulator unit/UI tests on Xcode 27, including actor-backed display-ID stores and MCP project creation.  ++## Non-goals++No App Intent, UI change, schema migration, project update/delete tools, URL validation, arbitrary project metadata dictionary, deployment, or merge. gitRepo follows the existing free-form project field.
specs/mcp-project-creation/tasks.md Added +33 / -0
diff --git a/specs/mcp-project-creation/tasks.md b/specs/mcp-project-creation/tasks.mdnew file mode 100644index 0000000..c45b451--- /dev/null+++ b/specs/mcp-project-creation/tasks.md@@ -0,0 +1,33 @@+---+references:+    - specs/mcp-project-creation/requirements.md+    - specs/mcp-project-creation/design.md+    - specs/mcp-project-creation/decision_log.md+---+# MCP Project Creation++- [x] 1. Write create_project contract and rejection tests <!-- id:95wcxxa -->+  - Cover required/schema fields, malformed strings/colors, duplicate/read failures, returned metadata and subsequent task creation; extend fallback rejection coverage.+  - Stream: 1+  - Requirements: [1.1](requirements.md#1.1), [1.2](requirements.md#1.2), [1.3](requirements.md#1.3), [2.1](requirements.md#2.1), [2.2](requirements.md#2.2), [3.1](requirements.md#3.1), [3.2](requirements.md#3.2)++- [x] 2. Implement core schema, dispatch and project creation handler <!-- id:95wcxxb -->+  - Reuse ProjectService and project metadata formatter; preserve get_projects milestones.+  - Blocked-by: 95wcxxa (Write create_project contract and rejection tests)+  - Stream: 1+  - Requirements: [1.1](requirements.md#1.1), [1.2](requirements.md#1.2), [1.3](requirements.md#1.3), [2.1](requirements.md#2.1), [2.2](requirements.md#2.2), [3.1](requirements.md#3.1), [3.2](requirements.md#3.2)++- [x] 3. Reproduce Xcode 27 blockers with existing dependency and actor-store tests <!-- id:95wcxxc -->+  - Clean baseline macOS tests establish red compilation for AsyncAlgorithms and actor-backed CounterStore fixtures.+  - Stream: 1+  - Requirements: [4.1](requirements.md#4.1), [4.2](requirements.md#4.2)++- [x] 4. Update dependency pin and counter isolation for Xcode 27 <!-- id:95wcxxd -->+  - Keep unrelated dependencies and deployment targets unchanged; validate existing actor allocation tests, macOS/iOS builds and simulator UI suite.+  - Blocked-by: 95wcxxc (Reproduce Xcode 27 blockers with existing dependency and actor-store tests)+  - Stream: 1+  - Requirements: [4.1](requirements.md#4.1), [4.2](requirements.md#4.2)++- [x] 5. Run requested pre-push-review workflow <!-- id:95wcxxe -->+  - Blocked-by: 95wcxxd (Update dependency pin and counter isolation for Xcode 27)+  - Stream: 1

Other (1)

Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Modified +2 / -2
diff --git a/Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolvedindex bb9aea0..c908b82 100644--- a/Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved+++ b/Transit/Transit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved@@ -42,8 +42,8 @@       "kind" : "remoteSourceControl",       "location" : "https://github.com/apple/swift-async-algorithms.git",       "state" : {-        "revision" : "6c050d5ef8e1aa6342528460db614e9770d7f804",-        "version" : "1.1.1"+        "revision" : "9d349bcc328ac3c31ce40e746b5882742a0d1272",+        "version" : "1.1.3"       }     },     {

Things to double-check

Structured data limitation

The supplied ecosystems.json Swift runner requires root Package.swift. This native Xcode project has none, so Phase 5 records runner not detected; no substitute test runner or fabricated JUnit/coverage was used. Actual final result summaries are recorded in implementation.md.

Per-run Xcode evidence

MCP metadata retains platform-unavailable and prior canceled entries. Fresh final xcresult bundles both report Passed with zero failures; use their exact counts, not accumulated discovery counts.