ci+test: run swift test in CI, add pure-helper test coverage (depends on #548)#551
Merged
Conversation
Test mode hardcodes the database name to 'swiftarr-test' (configure.swift:300), not honoring DATABASE_DB env var. Match the service container to that name.
Existing SettingsTests / ClientControllerTests need a migrated+seeded DB. That's separate infrastructure work outside this PR's scope. File a follow-up to wire DB-dependent tests into CI.
…de, validateStrLenOptional
… Settings calendar helpers
f7619d8 to
202397c
Compare
cohoe
approved these changes
May 3, 2026
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.
Draft — depends on #548 (libvips migration). Do not merge before #548.
Closes #550 (partially — see scope notes).
Summary
Testsibling job tobuild_branch.ymlthat runs pure-helper tests in CI insideswift:6.2-noble. Caches.build/keyed onPackage.resolved.GeometryTests—Color.init(hex:), 11 cases including invalid input.ValidatingJSONDecoderTests—ValidatingJSONDecoder.validate(_:from:), 8 cases includingvalidateStrLen, predicate validation, and decode-vs-validation-error distinction.CruiseDateTests— pureSettings.shared.getDateInCruiseWeektests (5 cases) that don't require app/DB spinup. setUp/tearDown mutateSettings.shared.cruiseStartDateComponents,cruiseLengthInDays, andcruiseStartDayOfWeekso the fixture cruise is self-contained and stable regardless of source-default drift.24 new tests total. All pass locally on macOS without DB and in CI.
Scope note: pure-helper-only filter
The CI
Testjob runsswift test --filter "GeometryTests|ValidatingJSONDecoderTests|CruiseDateTests|ThemeCookieTests"rather than the full suite. Bringing the existingSettingsTestsandClientControllerTestsinto CI is real infrastructure work that's out of scope for this PR:Application+Testable.swift:13callsSettings.shared.readTimeZoneChanges(app)beforewithApp { ... }runsapp.autoMigrate(). On a maintainer's local machine thetime_zone_changetable already exists from a priorswift run swiftarr migrate -y, so this works. On a pristine CI postgres it fails withrelation "time_zone_change" does not exist.SettingsTests.testPastDstDate(the lone case withoutwithApp) is hardcoded to assert against the 2024-03-09 cruise date, but the in-source default drifted to 2025-03-02 in Improvements to PersonalEvents #495. Running it in CI exposes the rot.Suggested follow-up: (1) move
autoMigrate()ahead ofreadTimeZoneChangesinApplication.testable(), (2) optionally rotate the SettingsTests fixtures to match the current source default OR convert them to the same self-contained setUp pattern this PR introduces inCruiseDateTests, (3) add postgres + redis service containers back to the workflow.Depends on #548
This branches from current master (pre-libvips). Once #548 lands, I'll rebase. Expected conflicts: one tiny error-type swap in
GeometryTests.swift(GDError.invalidColor→ImageError.invalidColor).Test plan