Skip to content

Commit b70c4c9

Browse files
committed
Merge branch 'main' into codeflash-trace-decorator
2 parents fce641e + 9005337 commit b70c4c9

10 files changed

+70
-71
lines changed

.github/workflows/codeflash-optimize.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ jobs:
1515
optimize:
1616
name: Optimize new Python code
1717
# Dynamically determine if environment is needed only when workflow files change and contributor is external
18-
environment: ${{
19-
github.event_name == 'workflow_dispatch' ||
20-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
21-
github.event.pull_request.user.login != 'misrasaurabh1' &&
22-
github.event.pull_request.user.login != 'KRRT7'
23-
? 'external-trusted-contributors' : ''
24-
}}
18+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
2519
if: ${{ github.actor != 'codeflash-ai[bot]' }}
2620
runs-on: ubuntu-latest
2721
env:
@@ -38,7 +32,7 @@ jobs:
3832
- name: Validate PR
3933
run: |
4034
# Check for any workflow changes
41-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
35+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
4236
echo "⚠️ Workflow changes detected."
4337
4438
# Get the PR author

.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ on:
1111
jobs:
1212
bubble-sort-optimization-pytest-no-git:
1313
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14-
environment: ${{
15-
github.event_name == 'workflow_dispatch' ||
16-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17-
github.event.pull_request.user.login != 'misrasaurabh1' &&
18-
github.event.pull_request.user.login != 'KRRT7'
19-
? 'external-trusted-contributors': ''
20-
}}
14+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
15+
2116
runs-on: ubuntu-latest
2217
env:
2318
CODEFLASH_AIS_SERVER: prod
@@ -36,7 +31,7 @@ jobs:
3631
- name: Validate PR
3732
run: |
3833
# Check for any workflow changes
39-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
34+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
4035
echo "⚠️ Workflow changes detected."
4136
4237
# Get the PR author

.github/workflows/end-to-end-test-bubblesort-unittest.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ on:
1111
jobs:
1212
bubble-sort-optimization-unittest:
1313
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14-
environment: ${{
15-
github.event_name == 'workflow_dispatch' ||
16-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17-
github.event.pull_request.user.login != 'misrasaurabh1' &&
18-
github.event.pull_request.user.login != 'KRRT7'
19-
? 'external-trusted-contributors': ''
20-
}}
14+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
15+
2116
runs-on: ubuntu-latest
2217
env:
2318
CODEFLASH_AIS_SERVER: prod
@@ -36,7 +31,7 @@ jobs:
3631
- name: Validate PR
3732
run: |
3833
# Check for any workflow changes
39-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
34+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
4035
echo "⚠️ Workflow changes detected."
4136
4237
# Get the PR author
@@ -46,7 +41,7 @@ jobs:
4641
# Allowlist check
4742
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4843
echo "✅ Authorized user ($AUTHOR). Proceeding."
49-
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
44+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
5045
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
5146
else
5247
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."

.github/workflows/end-to-end-test-coverage.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ on:
1111
jobs:
1212
end-to-end-test-coverage:
1313
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14-
environment: ${{
15-
github.event_name == 'workflow_dispatch' ||
16-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17-
github.event.pull_request.user.login != 'misrasaurabh1' &&
18-
github.event.pull_request.user.login != 'KRRT7'
19-
? 'external-trusted-contributors': ''
20-
}}
14+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
15+
2116
runs-on: ubuntu-latest
2217
env:
2318
CODEFLASH_AIS_SERVER: prod
@@ -34,7 +29,7 @@ jobs:
3429
- name: Validate PR
3530
run: |
3631
# Check for any workflow changes
37-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
32+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
3833
echo "⚠️ Workflow changes detected."
3934
4035
# Get the PR author
@@ -44,7 +39,7 @@ jobs:
4439
# Allowlist check
4540
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4641
echo "✅ Authorized user ($AUTHOR). Proceeding."
47-
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
42+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
4843
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4944
else
5045
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."

.github/workflows/end-to-end-test-futurehouse.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ on:
1111
jobs:
1212
futurehouse-structure:
1313
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14-
environment: ${{
15-
github.event_name == 'workflow_dispatch' ||
16-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17-
github.event.pull_request.user.login != 'misrasaurabh1' &&
18-
github.event.pull_request.user.login != 'KRRT7'
19-
? 'external-trusted-contributors': ''
20-
}}
14+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
15+
2116
runs-on: ubuntu-latest
2217
env:
2318
CODEFLASH_AIS_SERVER: prod
@@ -36,7 +31,7 @@ jobs:
3631
- name: Validate PR
3732
run: |
3833
# Check for any workflow changes
39-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
34+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
4035
echo "⚠️ Workflow changes detected."
4136
4237
# Get the PR author
@@ -46,7 +41,7 @@ jobs:
4641
# Allowlist check
4742
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4843
echo "✅ Authorized user ($AUTHOR). Proceeding."
49-
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
44+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
5045
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
5146
else
5247
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."

.github/workflows/end-to-end-test-init-optim.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ on:
1010
jobs:
1111
init-optimization:
1212
# Dynamically determine if environment is needed only when workflow files change and contributor is external
13-
environment: ${{
14-
github.event_name == 'workflow_dispatch' ||
15-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
16-
github.event.pull_request.user.login != 'misrasaurabh1' &&
17-
github.event.pull_request.user.login != 'KRRT7'
18-
? 'external-trusted-contributors': ''
19-
}}
13+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
14+
2015
runs-on: ubuntu-latest
2116
env:
2217
CODEFLASH_AIS_SERVER: prod
@@ -35,7 +30,7 @@ jobs:
3530
- name: Validate PR
3631
run: |
3732
# Check for any workflow changes
38-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
33+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
3934
echo "⚠️ Workflow changes detected."
4035
4136
# Get the PR author
@@ -45,7 +40,7 @@ jobs:
4540
# Allowlist check
4641
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4742
echo "✅ Authorized user ($AUTHOR). Proceeding."
48-
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
43+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
4944
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
5045
else
5146
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."

.github/workflows/end-to-end-test-tracer-replay.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ on:
1010
jobs:
1111
tracer-replay:
1212
# Dynamically determine if environment is needed only when workflow files change and contributor is external
13-
environment: ${{
14-
github.event_name == 'workflow_dispatch' ||
15-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
16-
github.event.pull_request.user.login != 'misrasaurabh1' &&
17-
github.event.pull_request.user.login != 'KRRT7'
18-
? 'external-trusted-contributors': ''
19-
}}
13+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
14+
2015
runs-on: ubuntu-latest
2116
env:
2217
CODEFLASH_AIS_SERVER: prod
@@ -35,7 +30,7 @@ jobs:
3530
- name: Validate PR
3631
run: |
3732
# Check for any workflow changes
38-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
33+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
3934
echo "⚠️ Workflow changes detected."
4035
4136
# Get the PR author
@@ -45,7 +40,7 @@ jobs:
4540
# Allowlist check
4641
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4742
echo "✅ Authorized user ($AUTHOR). Proceeding."
48-
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
43+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
4944
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
5045
else
5146
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."

.github/workflows/end-to-end-topological-sort-test.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ on:
1111
jobs:
1212
topological-sort-optimization:
1313
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14-
environment: ${{
15-
github.event_name == 'workflow_dispatch' ||
16-
contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17-
github.event.pull_request.user.login != 'misrasaurabh1' &&
18-
github.event.pull_request.user.login != 'KRRT7'
19-
? 'external-trusted-contributors': ''
20-
}}
14+
environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}
2115
runs-on: ubuntu-latest
2216
env:
2317
CODEFLASH_AIS_SERVER: prod
@@ -33,11 +27,38 @@ jobs:
3327
with:
3428
fetch-depth: 0
3529
token: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Debug Environment Decision
31+
run: |
32+
# Construct the condition result manually for debugging
33+
EVENT_NAME="${{ github.event_name }}"
34+
FILES_CHANGED="${{ toJSON(github.event.pull_request.files.*.filename) }}"
35+
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
36+
37+
echo "Event Name: $EVENT_NAME"
38+
echo "Files Changed: $FILES_CHANGED"
39+
echo "PR Author: $PR_AUTHOR"
40+
41+
# Check workflow file changes
42+
if [[ "$FILES_CHANGED" == *".github/workflows/"* ]]; then
43+
echo "Workflow files changed: YES"
44+
else
45+
echo "Workflow files changed: NO"
46+
fi
47+
48+
# Check author conditions
49+
if [[ "$PR_AUTHOR" != "misrasaurabh1" && "$PR_AUTHOR" != "KRRT7" ]]; then
50+
echo "Author needs approval: YES"
51+
else
52+
echo "Author needs approval: NO"
53+
fi
54+
55+
# Selected environment
56+
echo "Selected Environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}"
3657
3758
- name: Validate PR for workflow changes
3859
run: |
3960
# Check for any workflow changes
40-
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
61+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
4162
echo "⚠️ Workflow changes detected."
4263
# Get the PR author
4364
AUTHOR="${{ github.event.pull_request.user.login }}"

codeflash/verification/pytest_plugin.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# System Imports
77
import logging
88
import os
9+
import platform
910
import re
1011
import sys
1112
import time
@@ -36,6 +37,19 @@ class UnexpectedError(Exception):
3637
pass
3738

3839

40+
if platform.system() == "Linux" or platform.system() == "Darwin":
41+
import resource
42+
43+
# Get total system memory
44+
total_memory = os.sysconf("SC_PAGE_SIZE") * os.sysconf(
45+
"SC_PHYS_PAGES"
46+
) # Set memory limit to 80% of total system memory
47+
memory_limit = int(total_memory * 0.8)
48+
49+
# Set both soft and hard limits
50+
resource.setrlimit(resource.RLIMIT_AS, (memory_limit, memory_limit))
51+
52+
3953
def pytest_addoption(parser: Parser) -> None:
4054
"""Add command line options."""
4155
pytest_loops = parser.getgroup("loops")

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ pytest = ">=7.0.0,<8.3.4"
7373
gitpython = ">=3.1.31"
7474
libcst = ">=1.0.1"
7575
jedi = ">=0.19.1"
76-
tiktoken = ">=0.3.2"
76+
tiktoken = ">=0.7.0"
7777
timeout-decorator = ">=0.5.0"
7878
pytest-timeout = ">=2.1.0"
7979
tomlkit = ">=0.11.7"
8080
unittest-xml-reporting = ">=3.2.0"
8181
junitparser = ">=3.1.0"
8282
pydantic = ">=1.10.1"
8383
humanize = ">=4.0.0"
84-
posthog = ">=3.0.0,<=3.11.0"
84+
posthog = ">=3.0.0"
8585
click = ">=8.1.0"
8686
inquirer = ">=3.0.0"
8787
sentry-sdk = ">=1.40.6,<3.0.0"

0 commit comments

Comments
 (0)