[breaking change] update deps#35
Conversation
📝 WalkthroughWalkthrough
ChangesSpezi dependency consolidation and localized study metadata
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
| .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.6.2"), | ||
| // not used directly but we need to fix it below 0.9.0 for the time being | ||
| .package(url: "https://github.com/apple/FHIRModels.git", .upToNextMinor(from: "0.8.0")) | ||
| .package(url: "https://github.com/SchmiedmayerLab/Spezi.git", revision: "d0f1e1cee93392ee7a0d64849a8dbf107d98a39e"), |
There was a problem hiding this comment.
TODO update to a tagged release before merging, once SchmiedmayerLab/Spezi#1 is merged
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Package.swift`:
- Around line 42-47: The MHCStudyDefinitionExporter target's dependencies array
is missing three required Spezi products that are imported by the target. Add
the following three product dependencies to the dependencies array in
Package.swift: .product(name: "SpeziFoundation", package: "Spezi"),
.product(name: "SpeziHealthKit", package: "Spezi"), and .product(name:
"SpeziScheduler", package: "Spezi"). These products must be declared in the same
format as the existing Spezi products in the dependencies list to ensure the
target can access the imported modules and compile successfully.
In `@Sources/MHCStudyDefinitionExporter/Study.swift`:
- Around line 43-49: The explanationText property in the metadata initialization
for the Study definition is set to an empty dictionary, which violates Spezi 0.2
requirements that mandate at least one localization entry in localized
dictionaries. Replace the empty dictionary in explanationText with at least one
language entry following the same pattern as shortExplanationText, using the
format [.enUS: "descriptive text"] to provide localized content for the UI.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3ae0d055-4064-4b3c-9cab-65c8de1d159f
📒 Files selected for processing (2)
Package.swiftSources/MHCStudyDefinitionExporter/Study.swift
| dependencies: [ | ||
| "MHCStudyDefinition", | ||
| .product(name: "SpeziStudyDefinition", package: "SpeziStudy"), | ||
| .product(name: "SpeziStudy", package: "SpeziStudy"), | ||
| .product(name: "SpeziLocalization", package: "SpeziFoundation") | ||
| .product(name: "SpeziStudyDefinition", package: "Spezi"), | ||
| .product(name: "SpeziStudy", package: "Spezi"), | ||
| .product(name: "SpeziLocalization", package: "Spezi") | ||
| ], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check imported Spezi modules in the exporter target.
rg -n '^import\s+Spezi' Sources/MHCStudyDefinitionExporter -C1
# Check declared dependencies for MHCStudyDefinitionExporter in Package.swift.
rg -n 'name:\s*"MHCStudyDefinitionExporter"|\.product\(name:\s*"(Spezi[^"]+|ArgumentParser)"' Package.swift -C5Repository: SchmiedmayerLab/MyHeartCounts-StudyDefinitions
Length of output: 3455
🏁 Script executed:
#!/bin/bash
# Verify exact imports across MHCStudyDefinitionExporter target
echo "=== All Spezi imports in MHCStudyDefinitionExporter target ==="
rg -n 'import Spezi' Sources/MHCStudyDefinitionExporter --no-heading | sort | uniq
# Get the Spezi package revision
echo -e "\n=== Spezi package revision in Package.swift ==="
rg 'revision:|from:' Package.swift | grep -A1 'SchmiedmayerLab/Spezi'Repository: SchmiedmayerLab/MyHeartCounts-StudyDefinitions
Length of output: 1034
🌐 Web query:
Spezi framework re-exports SpeziFoundation SpeziHealthKit SpeziScheduler dependencies
💡 Result:
The core Spezi framework does not globally re-export SpeziFoundation, SpeziHealthKit, or SpeziScheduler [1]. In the Stanford Spezi ecosystem, Spezi, SpeziFoundation, SpeziHealthKit, and SpeziScheduler are distinct Swift packages [2][3][4][1]. The Spezi framework itself explicitly lists SpeziFoundation as a dependency in its Package.swift file [1], but it does not use the @_exported attribute to re-export it or other modules to its consumers. Individual modules within the ecosystem handle their own imports and exports as needed: - SpeziHealthKit, for example, imports SpeziFoundation and, in some cases, selectively re-exports specific components (such as the ArrayBuilder enum) to make them available to downstream consumers of the HealthKit module [5][6]. - Dependencies between these packages are typically managed through standard Swift Package Manager dependency declarations in each project's Package.swift file [2][1][7][8], rather than through global re-exports from the core Spezi framework. Consumers of these frameworks are expected to import the specific modules they require directly [4].
Citations:
- 1: https://github.com/StanfordSpezi/Spezi/blob/main/Package.swift
- 2: https://github.com/StanfordSpezi/SpeziStudy/blob/main/Package.swift
- 3: https://github.com/StanfordSpezi/SpeziScheduler
- 4: https://github.com/StanfordSpezi/SpeziHealthKit
- 5: fix imports StanfordSpezi/SpeziHealthKit#82
- 6: StanfordSpezi/SpeziHealthKit@bdb6400
- 7: https://github.com/StanfordSpezi/SpeziAccount/blob/main/Package.swift
- 8: https://github.com/StanfordSpezi/SpeziLLM/blob/main/Package.swift
Add missing Spezi package dependencies for MHCStudyDefinitionExporter.
MHCStudyDefinitionExporter imports SpeziFoundation, SpeziHealthKit, and SpeziScheduler, but the target's dependency list (lines 42–47) does not declare these products. These are distinct packages in the Spezi ecosystem that are not re-exported by the currently declared dependencies (SpeziStudyDefinition, SpeziStudy, SpeziLocalization). Add the following to the dependencies:
.product(name: "SpeziFoundation", package: "Spezi").product(name: "SpeziHealthKit", package: "Spezi").product(name: "SpeziScheduler", package: "Spezi")
This target will fail to compile without these declarations.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Package.swift` around lines 42 - 47, The MHCStudyDefinitionExporter target's
dependencies array is missing three required Spezi products that are imported by
the target. Add the following three product dependencies to the dependencies
array in Package.swift: .product(name: "SpeziFoundation", package: "Spezi"),
.product(name: "SpeziHealthKit", package: "Spezi"), and .product(name:
"SpeziScheduler", package: "Spezi"). These products must be declared in the same
format as the existing Spezi products in the dependencies list to ensure the
target can access the imported modules and compile successfully.
| metadata: .init( | ||
| id: .mhcStudy, | ||
| title: "My Heart Counts", | ||
| shortTitle: "MHC", | ||
| title: [.enUS: "My Heart Counts"], | ||
| shortTitle: [.enUS: "MHC"], | ||
| icon: .systemSymbol("cube.transparent"), | ||
| explanationText: "", | ||
| shortExplanationText: "Improve your cardiovascular health", | ||
| explanationText: [:], | ||
| shortExplanationText: [.enUS: "Improve your cardiovascular health"], |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In SpeziStudyDefinition (from the Spezi 0.2 line), what are the requirements/defaults for StudyDefinition metadata fields explanationTextandenrollmentConditions? Is an empty explanationText localization dictionary valid?
💡 Result:
For SpeziStudyDefinition in the Spezi 0.2 line, the study definition metadata fields are: 1) explanationText - In the 0.2.x line, explanationText is represented as a localized dictionary (a mapping from localization keys/locale identifiers to strings), not as a single scalar string. One example study-definition change explicitly mentions “localized dictionary metadata for … explanationText”. [1][2] - The sources found here do not state an explicit validation rule about whether the dictionary may be empty. However, the localization change history indicates the field is expected to be provided via the localized dictionary mechanism. [1][2] 2) enrollmentConditions - In the 0.2.x line referenced in the provided sources, enrollmentConditions was removed from the exported study metadata: a change log states “Previously present enrollmentConditions:.none removed from metadata.” [1] - The follow-up change also states that explicit enrollmentConditions was removed from metadata. [2] Is an empty explanationText localization dictionary valid? - Based on the evidence retrieved, there is no explicit statement in the sources found that confirms whether an empty localization dictionary is considered valid for explanationText in Spezi 0.2. - What can be said with evidence is that in 0.2, explanationText is expected to be supplied using the localized dictionary approach, and enrollmentConditions is not present (it was removed). [1][2] Practical recommendation - Treat an empty explanationText dictionary as likely invalid/unsupported unless you can confirm via the Spezi 0.2 SpeziStudy/SpeziStudyDefinition API docs or unit tests; ensure at least one locale entry is present (e.g., English) so the UI has text to render. (This is a conservative inference given the lack of an explicit “empty dictionary allowed” rule in the sources we found.) [1][2]
Citations:
Add at least one language entry to explanationText.
explanationText: [:] creates an empty localization dictionary. In Spezi 0.2, explanationText must be a localized dictionary, but an empty one provides no text for any language and will fail validation or render no content in the UI. Add at least one language entry (e.g., [.enUS: "..."]). This aligns with the confirmed Spezi 0.2 metadata contract where localization dictionaries require at least one locale entry.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Sources/MHCStudyDefinitionExporter/Study.swift` around lines 43 - 49, The
explanationText property in the metadata initialization for the Study definition
is set to an empty dictionary, which violates Spezi 0.2 requirements that
mandate at least one localization entry in localized dictionaries. Replace the
empty dictionary in explanationText with at least one language entry following
the same pattern as shortExplanationText, using the format [.enUS: "descriptive
text"] to provide localized content for the UI.
[breaking change] update deps
♻️ Current situation & Problem
updates Spezi to the new repo; as part of this we also update from what used to be SpeziStudy 0.1.x to what used to be SpeziStudy 0.2.x
⚙️ Release Notes
📚 Documentation
n/a
✅ Testing
n/a
Code of Conduct & Contributing Guidelines
By creating and submitting this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:
Summary by CodeRabbit
New Features
Chores