Skip to content

fix: dev to main merge - #1141

Merged
Roopan-Microsoft merged 7 commits into
mainfrom
dev
Aug 17, 2026
Merged

fix: dev to main merge #1141
Roopan-Microsoft merged 7 commits into
mainfrom
dev

Conversation

@Dhruvkumar-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request focuses on improving the idempotency and event logging consistency of the team configuration upload process. The main changes ensure that re-uploading a team configuration does not create duplicate database entries and that event logging uses a consistent field name.

Team configuration upload and storage improvements:

  • The save_team_configuration method in TeamService is now idempotent by team_id: it checks if a team already exists and, if so, updates the existing record instead of creating a new one. This prevents duplicate database entries when re-running the seed script.

Event logging consistency:

  • Standardized the event log field from filename to file_name in all relevant responses and tracking calls within the upload_team_config endpoint for consistency. [1] [2] [3] [4]

Script behavior change:

  • The upload script (upload_team_config.py) no longer deletes existing teams before uploading; it relies on the backend's idempotent upsert logic to handle updates.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Dhruvkumar-Microsoft and others added 2 commits August 13, 2026 19:11
fix: updated the team upload functionality while rerunning the post deployment script to fix duplicate team issue
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

Coverage

Coverage Report •
FileStmtsMissCoverMissing
api
   router.py5386887%63–64, 83–84, 93–94, 98, 113, 116, 124–125, 133–134, 363–365, 375, 407–408, 426, 431–432, 434–436, 439, 451–452, 460, 535–536, 624, 626, 629, 749–754, 758, 781, 812–815, 835, 907–908, 917, 980–981, 987, 1091–1092, 1117–1119, 1497–1506
services
   team_service.py286797%73, 314–316, 499–501
TOTAL383255285% 

Tests Skipped Failures Errors Time
835 0 💤 0 ❌ 0 🔥 9.914s ⏱️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the team-configuration upload/seed workflow by making team configuration persistence idempotent (avoiding duplicate CosmosDB team config documents on re-upload) and by standardizing upload-related telemetry/response payload fields for the uploaded file name.

Changes:

  • Updated TeamService.save_team_configuration to reuse an existing team config document (by team_id) and update it instead of always inserting a new document.
  • Standardized upload validation event/log payload key from filename to file_name in /upload_team_config.
  • Removed the pre-upload “delete existing team” behavior from the post-provision upload script so it relies on backend upsert/update behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/backend/services/team_service.py Adds idempotent save logic by looking up an existing team by team_id and updating instead of always creating.
src/backend/api/router.py Standardizes upload validation event payload key to file_name for consistency.
infra/scripts/post-provision/upload_team_config.py Stops deleting existing teams before upload, relying on backend idempotency instead.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/backend/services/team_service.py
Comment thread src/backend/services/team_service.py
Comment thread infra/scripts/post-provision/upload_team_config.py
Copilot AI review requested due to automatic review settings August 14, 2026 04:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/backend/services/team_service.py:183

  • save_team_configuration currently upserts any existing record returned by memory_context.get_team(team_id). In the CosmosDB implementation, get_team can return shared default teams (query includes OR c.is_default=true), so a user uploading a config with the same team_id could overwrite a shared default team configuration.
            existing = await self.memory_context.get_team(team_config.team_id)
            if existing is not None:
                # Preserve immutable identity fields; partition key (session_id)
                # cannot change on an upsert.
                team_config.id = existing.id

Copilot AI review requested due to automatic review settings August 17, 2026 05:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/backend/services/team_service.py:185

  • When an existing team is found, this method upserts the entire document via update_team (Cosmos uses upsert_item). Only preserving id/session_id/created/created_by means other important fields (notably user_id and is_default) will be overwritten by the newly parsed upload. That can accidentally flip a shared default team (is_default=true) into a user-owned/non-default team (or change ownership), affecting visibility and potentially allowing users to overwrite shared defaults by reusing a known team_id. Preserve these fields from the existing document (or explicitly block updates to default teams for non-admin callers).
                # Preserve immutable identity fields; partition key (session_id)
                # cannot change on an upsert.
                team_config.id = existing.id
                team_config.session_id = existing.session_id
                team_config.created = existing.created

@Roopan-Microsoft
Roopan-Microsoft merged commit 050224e into main Aug 17, 2026
13 checks passed
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.

5 participants