KeyType icon indicating copy to clipboard operation
KeyType copied to clipboard

Fresh clones fail to build: ModelSetupCoordinator.swift is missing from the repo (swallowed by unanchored "Models/" gitignore rule)

Open hiimdec opened this issue 4 months ago • 0 comments

Summary

main does not build from a fresh clone. KeyType.xcodeproj/project.pbxproj references KeyType/Logic/Models/ModelSetupCoordinator.swift (PBXFileReference, PBXBuildFile, the Models group, and the Sources phase), but the file does not exist anywhere in the repository.

What happened

Commit 5214b77 ("chore: Refactor directories") moved everything under KeyType/Logic/ into subdirectories. Git recorded every file as a rename — except one, which became a pure deletion:

R100  KeyType/Logic/AcceptanceShortcut.swift   KeyType/Logic/Completion/AcceptanceShortcut.swift
R100  KeyType/Logic/ContextCaptureController.swift   KeyType/Logic/Context/ContextCaptureController.swift
D     KeyType/Logic/ModelSetupCoordinator.swift      ← deleted, never re-added

The cause is in .gitignore:

# Model weights (stay in ~/Library/Application Support/KeyType/Models, never in the repo)
*.gguf
Models/

Models/ is unanchored, so it matches any directory named Models at any depth — including the new source directory KeyType/Logic/Models/ the refactor created. Git stopped seeing the moved file, so git add -A recorded only the deletion. Confirmed on a clean checkout of current main (04db9a2):

$ git check-ignore -v KeyType/Logic/Models/ModelSetupCoordinator.swift
.gitignore:40:Models/	KeyType/Logic/Models/ModelSetupCoordinator.swift

This is invisible on your machine because your working copy presumably still has the file — it is ignored, so it builds fine locally and never shows up in git status. Every fresh clone gets the build break, though. (I swept all 47 .swift files referenced by project.pbxproj against the tree — this is the only one missing.)

Repro

git clone https://github.com/johnbean393/KeyType.git
cd KeyType
# set up the llama.cpp xcframework per the docs (ADR-007)
xcodebuild -workspace KeyType.xcworkspace -scheme KeyType -destination platform=macOS build

fails with:

error: Build input file cannot be found: '<clone>/KeyType/Logic/Models/ModelSetupCoordinator.swift'.
Did you forget to declare this file as an output of a script phase or custom build
rule which produces it? (in target 'KeyType' from project 'KeyType')
** BUILD FAILED **

Fix

Two small changes (verified: a clean checkout of main plus these two changes builds):

  1. Restore the file at the path the project expects. The last committed version works:
    git show '5214b77^:KeyType/Logic/ModelSetupCoordinator.swift' > KeyType/Logic/Models/ModelSetupCoordinator.swift
    git add -f KeyType/Logic/Models/ModelSetupCoordinator.swift
    
    If your local untracked copy has diverged since then, yours is the right one to commit — after the gitignore fix below, git status will finally show it.
  2. Anchor the ignore rule to the repo root so a directory name can't swallow source files again: Models/ → /Models/ (the *.gguf rule already catches stray weight files elsewhere).

I've also opened a PR applying both changes.

Environment: macOS 26.5.1, Xcode 26.6 (17F113) — though any machine reproduces this; it's a repo-content issue, not an environment one.

hiimdec avatar Jul 10 '26 16:07 hiimdec