Skip to content

feat(spanner): Implement SyncUserProfileInfo with mappers#2009

Merged
jcscottiii merged 1 commit intomainfrom
jcscottiii/sync-profile-backend
Nov 18, 2025
Merged

feat(spanner): Implement SyncUserProfileInfo with mappers#2009
jcscottiii merged 1 commit intomainfrom
jcscottiii/sync-profile-backend

Conversation

@jcscottiii
Copy link
Copy Markdown
Collaborator

@jcscottiii jcscottiii commented Nov 14, 2025

Implements the SyncUserProfileInfo functionality and related logic, fully leveraging the existing mapper pattern for atomic database operations. This new feature:

  • Introduces New Files: Adds lib/gcpspanner/user_notification_channel.go and lib/gcpspanner/user_notification_channel_test.go to manage user notification channels.
  • Uses Transactional Helpers: Leverages the ...WithTransaction variants of the generic entity helpers (newEntityCreator, newEntityWriter) to ensure all database operations within SyncUserProfileInfo occur within a single, atomic transaction. This is a critical improvement for data integrity.

For now, this implementation will re-activate a user's email channel if it was previously disabled on our side but is present in their verified GitHub emails. In the future, we may want to provide a manual way for users to re-enable channels themselves. This is captured in issue #2021.

Base automatically changed from jcscottiii/backend-github-api to main November 17, 2025 22:03
@jcscottiii jcscottiii force-pushed the jcscottiii/sync-profile-backend branch from 3263054 to 88ab0fc Compare November 17, 2025 22:44
Implements the `SyncUserProfileInfo` functionality and related logic, fully leveraging the existing mapper pattern for atomic database operations. This new feature:

- **Introduces New Files**: Adds `lib/gcpspanner/user_notification_channel.go` and `lib/gcpspanner/user_notification_channel_test.go` to manage user notification channels.
- **Uses Transactional Helpers**: Leverages the `...WithTransaction` variants of the generic entity helpers (`newEntityCreator`, `newEntityWriter`) to ensure all database operations within `SyncUserProfileInfo` occur within a single, atomic transaction. This is a critical improvement for data integrity.

For now, this implementation will re-activate a user's email channel if it was previously disabled on our side but is present in their verified GitHub emails. In the future, we may want to provide a manual way for users to re-enable channels themselves. This is captured in issue #2021.temp
@jcscottiii jcscottiii force-pushed the jcscottiii/sync-profile-backend branch from 88ab0fc to a484fcc Compare November 18, 2025 15:55
@jcscottiii jcscottiii changed the title temp feat(spanner): Implement SyncUserProfileInfo with mappers Nov 18, 2025
jcscottiii added a commit that referenced this pull request Nov 18, 2025
…d mapper best practices

This commit significantly updates the GEMINI.md knowledge base to reflect recent changes and codify best practices. Key updates include:

- **Updated Last Analyzed Commit**: The SHA for the last analyzed commit has been updated to 4b12e1c.
- **New Section: User Authentication and Notifications**: A new section (3.4) has been added to describe the architecture and data flow for user authentication, profile synchronization, notification channels, and saved search subscriptions. This includes correcting the API endpoint and handler names for user profile sync.
- **Mapper Best Practices**: The "Go Mapper Pattern for Spanner" section (3.2.1) has been enhanced with new guidelines:
    - An explicit "DO" rule to ensure `mergeMapper` implementations correctly copy all fields, especially `UpdatedAt`.
    - A new subsection "Using Mappers within a Transaction" detailing the importance of using `...WithTransaction` variants of generic helpers within `ReadWriteTransaction` blocks and cautioning against standard helpers or manual mutation creation in such contexts.
- **Architectural Layering**: A new "DON'T" rule has been added to prevent `lib/gcpspanner` from importing `lib/backendtypes`, reinforcing architectural separation.
- **"Verify, Don't Assume" Principle**: A new core principle (5.9) has been introduced, emphasizing the importance of verifying information against canonical sources of truth (e.g., `openapi.yaml` for APIs, migration files for schema). This principle is also cross-referenced in the "Specifications & Generated Code" (Section 4) and "How-To Guides" (Section 6) sections, and explicitly integrated into the knowledge base update process (Section 7.2).

These updates aim to improve the accuracy, clarity, and utility of the knowledge base for future development.

I had GEMINI analyze #2009 and what existed on upstream main.
@jcscottiii jcscottiii marked this pull request as ready for review November 18, 2025 16:17
@jcscottiii jcscottiii requested a review from jrobbins November 18, 2025 16:17
@jcscottiii jcscottiii linked an issue Nov 18, 2025 that may be closed by this pull request
@jcscottiii jcscottiii added this pull request to the merge queue Nov 18, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2025
@jcscottiii jcscottiii added this pull request to the merge queue Nov 18, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Nov 18, 2025
…d mapper best practices (#2022)

* docs(gemini): Update knowledge base with user auth, notifications, and mapper best practices

This commit significantly updates the GEMINI.md knowledge base to reflect recent changes and codify best practices. Key updates include:

- **Updated Last Analyzed Commit**: The SHA for the last analyzed commit has been updated to 4b12e1c.
- **New Section: User Authentication and Notifications**: A new section (3.4) has been added to describe the architecture and data flow for user authentication, profile synchronization, notification channels, and saved search subscriptions. This includes correcting the API endpoint and handler names for user profile sync.
- **Mapper Best Practices**: The "Go Mapper Pattern for Spanner" section (3.2.1) has been enhanced with new guidelines:
    - An explicit "DO" rule to ensure `mergeMapper` implementations correctly copy all fields, especially `UpdatedAt`.
    - A new subsection "Using Mappers within a Transaction" detailing the importance of using `...WithTransaction` variants of generic helpers within `ReadWriteTransaction` blocks and cautioning against standard helpers or manual mutation creation in such contexts.
- **Architectural Layering**: A new "DON'T" rule has been added to prevent `lib/gcpspanner` from importing `lib/backendtypes`, reinforcing architectural separation.
- **"Verify, Don't Assume" Principle**: A new core principle (5.9) has been introduced, emphasizing the importance of verifying information against canonical sources of truth (e.g., `openapi.yaml` for APIs, migration files for schema). This principle is also cross-referenced in the "Specifications & Generated Code" (Section 4) and "How-To Guides" (Section 6) sections, and explicitly integrated into the knowledge base update process (Section 7.2).

These updates aim to improve the accuracy, clarity, and utility of the knowledge base for future development.

I had GEMINI analyze #2009 and what existed on upstream main.

* Merge changes from #1960

* lint fix

* more details

* lint fix
Merged via the queue into main with commit 54b866d Nov 18, 2025
8 of 9 checks passed
@jcscottiii jcscottiii deleted the jcscottiii/sync-profile-backend branch November 18, 2025 20:16
@jcscottiii jcscottiii linked an issue Jan 22, 2026 that may be closed by this pull request
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.

[spanneradapter] Add Methods to Update Channel Health

2 participants