Skip to content

Commit 3f1b8dd

Browse files
fix: Merge Changes from dev to main
2 parents a9be69b + fe963b6 commit 3f1b8dd

File tree

15 files changed

+273
-83
lines changed

15 files changed

+273
-83
lines changed

.github/workflows/codeql.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,22 @@ name: "CodeQL Advanced"
1414
on:
1515
push:
1616
branches: [ "main", "dev", "demo" ]
17+
paths:
18+
- 'src/**/*.py'
19+
- 'src/**/*.js'
20+
- 'src/**/*.ts'
21+
- 'src/**/*.tsx'
22+
- 'tests/**/*.py'
23+
- '.github/workflows/codeql.yml'
1724
pull_request:
1825
branches: [ "main", "dev", "demo" ]
26+
paths:
27+
- 'src/**/*.py'
28+
- 'src/**/*.js'
29+
- 'src/**/*.ts'
30+
- 'src/**/*.tsx'
31+
- 'tests/**/*.py'
32+
- '.github/workflows/codeql.yml'
1933
schedule:
2034
- cron: '44 20 * * 2'
2135

@@ -91,4 +105,4 @@ jobs:
91105
- name: Perform CodeQL Analysis
92106
uses: github/codeql-action/analyze@v4
93107
with:
94-
category: "/language:${{matrix.language}}"
108+
category: "/language:${{matrix.language}}"

.github/workflows/deploy.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
elif [[ "${{ env.BRANCH_NAME }}" == "hotfix" ]]; then
127127
IMAGE_TAG="hotfix"
128128
else
129-
IMAGE_TAG="latest_v3"
129+
IMAGE_TAG="latest_v4"
130130
fi
131131
132132
# Generate current timestamp in desired format: YYYY-MM-DDTHH:MM:SS.SSSSSSSZ
@@ -183,28 +183,9 @@ jobs:
183183
184184
echo "Running post-deployment script..."
185185
186-
# Extract required resource names from the deployment
187-
STORAGE_ACCOUNT=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --resource-type "Microsoft.Storage/storageAccounts" --query "[0].name" -o tsv)
188-
AI_SEARCH=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --resource-type "Microsoft.Search/searchServices" --query "[0].name" -o tsv)
189-
190-
echo "Found Storage Account: $STORAGE_ACCOUNT"
191-
echo "Found AI Search Service: $AI_SEARCH"
192-
echo "Backend URL: ${{ steps.get_backend_url.outputs.MACAE_URL_API }}"
193-
194-
# Run upload team config script with parameters
195-
bash infra/scripts/upload_team_config.sh \
196-
"${{ steps.get_backend_url.outputs.MACAE_URL_API }}" \
197-
"data/agent_teams" \
198-
"${{ secrets.AZURE_SUBSCRIPTION_ID }}"
199-
200-
# Run process sample data script with parameters
201-
bash infra/scripts/process_sample_data.sh \
202-
"$STORAGE_ACCOUNT" \
203-
"sample-dataset" \
204-
"$AI_SEARCH" \
205-
"sample-dataset-index" \
206-
"${{ env.RESOURCE_GROUP_NAME }}" \
207-
"${{ secrets.AZURE_SUBSCRIPTION_ID }}"
186+
# Run PowerShell script with 'All' use case automatically selected
187+
# Provide two inputs: '1' for keeping current subscription, '5' for All use cases
188+
echo -e "1\n5" | pwsh -File infra/scripts/Selecting-Team-Config-And-Data.ps1 -ResourceGroup "${{ env.RESOURCE_GROUP_NAME }}"
208189
209190
echo "=== Post-Deployment Script Completed Successfully ==="
210191

.github/workflows/docker-build-and-push.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ on:
77
- dev-v4
88
- demo-v4
99
- hotfix
10+
paths:
11+
- 'src/frontend/**'
12+
- 'src/backend/**'
13+
- 'src/mcp_server/**'
14+
- '.github/workflows/docker-build-and-push.yml'
15+
- 'infra/main.bicep'
16+
- 'infra/modules/**/*.bicep'
17+
- 'infra/*.parameters.json'
18+
- 'infra/scripts/**'
19+
- '.github/workflows/deploy.yml'
20+
- 'azure.yaml'
21+
- 'azure_custom.yaml'
1022
pull_request:
1123
types:
1224
- opened
@@ -18,6 +30,18 @@ on:
1830
- dev-v4
1931
- demo-v4
2032
- hotfix
33+
paths:
34+
- 'src/frontend/**'
35+
- 'src/backend/**'
36+
- 'src/mcp_server/**'
37+
- '.github/workflows/docker-build-and-push.yml'
38+
- 'infra/main.bicep'
39+
- 'infra/modules/**/*.bicep'
40+
- 'infra/*.parameters.json'
41+
- 'infra/scripts/**'
42+
- '.github/workflows/deploy.yml'
43+
- 'azure.yaml'
44+
- 'azure_custom.yaml'
2145
workflow_dispatch:
2246

2347
jobs:

.github/workflows/job-deploy-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
set -e
174174
az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
175175
176-
# Set environment variables for team_config_and_data.sh
176+
# Set environment variables for selecting_team_config_and_data.sh
177177
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
178178
export AZURE_RESOURCE_GROUP="${{ inputs.RESOURCE_GROUP_NAME }}"
179179
export BACKEND_URL="${{ steps.get_output_linux.outputs.BACKEND_URL }}"

.github/workflows/job-send-notification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
runs-on: ubuntu-latest
7474
continue-on-error: true
7575
env:
76-
accelerator_name: "MACAE V3"
76+
accelerator_name: "MACAE V4"
7777
steps:
7878
- name: Determine Test Suite Display Name
7979
id: test_suite

.github/workflows/pylint.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: PyLint
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- 'src/backend/**/*.py'
7+
- 'src/mcp_server/**/*.py'
8+
- 'src/backend/requirements.txt'
9+
- '.flake8'
10+
- '.github/workflows/pylint.yml'
11+
412

513
jobs:
614
build:
@@ -24,4 +32,4 @@ jobs:
2432
2533
- name: Run flake8 and pylint
2634
run: |
27-
flake8 --config=.flake8 src/backend # Specify the directory to lint
35+
flake8 --config=.flake8 src/backend

.github/workflows/test-automation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
MACAE_URL_API: ${{ inputs.MACAE_URL_API }}
3232
MACAE_RG: ${{ inputs.MACAE_RG }}
3333
MACAE_CONTAINER_APP: ${{ inputs.MACAE_CONTAINER_APP }}
34-
accelerator_name: "MACAE v3"
34+
accelerator_name: "MACAE v4"
3535

3636
steps:
3737
- name: Checkout repository

.github/workflows/test.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,35 @@ on:
77
- dev
88
- demo
99
- hotfix
10+
paths:
11+
- 'src/backend/**/*.py'
12+
- 'src/tests/**/*.py'
13+
- 'src/mcp_server/**/*.py'
14+
- 'src/**/pyproject.toml'
15+
- 'pytest.ini'
16+
- 'conftest.py'
17+
- 'src/backend/requirements.txt'
18+
- '.github/workflows/test.yml'
1019
pull_request:
1120
types:
1221
- opened
1322
- ready_for_review
1423
- reopened
1524
- synchronize
1625
branches:
17-
- main
1826
- main
1927
- dev
2028
- demo
2129
- hotfix
30+
paths:
31+
- 'src/backend/**/*.py'
32+
- 'src/tests/**/*.py'
33+
- 'src/mcp_server/**/*.py'
34+
- 'pytest.ini'
35+
- 'conftest.py'
36+
- 'src/backend/requirements.txt'
37+
- 'src/**/pyproject.toml'
38+
- '.github/workflows/test.yml'
2239

2340
jobs:
2441
test:
@@ -73,4 +90,4 @@ jobs:
7390
- name: Skip coverage report if no tests
7491
if: env.skip_tests == 'true'
7592
run: |
76-
echo "Skipping coverage report because no tests were found."
93+
echo "Skipping coverage report because no tests were found."

src/backend/common/utils/utils_af.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,40 @@
1717

1818
async def find_first_available_team(team_service: TeamService, user_id: str) -> str:
1919
"""
20-
Check teams in priority order (4 to 1) and return the first available team ID.
21-
Priority: RFP (4) -> Retail (3) -> Marketing (2) -> HR (1)
20+
Check teams in priority order and return the first available team ID.
21+
First tries default teams in priority order, then falls back to any available team.
22+
Priority: RFP (4) -> Retail (3) -> Marketing (2) -> HR (1) -> Any available team
2223
"""
24+
# Standard team priority order
2325
team_priority_order = [
2426
"00000000-0000-0000-0000-000000000004", # RFP
2527
"00000000-0000-0000-0000-000000000003", # Retail
2628
"00000000-0000-0000-0000-000000000002", # Marketing
2729
"00000000-0000-0000-0000-000000000001", # HR
2830
]
2931

32+
# First, check standard teams in priority order
3033
for team_id in team_priority_order:
3134
try:
3235
team_config = await team_service.get_team_configuration(team_id, user_id)
3336
if team_config is not None:
34-
print(f"Found available team: {team_id}")
37+
print(f"Found available standard team: {team_id}")
3538
return team_id
3639
except Exception as e:
3740
print(f"Error checking team {team_id}: {str(e)}")
3841
continue
3942

40-
print("No teams found in priority order")
43+
# If no standard teams found, check for any available teams
44+
try:
45+
all_teams = await team_service.get_all_team_configurations()
46+
if all_teams:
47+
first_team = all_teams[0]
48+
print(f"Found available custom team: {first_team.team_id}")
49+
return first_team.team_id
50+
except Exception as e:
51+
print(f"Error checking for any available teams: {str(e)}")
52+
53+
print("No teams found in database")
4154
return None
4255

4356

src/backend/v4/api/router.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,33 +119,47 @@ async def init_team(
119119
memory_store = await DatabaseFactory.get_database(user_id=user_id)
120120
team_service = TeamService(memory_store)
121121

122-
# Find the first available team from 4 to 1, or use HR as fallback
123122
init_team_id = await find_first_available_team(team_service, user_id)
124-
if not init_team_id:
125-
init_team_id = "00000000-0000-0000-0000-000000000001" # HR fallback
126-
print("No available teams found, using HR fallback")
127-
else:
128-
print(f"Using first available team: {init_team_id}")
129123

124+
# Get current team if user has one
130125
user_current_team = await memory_store.get_current_team(user_id=user_id)
131-
if not user_current_team:
132-
print("User has no current team, setting to default:", init_team_id)
126+
127+
# If no teams available and no current team, return empty state to allow custom team upload
128+
if not init_team_id and not user_current_team:
129+
print("No teams found in database. System ready for custom team upload.")
130+
return {
131+
"status": "No teams configured. Please upload a team configuration to get started.",
132+
"team_id": None,
133+
"team": None,
134+
"requires_team_upload": True,
135+
}
136+
137+
# Use current team if available, otherwise use found team
138+
if user_current_team:
139+
init_team_id = user_current_team.team_id
140+
print(f"Using user's current team: {init_team_id}")
141+
elif init_team_id:
142+
print(f"Using first available team: {init_team_id}")
133143
user_current_team = await team_service.handle_team_selection(
134144
user_id=user_id, team_id=init_team_id
135145
)
136146
if user_current_team:
137147
init_team_id = user_current_team.team_id
138-
else:
139-
init_team_id = user_current_team.team_id
148+
140149
# Verify the team exists and user has access to it
141150
team_configuration = await team_service.get_team_configuration(
142151
init_team_id, user_id
143152
)
144153
if team_configuration is None:
145-
raise HTTPException(
146-
status_code=404,
147-
detail=f"Team configuration '{init_team_id}' not found or access denied",
148-
)
154+
# If team doesn't exist, clear current team and return empty state
155+
await memory_store.delete_current_team(user_id)
156+
print(f"Team configuration '{init_team_id}' not found. Cleared current team.")
157+
return {
158+
"status": "Current team configuration not found. Please select or upload a team configuration.",
159+
"team_id": None,
160+
"team": None,
161+
"requires_team_upload": True,
162+
}
149163

150164
# Set as current team in memory
151165
team_config.set_current_team(

0 commit comments

Comments
 (0)