Skip to content

[GroveAccount] Support module selectors in the @AccountKey macro - #74

Merged
lukaskollmer merged 9 commits into
SchmiedmayerLab:mainfrom
MonzerMansour:fix/account-key-module-selectors
Sep 27, 2026
Merged

lukaskollmer merged 9 commits into
SchmiedmayerLab:mainfrom
MonzerMansour:fix/account-key-module-selectors

Conversation

@MonzerMansour

@MonzerMansour MonzerMansour commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Raise the swift-syntax floor from 602 to 603 so @AccountKey can parse SE-0491 module selectors (ModuleA::Type).
  • Compare the as: type and property type annotation via token text (trivia-insensitive) instead of raw source text.
  • Add macro expansion tests for optional/required selectors, nested types, custom display/entry views, trivia tolerance, and type-mismatch diagnostics.

Motivation

Module selectors are required when a type name collides with a type from another module (e.g. app target vs GroveAccount). Under swift-syntax 602 the macro plugin treated :: as unexpected syntax and failed with “failed to parse the meta type expression in argument 'as'”.

Changes

Area Change
Package.swift swift-syntax "603.0.0"..<"604.0.0"
AccountKeyMacro.swift canonicalTypeText for type equality
AccountKeyMacroTests.swift New expansion/diagnostic cases for module selectors

Test plan

  • xcodebuild test -scheme Grove-Tests -testPlan GroveAccount → TEST SUCCEEDED
  • Xcode: scheme Grove-Tests, plan GroveAccount, destination My Mac → Test Completed
  • New accountKeyModuleSelector* / trivia / mismatch tests green
  • CI green on this PR

Out of scope

  • Broader monorepo failures unrelated to Account (e.g. XCTHealthKit XCTest API breakage)
  • Changes to other macros beyond the shared swift-syntax floor bump

Closes #15

SE-0491 module selectors (`ModuleA::GenderIdentity`) could not be parsed by
the macro plugin under swift-syntax 602. Raise the dependency floor to 603 so
`::` is modeled on existing type/expr nodes and flows into generated
`typealias Value` and view types. Compare the `as:` type against the binding's
type annotation by raw token text rather than source text including trivia, so
equivalent spellings are not reported as mismatches, and cover selector,
nested, UI, trivia, and mismatch cases in macro tests.

Resolves SchmiedmayerLab#15

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 97d1981a-9258-4921-aa10-dcacfc62f6e6


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lukaskollmer lukaskollmer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks for the contribution @MonzerMansour; works exactly as desiered and the implementation is super clean 🚀

i added an additional test case (which seems to be passing); will merge this once the other, unrelated test failures are addressed. i'll look into that soon.

@lukaskollmer lukaskollmer added the enhancement New feature or request label Sep 25, 2026
Select Xcode 26.6 and override inherited DEVELOPER_DIR for manifest evaluation and Apple test jobs to avoid the Swift 6.4 borrowing runtime issue on iOS 26.5. Pin the iPad simulator destination to iOS 26.5 as well.
@lukaskollmer
lukaskollmer merged commit 657b49a into SchmiedmayerLab:main Sep 27, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SpeziAccount] @AccountKey macro doesn't support keys whose types contain module selectors

2 participants