chore: migrate utility.FindFileInAppDir to v2 (STEP-2171)#334
Open
Badlazzor wants to merge 1 commit into
Open
Conversation
Adds utility/ as a v2 package containing FindFileInAppDir, with five unit tests covering direct-match, .app-bundle search, nested directory match, not-found, and precedence-over-bundle-search. v1 used the package-level pathutil helpers; v2 uses the interface-based API: - pathutil.IsPathExists(pth) → pathutil.NewPathChecker().IsPathExists(pth) - pathutil.ListEntries(dir, filter) → pathutil.FilterFS(os.DirFS(dir), filter) GetXcodeVersion is intentionally not migrated; v2 already ships xcodeversion.Reader.GetVersion which covers the same surface. Drive-by: - Bump go-utils/v2 to v2.0.0-alpha.35 — FilterFS and the filter constructors landed in that tag (STEP-2135, PR #224). - Re-run mockery against fileutil.FileManager and add a hand-written CopyFileFS stub in devportalservice/mock_filemanager.go so the internal mock satisfies the interface again. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
utility/as a v2 package withFindFileInAppDirported from v1.GetXcodeVersionis intentionally not migrated —xcodeversion.Reader.GetVersionalready covers the same surface in v2.Jira: STEP-2171
What changed
utility/path.goFindFileInAppDir(appDir, fileName) (string, error)with v1-equivalent behavior:appDir/fileNameexists → return it.*.appbundle underappDirand return the first basename match.v1 → v2 API swaps inside the function:
pathutil.IsPathExists(pth)→pathutil.NewPathChecker().IsPathExists(pth)pathutil.ListEntries(dir, filter)→pathutil.FilterFS(os.DirFS(dir), filter)The filter constructors (
ExtensionFilter,BaseFilter) are reused verbatim from v2 — same names, slightly differentFilterFuncsignature (now takesfs.DirEntry).utility/path_test.goFive subtests covering: direct match at root, match inside
.app, match inside a nested directory within a.app, not-found error, and direct-match-takes-precedence-over-bundle-search.Drive-by: go-utils/v2 dependency bump
Bumped
go-utils/v2fromalpha.34.0-pseudotov2.0.0-alpha.35.FilterFS,ExtensionFilter, andBaseFilterlanded in that tag via STEP-2135 / go-utils#224.Drive-by: regenerate
mocks/FileManager.go+ extenddevportalservice/mock_filemanager.goThe bump added
CopyFileFStofileutil.FileManager. Regenerated the mockery mock formocks/FileManager.go, and added a hand-writtenCopyFileFSpanic stub to the hand-rolleddevportalservice/mock_filemanager.goto keep both internal mocks satisfying the interface.Test plan
go test ./utility/...— all 5 subtests pass.go test ./...— whole repo green (xcarchive + xcodecache exercises take a couple of minutes; both pass).go build ./...— clean.gofmt -l utility/ devportalservice/mock_filemanager.go— clean.🤖 Generated with Claude Code