Skip to content

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

Open
MonzerMansour wants to merge 1 commit into
SchmiedmayerLab:mainfrom
MonzerMansour:fix/account-key-module-selectors
Open

[GroveAccount] Support module selectors in the @AccountKey macro#74
MonzerMansour wants to merge 1 commit into
SchmiedmayerLab:mainfrom
MonzerMansour:fix/account-key-module-selectors

Conversation

@MonzerMansour

Copy link
Copy Markdown

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 GroveAccountTEST 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

Made with Cursor

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: Pro Plus

Run ID: 5b4f7c4e-0609-49d8-ae0e-91e8dc97e799


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.

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.

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

1 participant