Skip to content

Resolve migrations recursively from each configured path - #46

Merged
slashmo merged 1 commit into
mainfrom
recursive-resolver
May 10, 2026
Merged

slashmo merged 1 commit into
mainfrom
recursive-resolver

Conversation

@slashmo

@slashmo slashmo commented May 9, 2026

Copy link
Copy Markdown
Member

FileSystemMigrationResolver now walks each entry in paths recursively and filters to .sql files, so nested layouts like migrations/repeatable/ work without listing every subfolder in paths.

Hidden directories are skipped — without that, Foundation's enumerator descends into the timestamped sibling directories Kubernetes maintains alongside ConfigMap volume mounts, surfacing every SQL file twice and tripping duplicate-ID detection (see Flyway #1807).

Two new typed errors fail loud on configuration mistakes: pathDoesNotExist when a configured path is missing, and duplicateMigrationID when the same id is resolved from overlapping paths — so paths: ["migrations", "migrations/nested"] is now a configuration error rather than producing silent duplicates.

@codecov

codecov Bot commented May 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ution/FileSystem/FileSystemMigrationResolver.swift 97.43% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@slashmo
slashmo force-pushed the recursive-resolver branch from 56ede4d to 3bf1192 Compare May 9, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates FileSystemMigrationResolver to discover migrations by recursively walking each configured path, filtering to .sql files, skipping hidden directories (to avoid Kubernetes ConfigMap ..* duplicates), and failing loudly on misconfiguration via new typed errors.

Changes:

  • Recursively enumerate migration directories and only resolve .sql files.
  • Skip hidden directories/files during enumeration to avoid duplicate resolution on certain filesystems (e.g., Kubernetes mounts).
  • Introduce new resolver errors for missing paths and duplicate migration IDs; update and expand test coverage accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Sources/Crane/Resolution/FileSystem/FileSystemMigrationResolver.swift Switches to recursive enumeration, adds hidden/non-.sql filtering, and throws new typed errors for invalid paths and duplicate IDs.
Tests/CraneTests/Resolution/FileSystem/FileSystemMigrationResolverTests.swift Updates existing tests for recursive behavior and adds new tests for missing paths, hidden dir skipping, non-.sql skipping, and duplicate ID detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Tests/CraneTests/Resolution/FileSystem/FileSystemMigrationResolverTests.swift Outdated
@slashmo
slashmo force-pushed the recursive-resolver branch from 3bf1192 to 48b2cf3 Compare May 9, 2026 15:50
@github-actions

github-actions Bot commented May 9, 2026 •

Copy link
Copy Markdown

❌ Benchmark comparison failed with error ❌

Summary `Throughput (# / s)` not found in both baselines, skipping it. One or more benchmarks, including `CraneBenchmarks:FileSystemMigrationResolver: Resolve recursively` was not found in one of the baselines.
=====================================================================================
Threshold deviations for CraneBenchmarks:FileSystemMigrationResolver: Read SQL Script
=====================================================================================
Time (total CPU) (ms, %) main pull_request Difference % Threshold %
p75 20 10 -50 5
=============================================================================
Threshold deviations for CraneBenchmarks:FileSystemMigrationResolver: Resolve
=============================================================================
Time (wall clock) (ms, %) main pull_request Difference % Threshold %
p25 13388 64 -99 5
p50 13388 65 -99 5
p75 13388 65 -99 5
Time (total CPU) (ms, %) main pull_request Difference % Threshold %
p25 13460 60 -99 5
p50 13460 60 -99 5
p75 13460 70 -99 5
Malloc (total) (K, %) main pull_request Difference % Threshold %
p25 18059 75 -99 5
p50 18059 75 -99 5
p75 18059 75 -99 5

New baseline 'pull_request' is BETTER than the 'main' baseline thresholds.

Full Benchmark Comparison

Comparing results between 'main' and 'pull_request'

Host '848a2f37d513' with 4 'x86_64' processors with 15 GB memory, running:
#10~24.04.1-Ubuntu SMP Fri Mar  6 22:00:57 UTC 2026

CraneBenchmarks

FileSystemMigrationResolver: Read SQL Script metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (μs) * p0 p25 p50 p75 p90 p99 p100 Samples
main 12 12 12 12 12 12 12 81
pull_request 12 12 12 12 12 12 12 81
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

Time (total CPU): results within specified thresholds, fold down for details.

Time (total CPU) (μs) * p0 p25 p50 p75 p90 p99 p100 Samples
main 0 10 10 20 20 20 20 81
pull_request 0 10 10 10 20 20 20 81
Δ 0 0 0 -10 0 0 0 0
Improvement % 0 0 0 50 0 0 0 0

Throughput (# / s): results within specified thresholds, fold down for details.

Throughput (# / s) (K) p0 p25 p50 p75 p90 p99 p100 Samples
main 84 83 83 83 83 82 82 81
pull_request 85 84 84 84 83 83 83 81
Δ 1 1 1 1 0 1 1 0
Improvement % 1 1 1 1 0 1 1 0

Memory (resident peak): results within specified thresholds, fold down for details.

Memory (resident peak) (M) p0 p25 p50 p75 p90 p99 p100 Samples
main 48 48 48 48 48 48 48 81
pull_request 49 49 49 49 49 49 49 81
Δ 1 1 1 1 1 1 1 0
Improvement % -2 -2 -2 -2 -2 -2 -2 0

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 9 9 9 9 9 9 9 81
pull_request 9 9 9 9 9 9 9 81
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

FileSystemMigrationResolver: Resolve metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 13 13 13 13 13 13 13 1
pull_request 0 0 0 0 0 0 0 16
Δ -13 -13 -13 -13 -13 -13 -13 15
Improvement % 0 0 0 0 0 0 0 15

Time (total CPU): results within specified thresholds, fold down for details.

Time (total CPU) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 13 13 13 13 13 13 13 1
pull_request 0 0 0 0 0 0 0 16
Δ -13 -13 -13 -13 -13 -13 -13 15
Improvement % 0 0 0 0 0 0 0 15

Memory (resident peak): results within specified thresholds, fold down for details.

Memory (resident peak) (M) p0 p25 p50 p75 p90 p99 p100 Samples
main 48 48 48 48 48 48 48 1
pull_request 49 49 49 49 49 49 49 16
Δ 1 1 1 1 1 1 1 15
Improvement % -2 -2 -2 -2 -2 -2 -2 15

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) (K) * p0 p25 p50 p75 p90 p99 p100 Samples
main 18 18 18 18 18 18 18 1
pull_request 0 0 0 0 0 0 0 16
Δ -18 -18 -18 -18 -18 -18 -18 15
Improvement % 0 0 0 0 0 0 0 15

@slashmo
slashmo force-pushed the recursive-resolver branch 2 times, most recently from aa81719 to bfcb869 Compare May 10, 2026 11:36
@slashmo
slashmo force-pushed the recursive-resolver branch from bfcb869 to f47c102 Compare May 10, 2026 11:55
@slashmo
slashmo merged commit 7e03091 into main May 10, 2026
17 of 18 checks passed
@slashmo
slashmo deleted the recursive-resolver branch May 10, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants